[PATCH i-g-t 1/2] intel_reg: support platforms without sys/io.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on an idea from Jani Nikula.

Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
Cc: Derek Morton <derek.j.morton@xxxxxxxxx>
Signed-off-by: Thomas Wood <thomas.wood@xxxxxxxxx>
---
 configure.ac      |  2 +-
 tools/intel_reg.c | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f3603c1..3770b2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" = xyes])
 
 # Checks for functions, headers, structures, etc.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h])
+AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h sys/io.h])
 AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
 		  #include <sys/sysinfo.h>
 		  ])
diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index 090cc25..190aa5b 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/io.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -38,6 +37,22 @@
 
 #include "intel_reg_spec.h"
 
+
+#ifdef HAVE_SYS_IO_H
+#include <sys/io.h>
+#else
+
+static inline int _not_supported(void)
+{
+       fprintf(stderr, "portio-vga not supported\n");
+       exit(EXIT_FAILURE);
+}
+#define inb(port)              _not_supported()
+#define outb(value, port)      _not_supported()
+#define iopl(level)
+
+#endif /* HAVE_SYS_IO_H */
+
 struct config {
 	struct pci_device *pci_dev;
 	char *mmiofile;
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux