- Update abuild.sh so it will rebuild successfull builds
[coreboot.git] / src / arch / i386 / lib / pci_ops.c
1 #include <console/console.h>
2 #include <arch/io.h>
3 #include <arch/pciconf.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7
8 const struct pci_ops *conf = 0;
9
10 /*
11  * Direct access to PCI hardware...
12  */
13
14 uint8_t pci_read_config8(device_t dev, unsigned where)
15 {
16         uint8_t value;
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);
20         return value;
21 }
22
23 uint16_t pci_read_config16(device_t dev, unsigned where)
24 {
25         uint16_t value;
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);
29         return value;
30 }
31
32 uint32_t pci_read_config32(device_t dev, unsigned where)
33 {
34         uint32_t value;
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);
38         return value;
39 }
40
41 void pci_write_config8(device_t dev, unsigned where, uint8_t val)
42 {
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);
46 }
47
48 void pci_write_config16(device_t dev, unsigned where, uint16_t val)
49 {
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);
53 }
54
55 void pci_write_config32(device_t dev, unsigned where, uint32_t val)
56 {
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);
60 }