-PCI scanning
[pintos-anon] / src / devices / pci.h
1 #include "lib/kernel/list.h"
2
3 struct pci_dev {
4   struct list_elem elem;
5
6   /* <Bus, Device, Function> logically identify a unique PCI device */
7   uint8_t bus_id;
8   uint8_t devfn;
9
10   /* Vendor and Device ID */
11   uint16_t ven_id;
12   uint16_t dev_id;
13
14   /* Class code */
15   uint8_t base_class;
16   uint8_t sub_class;
17   uint8_t interface;
18 };
19
20 #define PCI_BAD_DEVICE 0xffff
21
22 /* PCI-to-PCI bridge related numbers */
23 #define PCI_BRIDGE_BASE_CLASS 0x06
24 #define PCI_BRIDGE_SUB_CLASS 0x04
25 #define PCI_BRIDGE_REG_SBUS 0x19
26 #define PCI_BRIDGE_HEADER_TYPE 0x01
27
28 /* Locations of registers in the typical configuration space */
29 #define PCI_REG_CLASS_INTERFACE 0x09
30 #define PCI_REG_CLASS_SUB 0x0a
31 #define PCI_REG_CLASS_BASE 0x0b
32 #define PCI_REG_HEADER_TYPE 0x0e
33
34 void pci_init (void);
35 void pci_dump (void);