diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:30:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:30:56 +0000 |
commit | d3114e0edc60508fc1e44e6cd2733fb2a97cdaca (patch) | |
tree | 82d66db664dea6ee75010455b98b04f47fcc4a90 /lib/i386-io-openbsd.h | |
parent | Initial commit. (diff) | |
download | pciutils-d3114e0edc60508fc1e44e6cd2733fb2a97cdaca.tar.xz pciutils-d3114e0edc60508fc1e44e6cd2733fb2a97cdaca.zip |
Adding upstream version 1:3.11.1.upstream/1%3.11.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/i386-io-openbsd.h')
-rw-r--r-- | lib/i386-io-openbsd.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/i386-io-openbsd.h b/lib/i386-io-openbsd.h new file mode 100644 index 0000000..8a9b4a4 --- /dev/null +++ b/lib/i386-io-openbsd.h @@ -0,0 +1,54 @@ +/* + * 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) +{ +} |