5 static void __pci_config(int bus, int slot, int fn, int addr)
7 outl(0xCF8, 0x80000000ULL | (bus << 16) | (slot << 11) | (fn << 8) | (addr & ~3));
10 void pci_write32(int bus, int slot, int fn, int addr, uint32_t data)
12 __pci_config(bus, slot, fn, addr);
16 void pci_write16(int bus, int slot, int fn, int addr, uint16_t data)
18 __pci_config(bus, slot, fn, addr);
22 void pci_write8(int bus, int slot, int fn, int addr, uint8_t data)
24 __pci_config(bus, slot, fn, addr);
28 uint32_t pci_read32(int bus, int slot, int fn, int addr)
30 __pci_config(bus, slot, fn, addr);
34 uint16_t pci_read16(int bus, int slot, int fn, int addr)
36 __pci_config(bus, slot, fn, addr);
37 return inw(0xCFC + (addr & 2));
40 uint8_t pci_read8(int bus, int slot, int fn, int addr)
42 __pci_config(bus, slot, fn, addr);
43 return inb(0xCFC + (addr & 3));