pci设备巡检
1、内核设备检测
pci_subsys_init
pci_legacy_init
pcibios_scan_root
pci_scan_root_bus(从root bus开始扫描)
pci_create_root_bus
pci_alloc_host_bridge(分配host bridge)
pci_register_host_bridge(注册host bridge)
pci_scan_child_bus(开始扫描root bus)
pci_scan_child_bus_extend(按pci号巡检,每个bus下有32个slot,每个slot最多有8个function)
pci_scan_slot(巡检slot)
pci_scan_single_device(巡检slot下的function)
pci_scan_device
pci_setup_device
pci_hdr_type(通过pci配置空间,读取设备的类型(brige还是普通device))
pci_device_add
device_add
device_platform_notify(dev, KOBJ_ADD);(向用户态的systemd-udevd进程通知添加设备事件)
2、驱动加载
以上内核检测到pci设备后,向用户态systemd-udevd发送netlink通知消息;systemd-udevd收到消息后,再下发内核加载驱动;

浙公网安备 33010602011771号