9 static int _open(int bus, int slot, int fn)
13 sprintf(fname, "/proc/bus/pci/%02x/%02x.%01x", bus, slot, fn);
14 return open(fname, O_RDWR);
17 void pci_write32(int bus, int slot, int fn, int addr, uint32_t data)
21 fd = _open(bus, slot, fn);
24 lseek(fd, addr, SEEK_SET);
29 void pci_write16(int bus, int slot, int fn, int addr, uint16_t data)
33 fd = _open(bus, slot, fn);
36 lseek(fd, addr, SEEK_SET);
41 void pci_write8(int bus, int slot, int fn, int addr, uint8_t data)
45 fd = _open(bus, slot, fn);
48 lseek(fd, addr, SEEK_SET);
53 uint32_t pci_read32(int bus, int slot, int fn, int addr)
58 fd = _open(bus, slot, fn);
61 lseek(fd, addr, SEEK_SET);
68 uint16_t pci_read16(int bus, int slot, int fn, int addr)
73 fd = _open(bus, slot, fn);
79 lseek(fd, addr, SEEK_SET);
87 uint8_t pci_read8(int bus, int slot, int fn, int addr)
92 fd = _open(bus, slot, fn);
98 lseek(fd, addr, SEEK_SET);