2 * The PCI Library -- Access to i386 I/O ports on Windows
4 * Copyright (c) 2004 Alexander Stock <stock.alexander@gmx.de>
5 * Copyright (c) 2006 Martin Mares <mj@ucw.cz>
7 * Can be freely distributed and used under the terms of the GNU GPL.
16 int _outp(unsigned short port, int databyte);
17 unsigned short _outpw(unsigned short port, unsigned short dataword);
18 unsigned long _outpd(unsigned short port, unsigned long dataword);
19 int _inp(unsigned short port);
20 unsigned short _inpw(unsigned short port);
21 unsigned long _inpd(unsigned short port);
24 #define outb(x,y) _outp(y,x)
25 #define outw(x,y) _outpw(y,x)
26 #define outl(x,y) _outpd(y,x)
28 #define inb(x) _inp(x)
29 #define inw(x) _inpw(x)
30 #define inl(x) _inpd(x)
33 intel_setup_io(struct pci_access *a)
35 typedef int (*MYPROC)(void);
36 MYPROC InitializeWinIo;
40 /* 16/32-bit non-NT systems allow applications to access PCI I/O ports without any special setup. */
41 OSVERSIONINFOA version;
42 version.dwOSVersionInfoSize = sizeof(version);
43 if (GetVersionExA(&version) && version.dwPlatformId < VER_PLATFORM_WIN32_NT)
45 a->debug("Detected 16/32-bit non-NT system, skipping NT setup...");
50 lib = LoadLibrary("WinIo.dll");
53 a->warning("i386-io-windows: Couldn't load WinIo.dll.");
56 /* XXX: Is this really needed? --mj */
57 GetProcAddress(lib, "InitializeWinIo");
59 InitializeWinIo = (MYPROC) GetProcAddress(lib, "InitializeWinIo");
62 a->warning("i386-io-windows: Couldn't find InitializeWinIo function.");
66 if (!InitializeWinIo())
68 a->warning("i386-io-windows: InitializeWinIo() failed.");
76 intel_cleanup_io(struct pci_access *a UNUSED)
78 //TODO: DeInitializeWinIo!
82 static inline void intel_io_lock(void)
86 static inline void intel_io_unlock(void)