]> mj.ucw.cz Git - pciutils.git/blob - lib/i386-io-linux.h
Fixed 64 bit addresses and released as 2.2.0.
[pciutils.git] / lib / i386-io-linux.h
1 /*
2  *      The PCI Library -- Access to i386 I/O ports on Linux
3  *
4  *      Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
5  *
6  *      Can be freely distributed and used under the terms of the GNU GPL.
7  */
8
9 #ifdef __GLIBC__
10 #include <sys/io.h>
11 #else
12 #include <asm/io.h>
13 #endif
14
15 static int intel_iopl_set = -1;
16
17 static int
18 intel_setup_io(void)
19 {
20   if (intel_iopl_set < 0)
21     intel_iopl_set = (iopl(3) < 0) ? 0 : 1;
22   return intel_iopl_set;
23 }
24
25 static inline void
26 intel_cleanup_io(void)
27 {
28   if (intel_iopl_set > 0)
29     iopl(3);
30   intel_iopl_set = -1;
31 }