acpi_is_root_bridge 用于判断一个形参的acpi_handle 是否是root bridge
其源码分析如下:
int acpi_is_root_bridge(acpi_handle handle)
{
int ret;
struct acpi_device *device;
#通过handle得到这个device
ret = acpi_bus_get_device(handle, &device);
if (ret)
return 0;
#查看这个device是否在root_device_ids 数组中,从这里知道系统中所有的root bridge 都是保存在root_device_ids 这个数组中
ret = acpi_match_device_ids(device, root_device_ids);
if (ret)
return 0;
else
return 1;
}
static const struct acpi_device_id root_device_ids[] = {
{"PNP0A03", 0},
{"", 0},
};
可见acpi_match_device_ids 会比较acpi_device_id 中的id这个字符串时发现相等
struct acpi_device_id {
__u8 id[ACPI_ID_LEN];
kernel_ulong_t driver_data;
__u32 cls;
__u32 cls_msk;
};
内核ACPI函数API之acpi_is_root_bridge
最新推荐文章于 2022-11-06 14:40:26 发布