LINUX内核PCI扫描过程
内核版本 3.10.103
1. ACPI热插拔扫描
subsys_initcall(acpi_init)@drivers/acpi/bus.c
|-acpi_scan_init@drivers/acpi/scan.c
|->acpi_pci_root_init@drivers/acpi/pci_root.c
| |->acpi_scan_add_handler(&pci_root_handler)@drivers/acpi/scan.c
| |->list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
|->acpi_pci_link_init@drivers/acpi/pci_link.c
| |->acpi_scan_add_handler(&pci_link_handler);
|->acpi_bus_scan(ACPI_ROOT_OBJECT)
|->acpi_bus_scan@drivers/acpi/scan.c
|->acpi_walk_namespace@drivers/acpi/acpica/nsxfeval.c
|->acpi_ns_walk_namespace@drivers/acpi/acpica/nswalk.c
|->acpi_bus_device_attach(即post_order_visit)
|->acpi_scan_attach_handler
|->acpi_scan_match_handler
|->handler->attach(即acpi_pci_root_add)
|->pci_acpi_scan_root@arch/x86/pci/probe.c
|->probe_pci_root_info
|->pci_scan_child_bus@drivers/pci/probe.c
|->pci_scan_slot
2. 传统扫描
subsys_initcall(pci_subsys_init)@arch/x86/pci/legacy.c
|->pci_legacy_init
|->pcibios_scan_root@arch/x86/pci/common.c
|->pci_scan_bus_on_node
|->pci_scan_root_bus
|->pci_scan_root_bus@drivers/pci/probe.c
|->pci_create_root_bus
|->pci_scan_child_bus
|->pci_scan_slot