-
Asias He authored
In GCE, the pci bus looks like: $ lspci -x 00:01.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 03) 00: 86 80 10 71 03 01 00 00 03 00 01 06 00 00 80 00 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00: 86 80 13 71 03 01 00 00 03 00 80 06 00 00 00 00 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 09 01 00 00 00:03.0 SCSI storage controller: Red Hat, Inc Virtio SCSI 00: f4 1a 04 10 03 01 00 00 00 00 00 01 00 00 00 00 10: 01 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 08 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00 00:04.0 Ethernet controller: Red Hat, Inc Virtio network device 00: f4 1a 00 10 03 01 00 00 00 00 00 02 00 00 00 00 10: 41 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 01 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00 This makes the code goes to !single_bus branch. However, device 00:00:0 is not present. So, No device is scanned! Obviously, this is not what we want. To fix, the following is almost correct except bus 0 might not be there. void pci_device_enumeration(void) { check_bus(0); } To address it, we scan starting from bus 0 and exit the scan when the first non-empty bus is found. The first non-empty bus should find the entire hierarchy. Signed-off-by:
Asias He <asias@cloudius-systems.com>
Asias He authoredIn GCE, the pci bus looks like: $ lspci -x 00:01.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 03) 00: 86 80 10 71 03 01 00 00 03 00 01 06 00 00 80 00 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00: 86 80 13 71 03 01 00 00 03 00 80 06 00 00 00 00 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 09 01 00 00 00:03.0 SCSI storage controller: Red Hat, Inc Virtio SCSI 00: f4 1a 04 10 03 01 00 00 00 00 00 01 00 00 00 00 10: 01 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 08 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00 00:04.0 Ethernet controller: Red Hat, Inc Virtio network device 00: f4 1a 00 10 03 01 00 00 00 00 00 02 00 00 00 00 10: 41 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 01 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00 This makes the code goes to !single_bus branch. However, device 00:00:0 is not present. So, No device is scanned! Obviously, this is not what we want. To fix, the following is almost correct except bus 0 might not be there. void pci_device_enumeration(void) { check_bus(0); } To address it, we scan starting from bus 0 and exit the scan when the first non-empty bus is found. The first non-empty bus should find the entire hierarchy. Signed-off-by:
Asias He <asias@cloudius-systems.com>