cpu_dev_init 函数
- 1. cpu_dev_init 函数
- 1.1 subsys_system_register / subsys_register 函数
- 1.2 cpu_dev_register_generic 函数
1. cpu_dev_init 函数
初始化
cpu_subsys结构体
创建/sys/bus/cpu目录,并将其插入到链表中
创建/sys/bus/cpu/devices目录
创建/sys/bus/cpu/drivers目录
创建/sys/bus/cpu/drivers_autoprobe属性文件
创建/sys/bus/cpu/drivers_probe属性文件
创建/sys/bus/cpu/uevent属性文件初始化
cpu_subsys->dev_root 结构体
创建/sys/devices/system/cpu目录,并将cpu_subsys->dev_root插入到system_kset->kobj.entry链表中
创建/sys/devices/system/cpu/uevent属性文件
创建/sys/devices/system/cpu/online属性文件
创建/sys/devices/system/cpu/offline属性文件创建
/sys/devices/system/cpu/cpu0目录及相关属性文件cpu_dev_init 函数
1.1 subsys_system_register / subsys_register 函数
- 通过 bus_register 函数,完成下列任务
- 初始化
cpu_subsys结构体- 创建
/sys/bus/cpu目录,并将其插入到链表中
创建/sys/bus/cpu/devices目录
创建/sys/bus/cpu/drivers目录- 创建
/sys/bus/platform/drivers_autoprobe属性文件
创建/sys/bus/platform/drivers_probe属性文件
创建/sys/bus/platform/uevent属性文件
- 通过 device_register 函数,完成下列任务
- 初始化
cpu_subsys->dev_root 结构体- 创建
/sys/devices/system/cpu目录,并将cpu_subsys->dev_root插入到system_kset->kobj.entry链表中- 创建
/sys/devices/system/cpu/uevent属性文件
创建/sys/devices/system/cpu/online属性文件
创建/sys/devices/system/cpu/offline属性文件
1.2 cpu_dev_register_generic 函数
- 遍历所有可能的 CP
- 注册每个 CPU 设备(系统中每个可能的 CPU 都被注册为一个设备,出现在 /sys/devices/system/cpu/cpu0/、/sys/devices/system/cpu/cpu1/ 等目录下)