nvramtool: Fix build with OpenBSD

OpenBSD needs the same includes as NetBSD. It also doesn't have x86_64_iopl
function, but amd64_iopl.

Change-Id: I28273d4d87a3a77cf35412a0695325c0535e42e5
Signed-off-by: Piotr Kubaj <pkubaj@anongoth.pl>
Reviewed-on: https://review.coreboot.org/19741
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Piotr Kubaj 2017-05-17 20:33:47 +02:00 committed by Philipp Deppenwiese
parent a4bf0b7cd1
commit 1b36c9de66
2 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,7 @@ OS_ARCH = $(shell uname)
ifeq ($(OS_ARCH), Darwin) ifeq ($(OS_ARCH), Darwin)
LDFLAGS = -framework DirectHW LDFLAGS = -framework DirectHW
endif endif
ifeq ($(OS_ARCH), NetBSD) ifeq ($(OS_ARCH),$(filter $(OS_ARCH),NetBSD OpenBSD))
LDFLAGS = -l$(shell uname -p) LDFLAGS = -l$(shell uname -p)
endif endif
ifeq ($(shell uname -o 2>/dev/null), Cygwin) ifeq ($(shell uname -o 2>/dev/null), Cygwin)

View File

@ -17,7 +17,7 @@
#if (defined(__MACH__) && defined(__APPLE__)) #if (defined(__MACH__) && defined(__APPLE__))
#include <DirectHW/DirectHW.h> #include <DirectHW/DirectHW.h>
#endif #endif
#if defined(__NetBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
#include <machine/sysarch.h> #include <machine/sysarch.h>
@ -58,8 +58,12 @@ static inline uint32_t inl(uint16_t port)
} }
#endif #endif
#ifdef __x86_64__ #ifdef __x86_64__
#ifdef __OpenBSD__
#define iopl amd64_iopl
#else
#define iopl x86_64_iopl #define iopl x86_64_iopl
#endif #endif
#endif
#ifdef __i386__ #ifdef __i386__
#define iopl i386_iopl #define iopl i386_iopl
#endif #endif