diff options
author | Andriy Gapon <avg@icyb.net.ua> | 2008-10-28 22:13:38 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2008-10-28 22:13:38 +0000 |
commit | b64aa60f1fd5e6c84ec8ff6ad0baa7afee0d810a (patch) | |
tree | af1c87228d5b0ed4e7726cf406c742c9e72c2313 /util/superiotool/superiotool.h | |
parent | c372aa4f77a81e24c1ced47b1da010814b3da3bf (diff) | |
download | coreboot-b64aa60f1fd5e6c84ec8ff6ad0baa7afee0d810a.tar.xz |
Allow superiotool to compile and work on FreeBSD. Tested on FreeBSD 7.
Signed-off-by: Andriy Gapon <avg@icyb.net.ua>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3698 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/superiotool/superiotool.h')
-rw-r--r-- | util/superiotool/superiotool.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h index 3433cdb4a6..7e0ca0bd9b 100644 --- a/util/superiotool/superiotool.h +++ b/util/superiotool/superiotool.h @@ -28,7 +28,27 @@ #include <stdint.h> #include <string.h> #include <getopt.h> +#if defined(__GLIBC__) #include <sys/io.h> +#endif + +#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 +#define OUTB outb +#define OUTW outw +#define OUTL outl +#define INB inb +#define INW inw +#define INL inl +#endif #define USAGE "Usage: superiotool [-d] [-e] [-l] [-V] [-v] [-h]\n\n\ -d | --dump Dump Super I/O register contents\n\ |