From 3646c8f31fbb4f52cac04129b8d6898fb00e1eab Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Fri, 8 Jan 2010 21:18:08 +0000 Subject: Add support for NetBSD Corresponding to flashrom svn r838. Signed-off-by: Jonathan A. Kollasch Acked-by: Carl-Daniel Hailfinger --- hwaccess.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'hwaccess.h') diff --git a/hwaccess.h b/hwaccess.h index edf1738..2bc2927 100644 --- a/hwaccess.h +++ b/hwaccess.h @@ -76,6 +76,63 @@ #endif #endif +#if defined(__NetBSD__) + #define off64_t off_t + #define lseek64 lseek + #if defined(__i386__) || defined(__x86_64__) + #include + #include + #if defined(__i386__) + #define iopl i386_iopl + #elif defined(__x86_64__) + #define iopl x86_64_iopl + #endif + #include + +static inline void +outb(uint8_t value, uint16_t port) +{ + asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port)); +} + +static inline uint8_t +inb(uint16_t port) +{ + uint8_t value; + asm volatile ("inb %w1,%0":"=a" (value):"Nd" (port)); + return value; +} + +static inline void +outw(uint16_t value, uint16_t port) +{ + asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port)); +} + +static inline uint16_t +inw(uint16_t port) +{ + uint16_t value; + asm volatile ("inw %w1,%0":"=a" (value):"Nd" (port)); + return value; +} + +static inline void +outl(uint32_t value, uint16_t port) +{ + asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port)); +} + +static inline uint32_t +inl(uint16_t port) +{ + uint32_t value; + asm volatile ("inl %1,%0":"=a" (value):"Nd" (port)); + return value; +} + #endif +#endif + #if defined(__FreeBSD__) || defined(__DragonFly__) extern int io_fd; #endif -- cgit v1.1