summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2016-02-20 20:21:58 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2016-02-20 20:21:58 +0000
commit527dca273675af66728fe44c10787fcd5bd0aa09 (patch)
tree62cb1d94aa0f44283b2687bc1aa28d8f28fd9ab0
parent73763fabacba42f4d1c7d7df39983835f3c4df62 (diff)
downloadflashrom-527dca273675af66728fe44c10787fcd5bd0aa09.tar.gz
Include sys/glibc-syscalls.h instead of inexistent sys/io.h on Android.
This won't make raw I/O work magically but at least it would provide iopl() if some driver requires it and there is no better alternative currently. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1932 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--hwaccess.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/hwaccess.h b/hwaccess.h
index 4310a68..f92b2af 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -201,8 +201,14 @@ cpu_to_be(64)
/* sys/io.h provides iopl(2) and x86 I/O port access functions (inb, outb etc).
* It is included in glibc (thus available also on debian/kFreeBSD) but also in other libcs that mimic glibc,
- * e.g. musl and uclibc. */
-#if defined(__linux__) || defined(__GLIBC__)
+ * e.g. musl and uclibc. Because we cannot detect the libc or existence of the header or of the instructions
+ * themselves safely in here we use some heuristic below:
+ * On Android we don't have the header file and no way for I/O port access at all. However, sys/glibc-syscalls.h
+ * refers to an iopl implementation and we therefore include at least that one for now. On non-Android we assume
+ * that a Linux system's libc has a suitable sys/io.h or (on non-Linux) we depend on glibc to offer it. */
+#if defined(__ANDROID__)
+#include <sys/glibc-syscalls.h>
+#elif defined(__linux__) || defined(__GLIBC__)
#include <sys/io.h>
#endif