$OpenBSD$
--- hwaccess.h.orig	Thu Jun 24 22:14:33 2010
+++ hwaccess.h	Thu Jun 24 22:14:29 2010
@@ -31,7 +31,14 @@
 #endif
 
 #if NEED_PCI == 1
+/*
+ * libpci headers use the variable name "index" which triggers shadowing
+ * warnings on systems which have the index() function in a default #include
+ * or as builtin.
+ */
+#define index shadow_workaround_index
 #include <pci/pci.h>
+#undef index
 #endif
 
 #if defined (__i386__) || defined (__x86_64__)
@@ -221,17 +228,25 @@ cpu_to_be(64)
 #endif
 #endif
 
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) || defined (__OpenBSD__)
   #define off64_t off_t
   #define lseek64 lseek
   #if defined(__i386__) || defined(__x86_64__)
     #include <sys/types.h>
     #include <machine/sysarch.h>
+#if defined(__NetBSD__)
     #if defined(__i386__)
       #define iopl i386_iopl
     #elif defined(__x86_64__)
       #define iopl x86_64_iopl
     #endif
+#elif defined (__OpenBSD__)
+    #if defined(__i386__)
+      #define iopl i386_iopl
+    #elif defined(__amd64__)
+      #define iopl amd64_iopl
+    #endif
+#endif
   #include <stdint.h>
 
 static inline void outb(uint8_t value, uint16_t port)
