1 #include <console/console.h>
3 #include <arch/pciconf.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
8 const struct pci_ops *conf = 0;
11 * Direct access to PCI hardware...
14 uint8_t pci_read_config8(device_t dev, unsigned where)
17 value = conf->read8(dev->bus->secondary, dev->path.u.pci.devfn, where);
18 printk_spew("Read config 8 bus %d,devfn 0x%x,reg 0x%x,val 0x%x\n",
19 dev->bus->secondary, dev->path.u.pci.devfn, where, value);
23 uint16_t pci_read_config16(device_t dev, unsigned where)
26 value = conf->read16(dev->bus->secondary, dev->path.u.pci.devfn, where);
27 printk_spew( "Read config 16 bus %d,devfn 0x%x,reg 0x%x,val 0x%x\n",
28 dev->bus->secondary, dev->path.u.pci.devfn, where, value);
32 uint32_t pci_read_config32(device_t dev, unsigned where)
35 value = conf->read32(dev->bus->secondary, dev->path.u.pci.devfn, where);
36 printk_spew( "Read config 32 bus %d,devfn 0x%x,reg 0x%x,val 0x%x\n",
37 dev->bus->secondary, dev->path.u.pci.devfn, where, value);
41 void pci_write_config8(device_t dev, unsigned where, uint8_t val)
43 printk_spew( "Write config 8 bus %d, devfn 0x%x, reg 0x%x, val 0x%x\n",
44 dev->bus->secondary, dev->path.u.pci.devfn, where, val);
45 conf->write8(dev->bus->secondary, dev->path.u.pci.devfn, where, val);
48 void pci_write_config16(device_t dev, unsigned where, uint16_t val)
50 printk_spew( "Write config 16 bus %d, devfn 0x%x, reg 0x%x, val 0x%x\n",
51 dev->bus->secondary, dev->path.u.pci.devfn, where, val);
52 conf->write16(dev->bus->secondary, dev->path.u.pci.devfn, where, val);
55 void pci_write_config32(device_t dev, unsigned where, uint32_t val)
57 printk_spew( "Write config 32 bus %d, devfn 0x%x, reg 0x%x, val 0x%x\n",
58 dev->bus->secondary, dev->path.u.pci.devfn, where, val);
59 conf->write32(dev->bus->secondary, dev->path.u.pci.devfn, where, val);