summaryrefslogtreecommitdiff
path: root/util/inteltool/inteltool.h
diff options
context:
space:
mode:
authorAndrey Korolyov <andrey@xdel.ru>2016-01-05 19:59:06 +0300
committerPatrick Georgi <pgeorgi@google.com>2016-01-07 15:33:13 +0100
commit046d2174207d79681fe98206ce92074ac610957e (patch)
tree7cdad9ed59ff9ccc35a709bb25085e4ef544d015 /util/inteltool/inteltool.h
parent0ff8f9048b104b4a01823755406fa79a590ad02f (diff)
downloadcoreboot-046d2174207d79681fe98206ce92074ac610957e.tar.xz
inteltool: add NetBSD compatibility
Tested on NetBSD-7.0/i386 Change-Id: I6a693633d3a80ea07ade233b1b4fd1c5a1412032 Signed-off-by: Andrey Korolyov <andrey@xdel.ru> Reviewed-on: https://review.coreboot.org/12835 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/inteltool/inteltool.h')
-rw-r--r--util/inteltool/inteltool.h25
1 files changed, 25 insertions, 0 deletions
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 <DirectHW/DirectHW.h>
#endif
+#ifdef __NetBSD__
+#include <pciutils/pci.h>
+#else
#include <pci/pci.h>
+#endif
/* This #include is needed for freebsd_{rd,wr}msr. */
#if defined(__FreeBSD__)
#include <machine/cpufunc.h>
#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: */