PCI enhancements.
[seabios.git] / src / pci.h
1 #ifndef __PCI_H
2 #define __PCI_H
3
4 #include "types.h" // u32
5
6 typedef struct PCIDevice {
7     u8 bus;
8     u8 devfn;
9 } PCIDevice;
10
11 static inline PCIDevice
12 pci_bd(u8 bus, u8 devfn)
13 {
14     struct PCIDevice d = {bus, devfn};
15     return d;
16 }
17
18 void pci_config_writel(PCIDevice d, u32 addr, u32 val);
19 void pci_config_writew(PCIDevice d, u32 addr, u16 val);
20 void pci_config_writeb(PCIDevice d, u32 addr, u8 val);
21 u32 pci_config_readl(PCIDevice d, u32 addr);
22 u16 pci_config_readw(PCIDevice d, u32 addr);
23 u8 pci_config_readb(PCIDevice d, u32 addr);
24
25 int pci_find_device(u16 vendid, u16 devid, int index, PCIDevice *dev);
26 int pci_find_class(u32 classid, int index, PCIDevice *dev);
27
28 #endif