summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorAndriy Gapon <avg@icyb.net.ua>2008-05-22 13:22:45 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-05-22 13:22:45 +0000
commit65c1b86fe7e0067b2c42e34c37265ddc0653d0f2 (patch)
tree02857d1503952dafdf3ff69e6ebf4daba347d609 /flash.h
parentcdbca5b23ce19744d36fbcc30111d963e23195f4 (diff)
downloadflashrom-65c1b86fe7e0067b2c42e34c37265ddc0653d0f2.tar.gz
flashrom-65c1b86fe7e0067b2c42e34c37265ddc0653d0f2.tar.bz2
flashrom-65c1b86fe7e0067b2c42e34c37265ddc0653d0f2.zip
Changes to make flashrom compile (and work) on FreeBSD
This patch addresses different argument order of outX() calls, FreeBSD-specific headers, difference in certain type names and system interface names, and also FreeBSD-specific way of gaining IO port access. Corresponding to flashrom svn r245 and coreboot v2 svn r3344. Signed-off-by: Andriy Gapon <avg@icyb.net.ua> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/flash.h b/flash.h
index a3740ee63..a41c660da 100644
--- a/flash.h
+++ b/flash.h
@@ -30,6 +30,25 @@
#include <stdint.h>
#include <stdio.h>
+#ifdef __FreeBSD__
+ #include <machine/cpufunc.h>
+ #define off64_t off_t
+ #define lseek64 lseek
+ #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
+ #define OUTB outb
+ #define OUTW outw
+ #define OUTL outl
+ #define INB inb
+ #define INW inw
+ #define INL inl
+#endif
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
struct flashchip {