国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

kernel中efi變量初始化

2019-11-09 16:03:46
字體:
來源:轉載
供稿:網友
在setup_arch->efi_init->uefi_init->efi_config_parse_tablesint __init efi_config_parse_tables(void *config_tables, int count, int sz,                   efi_config_table_type_t *arch_tables){    void *tablep;    int i;    tablep = config_tables;    PR_info("");    for (i = 0; i < count; i++) {        efi_guid_t guid;        unsigned long table;        if (efi_enabled(EFI_64BIT)) {            u64 table64;            guid = ((efi_config_table_64_t *)tablep)->guid;            table64 = ((efi_config_table_64_t *)tablep)->table;            table = table64;#ifndef CONFIG_64BIT            if (table64 >> 32) {                pr_cont("/n");                pr_err("Table located above 4GB, disabling EFI./n");                return -EINVAL;            }#endif        } else {            guid = ((efi_config_table_32_t *)tablep)->guid;            table = ((efi_config_table_32_t *)tablep)->table;        }        if (!match_config_table(&guid, table, common_tables))            match_config_table(&guid, table, arch_tables);        tablep += sz;    }    pr_cont("/n");    set_bit(EFI_CONFIG_TABLES, &efi.flags);    /* Parse the EFI Properties table if it exists */    if (efi.properties_table != EFI_INVALID_TABLE_ADDR) {        efi_properties_table_t *tbl;        tbl = early_memremap(efi.properties_table, sizeof(*tbl));        if (tbl == NULL) {            pr_err("Could not map Properties table!/n");            return -ENOMEM;        }        if (tbl->memory_protection_attribute &            EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA)            set_bit(EFI_NX_PE_DATA, &efi.flags);        early_memunmap(tbl, sizeof(*tbl));    }    return 0;}在efi_config_parse_tables 中會對common_tables 中的ptr賦值,這樣我們就能在kernel中使用common_tables 中的指針static __initdata efi_config_table_type_t common_tables[] = {    {ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},    {ACPI_TABLE_GUID, "ACPI", &efi.acpi},    {HCDP_TABLE_GUID, "HCDP", &efi.hcdp},    {MPS_TABLE_GUID, "MPS", &efi.mps},    {SAL_SYSTEM_TABLE_GUID, "SALsystab", &efi.sal_systab},    {SMBIOS_TABLE_GUID, "SMBIOS", &efi.smbios},    {SMBIOS3_TABLE_GUID, "SMBIOS 3.0", &efi.smbios3},    {UGA_IO_PROTOCOL_GUID, "UGA", &efi.uga},    {EFI_SYSTEM_RESOURCE_TABLE_GUID, "ESRT", &efi.esrt},    {EFI_PROPERTIES_TABLE_GUID, "PROP", &efi.properties_table},    {EFI_MEMORY_ATTRIBUTES_TABLE_GUID, "MEMATTR", &efi.mem_attr_table},    {NULL_GUID, NULL, NULL},};具體是在在efi_config_parse_tables中的下面code中賦值.if (!match_config_table(&guid, table, common_tables))            match_config_table(&guid, table, arch_tables);同時會設定EFI_CONFIG_TABLES 這個flag。set_bit(EFI_CONFIG_TABLES, &efi.flags);如果uefi中有Properties table 的話,會設定set_bit(EFI_NX_PE_DATA, &efi.flags);最后補充一下,在match_config_table 中是根據guid 來找對應的table的.static __init int match_config_table(efi_guid_t *guid,                     unsigned long table,                     efi_config_table_type_t *table_types){    int i;    if (table_types) {        for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) {            if (!efi_guidcmp(*guid, table_types[i].guid)) {                *(table_types[i].ptr) = table;                if (table_types[i].name)                    pr_cont(" %s=0x%lx ",                        table_types[i].name, table);                return 1;            }        }    }    return 0;}
上一篇:微信小程序

下一篇:ReactiveCocoa簡單介紹

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 铁力市| 易门县| 喀喇| 扬中市| 昌平区| 甘泉县| 视频| 琼海市| 南昌市| 丘北县| 铜山县| 天全县| 荃湾区| 绥中县| 韶关市| 怀仁县| 华阴市| 阿瓦提县| 塘沽区| 聂拉木县| 叙永县| 闽清县| 巴彦县| 华坪县| 正宁县| 宁海县| 老河口市| 磐安县| 宁陵县| 屏东县| 萨嘎县| 柏乡县| 玉山县| 阳山县| 简阳市| 乐山市| 维西| 资溪县| 无棣县| 宜兴市| 明光市|