X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Fefidebug.c;h=02ef019694433fdbad9bd28220fc74a6b24f34a3;hb=94c03c7c772bf7818ea84a092a90beaba1782046;hp=c4ac9dd634e2628fe19472a47fd435d0114fae7a;hpb=90c2ebd2156982eee1af6faa00f6740e9f79b3c5;p=oweals%2Fu-boot.git diff --git a/cmd/efidebug.c b/cmd/efidebug.c index c4ac9dd634..02ef019694 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -9,10 +9,10 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -244,6 +244,10 @@ static const struct { "HII Config Routing", EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, }, + { + "Load File2", + EFI_LOAD_FILE2_PROTOCOL_GUID, + }, { "Simple Network", EFI_SIMPLE_NETWORK_PROTOCOL_GUID, @@ -252,27 +256,47 @@ static const struct { "PXE Base Code", EFI_PXE_BASE_CODE_PROTOCOL_GUID, }, + /* Configuration table GUIDs */ + { + "ACPI table", + EFI_ACPI_TABLE_GUID, + }, + { + "device tree", + EFI_FDT_GUID, + }, + { + "SMBIOS table", + SMBIOS_TABLE_GUID, + }, + { + "Runtime properties", + EFI_RT_PROPERTIES_TABLE_GUID, + }, }; /** - * get_guid_text - get string of protocol guid - * @guid: Protocol guid - * Return: String + * get_guid_text - get string of GUID * - * Return string for display to represent the protocol. + * Return description of GUID. + * + * @guid: GUID + * Return: description of GUID or NULL */ -static const char *get_guid_text(const efi_guid_t *guid) +static const char *get_guid_text(const void *guid) { int i; - for (i = 0; i < ARRAY_SIZE(guid_list); i++) + for (i = 0; i < ARRAY_SIZE(guid_list); i++) { + /* + * As guidcmp uses memcmp() we can safely accept unaligned + * GUIDs. + */ if (!guidcmp(&guid_list[i].guid, guid)) - break; + return guid_list[i].text; + } - if (i != ARRAY_SIZE(guid_list)) - return guid_list[i].text; - else - return NULL; + return NULL; } /** @@ -394,6 +418,7 @@ static const struct efi_mem_attrs { /** * print_memory_attributes() - print memory map attributes + * * @attributes: Attribute value * * Print memory map attributes @@ -464,9 +489,12 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag, printf("%-16s %.*llx-%.*llx", type, EFI_PHYS_ADDR_WIDTH, - map->physical_start, + (u64)map_to_sysmem((void *)(uintptr_t) + map->physical_start), EFI_PHYS_ADDR_WIDTH, - map->physical_start + map->num_pages * EFI_PAGE_SIZE); + (u64)map_to_sysmem((void *)(uintptr_t) + (map->physical_start + + map->num_pages * EFI_PAGE_SIZE))); print_memory_attributes(map->attribute); putc('\n'); @@ -477,6 +505,34 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag, return CMD_RET_SUCCESS; } +/** + * do_efi_show_tables() - show UEFI configuration tables + * + * @cmdtp: Command table + * @flag: Command flag + * @argc: Number of arguments + * @argv: Argument array + * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure + * + * Implement efidebug "tables" sub-command. + * Show UEFI configuration tables. + */ +static int do_efi_show_tables(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + efi_uintn_t i; + const char *guid_str; + + for (i = 0; i < systab.nr_tables; ++i) { + guid_str = get_guid_text(&systab.tables[i].guid); + if (!guid_str) + guid_str = ""; + printf("%pUl %s\n", &systab.tables[i].guid, guid_str); + } + + return CMD_RET_SUCCESS; +} + /** * do_efi_boot_add() - set UEFI load option * @@ -487,9 +543,9 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag, * Return: CMD_RET_SUCCESS on success, * CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure * - * Implement efidebug "boot add" sub-command. - * Create or change UEFI load option. - * - boot add