X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/7e16b8e6b3c3aab2c91d9b54c8953201e111be50..4a4bc0fa423f2c3ffc37adb7f8c7c221d1a9ac82:/pci/pci-raw.c diff --git a/pci/pci-raw.c b/pci/pci-raw.c index 4747ffd..f6448b8 100644 --- a/pci/pci-raw.c +++ b/pci/pci-raw.c @@ -1,10 +1,10 @@ #include #include -#include "pci.h" +#include static void __pci_config(int bus, int slot, int fn, int addr) { - outl(0xCF8, 0x80000000ULL | (bus << 16) | (slot << 11) | (fn << 8) | addr); + outl(0xCF8, 0x80000000ULL | (bus << 16) | (slot << 11) | (fn << 8) | (addr & ~3)); } void pci_write32(int bus, int slot, int fn, int addr, uint32_t data) @@ -34,11 +34,11 @@ uint32_t pci_read32(int bus, int slot, int fn, int addr) uint16_t pci_read16(int bus, int slot, int fn, int addr) { __pci_config(bus, slot, fn, addr); - return inw(0xCFC); + return inw(0xCFC + (addr & 2)); } uint8_t pci_read8(int bus, int slot, int fn, int addr) { __pci_config(bus, slot, fn, addr); - return inb(0xCFC); + return inb(0xCFC + (addr & 3)); }