projects/aports·blob master · refs

72 lines · 2.2 KiB

1From 695aa0f76173a03295a6d897d7260a09951931bc Mon Sep 17 00:00:00 2001
2From: Harald Geyer <[email protected]>
3Date: Mon, 19 Jul 2021 23:38:05 +0200
4Subject: [PATCH] Fix lpt port detection
5
6The old detection logic was too greedy, claiming raw port access on
7platforms like ARM, that don't follow x86 conventions.
8
9Nowadays we have many platform independent drivers, so let's support
10non-x86 platforms officially.
11
12Closes: #137
13
14Signed-off-by: Harald Geyer <[email protected]>
15---
16 INSTALL.md | 7 +++----
17 server/drivers/port.h | 8 ++++++--
18 server/drivers/serialVFD_io.c | 6 ++++++
19 3 files changed, 15 insertions(+), 6 deletions(-)
20
21diff --git a/server/drivers/port.h b/server/drivers/port.h
22index c584cd4e..f80a09d7 100644
23--- a/server/drivers/port.h
24+++ b/server/drivers/port.h
25@@ -94,7 +94,7 @@ static inline int port_deny_multiple(unsigned short port, unsigned short count);
26 /* ---------------------------- Linux ------------------------------------ */
27 /* Use ioperm, inb and outb in <sys/io.h> (Linux) */
28 /* And iopl for higher addresses of PCI LPT cards */
29-#if defined HAVE_IOPERM
30+#if defined HAVE_IOPERM && (defined(__x86__) || defined(__x86_64__))
31
32 /* Glibc2 and Glibc1 */
33 # ifdef HAVE_SYS_IO_H
34@@ -333,7 +333,7 @@ static inline int port_deny_multiple (unsigned short port, unsigned short count)
35 return i386_set_ioperm(port, count, 0);
36 }
37
38-#else
39+#elif (defined(__x86__) || defined(__x86_64__))
40
41 /* ------------------------- Everything else ----------------------------- */
42 /* Last chance! Use /dev/io and i386 ASM code (BSD4.3 ?) */
43@@ -384,6 +384,10 @@ static inline int port_deny_multiple (unsigned short port, unsigned short count)
44 return 0;
45 }
46
47+#else
48+
49+#error No low level lpt port access supported on this platform.
50+
51 #endif
52
53 #endif /* PORT_H */
54diff --git a/server/drivers/serialVFD_io.c b/server/drivers/serialVFD_io.c
55index 8dbc3794..e20c0ea5 100644
56--- a/server/drivers/serialVFD_io.c
57+++ b/server/drivers/serialVFD_io.c
58@@ -41,8 +41,14 @@
59
60 #include "lcd.h"
61 #include "shared/report.h"
62+
63+#ifdef HAVE_PCSTYLE_LPT_CONTROL
64+
65 #include "lpt-port.h"
66 #include "port.h"
67+
68+#endif
69+
70 #include "serialVFD_io.h"
71 #include "serialVFD.h"
72