Anastasia Klimchuk submitted this change.

View Change

Approvals: Peter Marheine: Looks good to me, approved Hsuan-ting Chen: Looks good to me, approved build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
hwaccess_x86_io: Fix Android compilation with bionic libc

Recently Android Bionic LibC got sys/io.h. Use this header to access
ioperm(). Use Assembly for I/O, as Bionic does not have inb(), outb(),
etc.

Tested on Android 14 by adding flashrom and pciutils as external repositories, adding Android.bp blueprints (Android specialized build system - Soong), building, running and accessing (read, erase, write) SPI flash on x86 device.

Change-Id: Id80b83c2718679c925ed6ddfe33cbe837eea0429
Signed-off-by: Jakub Czapiga <czapiga@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/83133
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M hwaccess_x86_io.c
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hwaccess_x86_io.c b/hwaccess_x86_io.c
index 93d29d8..70b7439 100644
--- a/hwaccess_x86_io.c
+++ b/hwaccess_x86_io.c
@@ -58,10 +58,11 @@
#define USE_IOPERM 9

#if defined(__ANDROID__)
-#include <sys/glibc-syscalls.h>
+#include <sys/io.h>
+#include <unistd.h>

-#define IO_PORT_PERMISSION USE_IOPL
-#define IO_PORT_FUNCTION USE_LIBC_TARGET_LAST
+#define IO_PORT_PERMISSION USE_IOPERM
+#define IO_PORT_FUNCTION USE_ASM
#endif

#if defined(__linux__) && !defined(__ANDROID__)

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

Gerrit-MessageType: merged
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Id80b83c2718679c925ed6ddfe33cbe837eea0429
Gerrit-Change-Number: 83133
Gerrit-PatchSet: 3
Gerrit-Owner: Jakub Czapiga <czapiga@google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Hsuan-ting Chen <roccochen@google.com>
Gerrit-Reviewer: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>