Fabian Groffen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/73358 )
Change subject: util: Fix compilation on musl-libc systems ......................................................................
util: Fix compilation on musl-libc systems
Add some includes, use linux guard instead of __GLIBC__ where applicable. Uses ioperm instead of deprecated iopl.
Signed-off-by: Fabian Groffen grobian@gentoo.org Change-Id: I99613007aa9feddcb1041f31085cdeb195ff7a68 --- M src/arch/x86/include/arch/mmio.h M util/inteltool/inteltool.h M util/superiotool/superiotool.c M util/superiotool/superiotool.h 4 files changed, 25 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/73358/1
diff --git a/src/arch/x86/include/arch/mmio.h b/src/arch/x86/include/arch/mmio.h index c2aa0fb..b2a37a0 100644 --- a/src/arch/x86/include/arch/mmio.h +++ b/src/arch/x86/include/arch/mmio.h @@ -5,6 +5,10 @@
#include <stdint.h>
+#ifndef __always_inline +#define __always_inline inline +#endif + static __always_inline uint8_t read8(const volatile void *addr) { return *((volatile uint8_t *)(addr)); diff --git a/util/inteltool/inteltool.h b/util/inteltool/inteltool.h index 130e63c..490c70e 100644 --- a/util/inteltool/inteltool.h +++ b/util/inteltool/inteltool.h @@ -9,7 +9,7 @@
#include <stdint.h>
-#if defined(__GLIBC__) +#if defined(linux) #include <sys/io.h> #endif #if (defined(__MACH__) && defined(__APPLE__)) diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c index ed18c13..bd1c345 100644 --- a/util/superiotool/superiotool.c +++ b/util/superiotool/superiotool.c @@ -324,8 +324,8 @@ if ((io_fd = open("/dev/io", O_RDWR)) < 0) { perror("/dev/io"); #else - if (iopl(3) < 0) { - perror("iopl"); + if (ioperm(0, 6000, 1) < 0) { + perror("ioperm"); #endif printf("Superiotool must be run as root.\n"); exit(1); diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h index a621ae5..1f6b3e95 100644 --- a/util/superiotool/superiotool.h +++ b/util/superiotool/superiotool.h @@ -8,7 +8,7 @@ #include <stdint.h> #include <string.h> #include <getopt.h> -#if defined(__GLIBC__) +#if defined(linux) #include <sys/io.h> #endif #if (defined(__MACH__) && defined(__APPLE__)) @@ -24,6 +24,9 @@ # endif #endif
+#include <sys/types.h> +#include <stdint.h> + #if defined(__FreeBSD__) #include <sys/types.h> #include <machine/cpufunc.h> @@ -89,6 +92,7 @@ __asm__ __volatile__ ("inl %1,%0":"=a" (value):"Nd" (port)); return value; } + #endif
#define USAGE "Usage: superiotool [-d] [-e] [-a] [-l] [-V] [-v] [-h]\n\n\