| 1 | From 695aa0f76173a03295a6d897d7260a09951931bc Mon Sep 17 00:00:00 2001
|
| 2 | From: Harald Geyer <[email protected]>
|
| 3 | Date: Mon, 19 Jul 2021 23:38:05 +0200
|
| 4 | Subject: [PATCH] Fix lpt port detection
|
| 5 |
|
| 6 | The old detection logic was too greedy, claiming raw port access on
|
| 7 | platforms like ARM, that don't follow x86 conventions.
|
| 8 |
|
| 9 | Nowadays we have many platform independent drivers, so let's support
|
| 10 | non-x86 platforms officially.
|
| 11 |
|
| 12 | Closes: #137
|
| 13 |
|
| 14 | Signed-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 |
|
| 21 | diff --git a/server/drivers/port.h b/server/drivers/port.h
|
| 22 | index c584cd4e..f80a09d7 100644
|
| 23 | |
| 24 | |
| 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 */
|
| 54 | diff --git a/server/drivers/serialVFD_io.c b/server/drivers/serialVFD_io.c
|
| 55 | index 8dbc3794..e20c0ea5 100644
|
| 56 | |
| 57 | |
| 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 |
|