]> mj.ucw.cz Git - pciutils.git/blob - lib/i386-io-openbsd.h
libpci: Update manpage documentation for devmem.path
[pciutils.git] / lib / i386-io-openbsd.h
1 /*
2  *      The PCI Library -- Access to i386 I/O ports on OpenBSD
3  *
4  *      Copyright (c) 2023 Grant Pannell <grant@pannell.net.au>
5  *
6  *      Can be freely distributed and used under the terms of the GNU GPL.
7  */
8
9 #include <sys/types.h>
10 #include <machine/sysarch.h>
11 #include <machine/pio.h>
12
13 #include "i386-io-access.h"
14
15 #if defined(__amd64__)
16   #define obsd_iopl amd64_iopl
17 #else
18   #define obsd_iopl i386_iopl
19 #endif
20
21 static int iopl_enabled;
22
23 static int
24 intel_setup_io(struct pci_access *a UNUSED)
25 {
26   if (iopl_enabled)
27     return 1;
28
29   if (obsd_iopl(3) < 0)
30     {
31       return 0;
32     }
33
34   iopl_enabled = 1;
35   return 1;
36 }
37
38 static inline void
39 intel_cleanup_io(struct pci_access *a UNUSED)
40 {
41   if (iopl_enabled)
42     {
43       obsd_iopl(0);
44       iopl_enabled = 0;
45     }
46 }
47
48 static inline void intel_io_lock(void)
49 {
50 }
51
52 static inline void intel_io_unlock(void)
53 {
54 }