7 #define MAX_PCI_DEVICES 32
8 #define MAX_PCI_BUSES 255
10 typedef uint32_t pciaddr_t
;
12 /* a structure for extended pci information */
16 char *linux_kernel_module
;
19 /* a struct to represent a pci device */
26 struct pci_dev_info
*pci_dev_info
;
31 struct pci_device
*pci_device
[MAX_PCI_DEVICES
];
32 uint8_t pci_device_count
;
35 struct pci_device_list
{
36 struct pci_device pci_device
[MAX_PCI_DEVICES
];
41 struct pci_bus pci_bus
[MAX_PCI_BUSES
];
51 uint8_t rid_min
, rid_max
;
55 static inline pciaddr_t
pci_mkaddr(uint32_t bus
, uint32_t dev
,
56 uint32_t func
, uint32_t reg
)
58 return 0x80000000 | ((bus
& 0xff) << 16) | ((dev
& 0x1f) << 11) |
59 ((func
& 0x07) << 8) | (reg
& 0xff);
62 enum pci_config_type
{
63 PCI_CFG_NONE
= -1, /* badness */
64 PCI_CFG_AUTO
= 0, /* autodetect */
70 enum pci_config_type
pci_set_config_type(enum pci_config_type
);
72 uint8_t pci_readb(pciaddr_t
);
73 uint16_t pci_readw(pciaddr_t
);
74 uint32_t pci_readl(pciaddr_t
);
75 void pci_writeb(uint8_t, pciaddr_t
);
76 void pci_writew(uint16_t, pciaddr_t
);
77 void pci_writel(uint32_t, pciaddr_t
);
79 extern int pci_scan(struct pci_bus_list
*pci_bus_list
, struct pci_device_list
*pci_device_list
);
80 extern struct match
* find_pci_device(struct pci_device_list
*pci_device_list
, struct match
*list
);
81 extern void get_name_from_pci_ids(struct pci_device_list
*pci_device_list
);
82 extern void get_module_name_from_pci_ids(struct pci_device_list
*pci_device_list
);
83 #endif /* _SYS_PCI_H */