==========
static void pci_bios_init_device(struct pci_device *pci)
{
u16 bdf = pci->bdf;
int pin, pic_irq;
dprintf(1, "PCI: bus=%d devfn=0x%02x: vendor_id=0x%04x device_id=0x%04x\n"
, pci_bdf_to_bus(bdf), pci_bdf_to_devfn(bdf)
, pci->vendor, pci->device);
pci_init_device(pci_class_tbl, pci, NULL);
/* enable memory mappings */
pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
/* map the interrupt */
pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
if (pin != 0) {
pin = pci_slot_get_pirq(bdf, pin - 1);
pic_irq = pci_irqs[pin];
pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pic_irq);
}
pci_init_device(pci_device_tbl, pci, NULL);
}
static void pci_bios_init_device_in_bus(int bus)
{
struct pci_device *pci;
foreachpci(pci) {
u8 pci_bus = pci_bdf_to_bus(pci->bdf);
if (pci_bus < bus)
continue;
if (pci_bus > bus)
break;
pci_bios_init_device(pci);
}
}
...
void
pci_setup(void)
{
...
pci_bios_map_device_in_bus(0 /* host bus */);
pci_bios_init_device_in_bus(0 /* host bus */);
...
}
==========
The PCI_INTERRUPT_LINE register is set in the function
pci_setup() calls pci_bios_init_device_in_bus() calls pci_bios_init_device().
According to the code, it only inits the PCI device on bus 0.
I modify the code like this, and the PCI_INTERRUPT_LINE register is set, and I can bind
it to uio_pci_generic:
@@ -575,6 +575,8 @@ static int pci_bios_init_root_regions(u32 start, u32 end)
void
pci_setup(void)
{
+ int bus;
+
if (CONFIG_COREBOOT || usingXen()) {
// PCI setup already done by coreboot or Xen - just do probe.
pci_probe();
@@ -603,9 +605,11 @@ pci_setup(void)
dprintf(1, "=== PCI new allocation pass #2 ===\n");
dprintf(1, "PCI: init bases bus 0 (primary)\n");
pci_bios_init_bus_bases(&busses[0]);
- pci_bios_map_device_in_bus(0 /* host bus */);
+ for (bus = 0; bus <= MaxPCIBus; bus++) {
+ pci_bios_map_device_in_bus(bus /* host bus */);
- pci_bios_init_device_in_bus(0 /* host bus */);
+ pci_bios_init_device_in_bus(bus /* host bus */);
+ }
struct pci_device *pci;
foreachpci(pci) {