static void pci_bus_scan (struct pci_info * pci) { uint8_t hdr_type; hdr_type = pci_get_hdr_type(0, 0, 0); if ((hdr_type & 0x80) == 0) { /* only one PCI host controller */ pci_bus_probe(pci, 0); } else { ERROR_PRINT("Host with multiple PCI host controllers not supported\n"); } }
static int pci_bus_probe_wrapper(struct device *dev) { int r; struct pci_dev *pci_dev = to_pci_dev(dev); struct physdev_manage_pci manage_pci; manage_pci.bus = pci_dev->bus->number; manage_pci.devfn = pci_dev->devfn; r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add, &manage_pci); if (r && r != -ENOSYS) return r; r = pci_bus_probe(dev); return r; }
static void pci_fun_probe (struct pci_info * pci, uint8_t bus, uint8_t dev, uint8_t fun) { uint8_t base_class; uint8_t sub_class; uint8_t sec_bus; base_class = pci_get_base_class(bus, dev, fun); sub_class = pci_get_sub_class(bus, dev, fun); if (base_class == PCI_CLASS_BRIDGE && sub_class == PCI_SUBCLASS_BRIDGE_PCI) { sec_bus = pci_get_sec_bus(bus, dev, fun); pci_bus_probe(pci, sec_bus); } }