From 046d2174207d79681fe98206ce92074ac610957e Mon Sep 17 00:00:00 2001 From: Andrey Korolyov Date: Tue, 5 Jan 2016 19:59:06 +0300 Subject: inteltool: add NetBSD compatibility Tested on NetBSD-7.0/i386 Change-Id: I6a693633d3a80ea07ade233b1b4fd1c5a1412032 Signed-off-by: Andrey Korolyov Reviewed-on: https://review.coreboot.org/12835 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/inteltool/inteltool.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'util/inteltool/inteltool.h') diff --git a/util/inteltool/inteltool.h b/util/inteltool/inteltool.h index 6845b4ef6d..abaac50a59 100644 --- a/util/inteltool/inteltool.h +++ b/util/inteltool/inteltool.h @@ -24,13 +24,38 @@ #define __DARWIN__ #include #endif +#ifdef __NetBSD__ +#include +#else #include +#endif /* This #include is needed for freebsd_{rd,wr}msr. */ #if defined(__FreeBSD__) #include #endif +#ifdef __NetBSD__ +static inline uint8_t inb(unsigned port) +{ + uint8_t data; + __asm volatile("inb %w1,%0" : "=a" (data) : "d" (port)); + return data; +} +static inline uint16_t inw(unsigned port) +{ + uint16_t data; + __asm volatile("inw %w1,%0": "=a" (data) : "d" (port)); + return data; +} +static inline uint32_t inl(unsigned port) +{ + uint32_t data; + __asm volatile("inl %w1,%0": "=a" (data) : "d" (port)); + return data; +} +#endif + #define INTELTOOL_VERSION "1.0" /* Tested chipsets: */ -- cgit v1.2.3