summaryrefslogtreecommitdiff
path: root/util/nvramtool/common.h
diff options
context:
space:
mode:
authorAndriy Gapon <avg@icyb.net.ua>2008-10-30 15:41:39 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-10-30 15:41:39 +0000
commit6a4bf9886ac9990206ac64fd09890bca433d9bd8 (patch)
treefbb671eed32708e7d8bbe4852ef3ff624db7034c /util/nvramtool/common.h
parentb076ced581669632d03b2f768b30aec2ffcd2e23 (diff)
downloadcoreboot-6a4bf9886ac9990206ac64fd09890bca433d9bd8.tar.xz
Allow nvramtool to build and work on FreeBSD. Tested on FreeBSD 7.
Signed-off-by: Andriy Gapon <avg@icyb.net.ua> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3709 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/nvramtool/common.h')
-rw-r--r--util/nvramtool/common.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/nvramtool/common.h b/util/nvramtool/common.h
index f262ea41ab..a247380bce 100644
--- a/util/nvramtool/common.h
+++ b/util/nvramtool/common.h
@@ -43,6 +43,25 @@
#include <string.h>
#include <ctype.h>
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <machine/cpufunc.h>
+#define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0)
+#define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0)
+#define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0)
+#define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); })
+#define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
+#define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
+#else
+#include <sys/io.h>
+#define OUTB outb
+#define OUTW outw
+#define OUTL outl
+#define INB inb
+#define INW inw
+#define INL inl
+#endif
+
#define FALSE 0
#define TRUE 1