X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fpci.h;h=9a7e4da99181a8c0d174b515473a5765d9dedc87;hb=7a3b97675d95d666979d0b5fa0cae966f11ee188;hp=58fe4ea3cb22f43e58458f7c9bfb2b624d1c4fcd;hpb=c2edf1dc3e9a634fb7c68519d6cb6534a129e5b1;p=pintos-anon diff --git a/src/devices/pci.h b/src/devices/pci.h index 58fe4ea..9a7e4da 100755 --- a/src/devices/pci.h +++ b/src/devices/pci.h @@ -1 +1,35 @@ -void pci_scan (void); +#include "lib/kernel/list.h" + +struct pci_dev { + struct list_elem elem; + + /* logically identify a unique PCI device */ + uint8_t bus_id; + uint8_t devfn; + + /* Vendor and Device ID */ + uint16_t ven_id; + uint16_t dev_id; + + /* Class code */ + uint8_t base_class; + uint8_t sub_class; + uint8_t interface; +}; + +#define PCI_BAD_DEVICE 0xffff + +/* PCI-to-PCI bridge related numbers */ +#define PCI_BRIDGE_BASE_CLASS 0x06 +#define PCI_BRIDGE_SUB_CLASS 0x04 +#define PCI_BRIDGE_REG_SBUS 0x19 +#define PCI_BRIDGE_HEADER_TYPE 0x01 + +/* Locations of registers in the typical configuration space */ +#define PCI_REG_CLASS_INTERFACE 0x09 +#define PCI_REG_CLASS_SUB 0x0a +#define PCI_REG_CLASS_BASE 0x0b +#define PCI_REG_HEADER_TYPE 0x0e + +void pci_init (void); +void pci_dump (void);