Peter Marheine has uploaded this change for review.

View Change

hwaccess: fix build on non-x86 targets

The changes to hwaccess in https://review.coreboot.org/c/flashrom/+/60110
cause build failure on non-x86 systems because:

* a new include file pulls in <sys/io.h> which only exists on x86 but
the header may be used on other platforms
* the new rget_io_perms function only works on x86

This change makes sys/io.h and rget_io_perms implementation only be
included when building for x86 targets, which fixes the build on ARM.

BUG=None
TEST=meson build succeeds for both x86 and ARM targets

Change-Id: I20f122679c30340b2c73afd7419e79644ddc3c4e
---
M hwaccess_x86_io.c
M hwaccess_x86_io.h
2 files changed, 3 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/94/61194/1
diff --git a/hwaccess_x86_io.c b/hwaccess_x86_io.c
index 3152bfe..7eee02a 100644
--- a/hwaccess_x86_io.c
+++ b/hwaccess_x86_io.c
@@ -33,7 +33,7 @@
int io_fd;
#endif

-#if !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
+#if defined(__i386__) || defined(__x86_64__) && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
static int release_io_perms(void *p)
{
#if defined (__sun)
@@ -79,7 +79,7 @@
#else

/* DJGPP and libpayload environments have full PCI port I/O permissions by default. */
-/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */
+/* PCI port I/O support is unimplemented on non-x86 platforms. */
int rget_io_perms(void)
{
return 0;
diff --git a/hwaccess_x86_io.h b/hwaccess_x86_io.h
index 0d16fdd..5cf151d 100644
--- a/hwaccess_x86_io.h
+++ b/hwaccess_x86_io.h
@@ -25,7 +25,7 @@
* 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__)
+#elif (defined(__i386__) || defined(__x86_64__)) && (defined(__linux__) || defined(__GLIBC__))
#include <sys/io.h>
#endif


To view, visit change 61194. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I20f122679c30340b2c73afd7419e79644ddc3c4e
Gerrit-Change-Number: 61194
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine@chromium.org>
Gerrit-MessageType: newchange