7 static int _open(int bus, int slot, int fn)
 
  11         sprintf(fname, "/proc/bus/pci/%02x/%02x.%01x", bus, slot, fn);
 
  12         return open(fname, O_RDWR);
 
  15 void pci_write32(int bus, int slot, int fn, int addr, uint32_t data)
 
  19         fd = _open(bus, slot, fn);
 
  22         lseek(fd, addr, SEEK_SET);
 
  27 void pci_write16(int bus, int slot, int fn, int addr, uint16_t data)
 
  31         fd = _open(bus, slot, fn);
 
  34         lseek(fd, addr, SEEK_SET);
 
  39 void pci_write8(int bus, int slot, int fn, int addr, uint8_t data)
 
  43         fd = _open(bus, slot, fn);
 
  46         lseek(fd, addr, SEEK_SET);
 
  51 uint32_t pci_read32(int bus, int slot, int fn, int addr)
 
  56         fd = _open(bus, slot, fn);
 
  59         lseek(fd, addr, SEEK_SET);
 
  66 uint16_t pci_read16(int bus, int slot, int fn, int addr)
 
  71         fd = _open(bus, slot, fn);
 
  77         lseek(fd, addr, SEEK_SET);
 
  85 uint8_t pci_read8(int bus, int slot, int fn, int addr)
 
  90         fd = _open(bus, slot, fn);
 
  96         lseek(fd, addr, SEEK_SET);