Author: stefanct
Date: Sun Mar  6 23:32:16 2016
New Revision: 1948
URL: http://flashrom.org/trac/flashrom/changeset/1948

Log:
Add support for GNU Hurd.

Signed-off-by: Stefan Tauner <stefan.tau...@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2...@gmx.net>

Modified:
   trunk/hwaccess.c
   trunk/os.h

Modified: trunk/hwaccess.c
==============================================================================
--- trunk/hwaccess.c    Sun Mar  6 15:33:49 2016        (r1947)
+++ trunk/hwaccess.c    Sun Mar  6 23:32:16 2016        (r1948)
@@ -33,12 +33,17 @@
 #include "flash.h"
 #include "hwaccess.h"
 
-#if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 
|| defined(__DJGPP__) || defined(__LIBPAYLOAD__) || defined(__sun))
+#if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 
|| defined(__DJGPP__) || defined(__LIBPAYLOAD__) || defined(__sun) || 
defined(__gnu_hurd__))
 #error "Unknown operating system"
 #endif
 
 #define USE_IOPL       (IS_LINUX || IS_MACOSX || defined(__NetBSD__) || 
defined(__OpenBSD__))
 #define USE_DEV_IO     (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__))
+#define USE_IOPERM     (defined(__gnu_hurd__))
+
+#if USE_IOPERM
+#include <sys/io.h>
+#endif
 
 #if IS_X86 && USE_DEV_IO
 int io_fd;
@@ -82,6 +87,8 @@
        sysi86(SI86V86, V86SC_IOPL, 0);
 #elif USE_DEV_IO
        close(io_fd);
+#elif USE_IOPERM
+       ioperm(0, 65536, 0);
 #elif USE_IOPL
        iopl(0);
 #endif
@@ -97,6 +104,8 @@
        if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
 #elif USE_DEV_IO
        if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
+#elif USE_IOPERM
+       if (ioperm(0, 65536, 1) != 0) {
 #elif USE_IOPL
        if (iopl(3) != 0) {
 #endif

Modified: trunk/os.h
==============================================================================
--- trunk/os.h  Sun Mar  6 15:33:49 2016        (r1947)
+++ trunk/os.h  Sun Mar  6 23:32:16 2016        (r1948)
@@ -56,6 +56,9 @@
 // libpayload
 #elif defined(__LIBPAYLOAD__)
 #define __FLASHROM_OS__ "libpayload"
+// GNU Hurd
+#elif defined(__gnu_hurd__)
+#define __FLASHROM_OS__ "Hurd"
 // Linux
 #elif defined(__linux__)
        // There are various flags in use on Android apparently. __ANDROID__ 
seems to be the most trustworthy.

_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to