Linux (via /sys/bus/pci, /proc/bus/pci or i386 ports)
FreeBSD (via /dev/pci)
NetBSD (via libpci)
- OpenBSD (via /dev/pci)
+ OpenBSD (via /dev/pci or i386 ports)
GNU/kFreeBSD (via /dev/pci)
Solaris/i386 (direct port access)
Aix (via /dev/pci and odmget)
echo >>$c '#define PCI_PATH_DEVMEM_DEVICE "/dev/mem"'
echo >>$c '#define PCI_PATH_ACPI_MCFG "/var/db/acpi/MCFG.*"'
echo >>$c '#define PCI_PATH_EFI_SYSTAB ""'
+ case $cpu in
+ i386|amd64) echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ echo >>$m 'WITH_LIBS+=-l'$cpu
+ ;;
+ esac
LIBRESOLV=
;;
--- /dev/null
+/*
+ * The PCI Library -- Access to i386 I/O ports on OpenBSD
+ *
+ * Copyright (c) 2023 Grant Pannell <grant@pannell.net.au>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <sys/types.h>
+#include <machine/sysarch.h>
+#include <machine/pio.h>
+
+#include "i386-io-access.h"
+
+#if defined(__amd64__)
+ #define obsd_iopl amd64_iopl
+#else
+ #define obsd_iopl i386_iopl
+#endif
+
+static int iopl_enabled;
+
+static int
+intel_setup_io(struct pci_access *a UNUSED)
+{
+ if (iopl_enabled)
+ return 1;
+
+ if (obsd_iopl(3) < 0)
+ {
+ return 0;
+ }
+
+ iopl_enabled = 1;
+ return 1;
+}
+
+static inline void
+intel_cleanup_io(struct pci_access *a UNUSED)
+{
+ if (iopl_enabled)
+ {
+ obsd_iopl(0);
+ iopl_enabled = 0;
+ }
+}
+
+static inline void intel_io_lock(void)
+{
+}
+
+static inline void intel_io_unlock(void)
+{
+}
#include "i386-io-beos.h"
#elif defined(PCI_OS_DJGPP)
#include "i386-io-djgpp.h"
+#elif defined(PCI_OS_OPENBSD)
+#include "i386-io-openbsd.h"
#else
#error Do not know how to access I/O ports on this OS.
#endif