aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-01-22 15:43:36 -0500
committerTom Rini <trini@konsulko.com>2022-01-22 15:43:36 -0500
commitda158ec5f2db86d88a631c05c540ba5ee1937a77 (patch)
tree2aec2712bc2db6417fc9e5660b8a5c2e7b04ecee /cmd
parente6786b0354372c8a68d01e4d633a19cdce373b70 (diff)
parentf5e9035043fb48baea93ccb3165e75f486906213 (diff)
downloadu-boot-da158ec5f2db86d88a631c05c540ba5ee1937a77.zip
u-boot-da158ec5f2db86d88a631c05c540ba5ee1937a77.tar.gz
u-boot-da158ec5f2db86d88a631c05c540ba5ee1937a77.tar.bz2
Merge tag 'efi-2022-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efiWIP/22Jan2022
Pull request for efi-2022-04-rc1-2 Documentation: * describe printf() format codes UEFI * enable more algorithms for UEFI image verification, e.g. SHA256-RSA2048 General * simplify printing short texts for GUIDs * provide a unit test for printing GUIDs
Diffstat (limited to 'cmd')
-rw-r--r--cmd/efidebug.c160
-rw-r--r--cmd/nvedit_efi.c39
2 files changed, 6 insertions, 193 deletions
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index a977ca9..66ce0fc 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -502,149 +502,6 @@ static int do_efi_show_drivers(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_SUCCESS;
}
-static const struct {
- const char *text;
- const efi_guid_t guid;
-} guid_list[] = {
- {
- "Device Path",
- EFI_DEVICE_PATH_PROTOCOL_GUID,
- },
- {
- "Device Path To Text",
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID,
- },
- {
- "Device Path Utilities",
- EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID,
- },
- {
- "Unicode Collation 2",
- EFI_UNICODE_COLLATION_PROTOCOL2_GUID,
- },
- {
- "Driver Binding",
- EFI_DRIVER_BINDING_PROTOCOL_GUID,
- },
- {
- "Simple Text Input",
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID,
- },
- {
- "Simple Text Input Ex",
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID,
- },
- {
- "Simple Text Output",
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID,
- },
- {
- "Block IO",
- EFI_BLOCK_IO_PROTOCOL_GUID,
- },
- {
- "Simple File System",
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID,
- },
- {
- "Loaded Image",
- EFI_LOADED_IMAGE_PROTOCOL_GUID,
- },
- {
- "Graphics Output",
- EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID,
- },
- {
- "HII String",
- EFI_HII_STRING_PROTOCOL_GUID,
- },
- {
- "HII Database",
- EFI_HII_DATABASE_PROTOCOL_GUID,
- },
- {
- "HII Config Routing",
- EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID,
- },
- {
- "Load File2",
- EFI_LOAD_FILE2_PROTOCOL_GUID,
- },
- {
- "Random Number Generator",
- EFI_RNG_PROTOCOL_GUID,
- },
- {
- "Simple Network",
- EFI_SIMPLE_NETWORK_PROTOCOL_GUID,
- },
- {
- "PXE Base Code",
- EFI_PXE_BASE_CODE_PROTOCOL_GUID,
- },
- {
- "Device-Tree Fixup",
- EFI_DT_FIXUP_PROTOCOL_GUID,
- },
- {
- "System Partition",
- PARTITION_SYSTEM_GUID
- },
- {
- "Firmware Management",
- EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID
- },
- /* Configuration table GUIDs */
- {
- "ACPI table",
- EFI_ACPI_TABLE_GUID,
- },
- {
- "EFI System Resource Table",
- EFI_SYSTEM_RESOURCE_TABLE_GUID,
- },
- {
- "device tree",
- EFI_FDT_GUID,
- },
- {
- "SMBIOS table",
- SMBIOS_TABLE_GUID,
- },
- {
- "Runtime properties",
- EFI_RT_PROPERTIES_TABLE_GUID,
- },
- {
- "TCG2 Final Events Table",
- EFI_TCG2_FINAL_EVENTS_TABLE_GUID,
- },
-};
-
-/**
- * get_guid_text - get string of GUID
- *
- * Return description of GUID.
- *
- * @guid: GUID
- * Return: description of GUID or NULL
- */
-static const char *get_guid_text(const void *guid)
-{
- int 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))
- return guid_list[i].text;
- }
-
- return NULL;
-}
-
/**
* do_efi_show_handles() - show UEFI handles
*
@@ -664,7 +521,6 @@ static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
efi_handle_t *handles;
efi_guid_t **guid;
efi_uintn_t num, count, i, j;
- const char *guid_text;
efi_status_t ret;
ret = EFI_CALL(efi_locate_handle_buffer(ALL_HANDLES, NULL, NULL,
@@ -692,11 +548,7 @@ static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
else
putc(' ');
- guid_text = get_guid_text(guid[j]);
- if (guid_text)
- puts(guid_text);
- else
- printf("%pUl", guid[j]);
+ printf("%pUs", guid[j]);
}
putc('\n');
}
@@ -873,14 +725,10 @@ static int do_efi_show_tables(struct cmd_tbl *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);
- }
+ for (i = 0; i < systab.nr_tables; ++i)
+ printf("%pUl (%pUs)\n",
+ &systab.tables[i].guid, &systab.tables[i].guid);
return CMD_RET_SUCCESS;
}
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 710d923..7ebb14e 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -39,40 +39,6 @@ static const struct {
{EFI_VARIABLE_READ_ONLY, "RO"},
};
-static const struct {
- efi_guid_t guid;
- char *text;
-} efi_guid_text[] = {
- /* signature database */
- {EFI_GLOBAL_VARIABLE_GUID, "EFI_GLOBAL_VARIABLE_GUID"},
- {EFI_IMAGE_SECURITY_DATABASE_GUID, "EFI_IMAGE_SECURITY_DATABASE_GUID"},
- /* certificate type */
- {EFI_CERT_SHA256_GUID, "EFI_CERT_SHA256_GUID"},
- {EFI_CERT_X509_GUID, "EFI_CERT_X509_GUID"},
- {EFI_CERT_TYPE_PKCS7_GUID, "EFI_CERT_TYPE_PKCS7_GUID"},
-};
-
-static const char unknown_guid[] = "";
-
-/**
- * efi_guid_to_str() - convert guid to readable name
- *
- * @guid: GUID
- * Return: string for GUID
- *
- * convert guid to readable name
- */
-static const char *efi_guid_to_str(const efi_guid_t *guid)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(efi_guid_text); i++)
- if (!guidcmp(guid, &efi_guid_text[i].guid))
- return efi_guid_text[i].text;
-
- return unknown_guid;
-}
-
/**
* efi_dump_single_var() - show information about a UEFI variable
*
@@ -111,7 +77,7 @@ static void efi_dump_single_var(u16 *name, const efi_guid_t *guid, bool verbose)
goto out;
rtc_to_tm(time, &tm);
- printf("%ls:\n %pUl %s\n", name, guid, efi_guid_to_str(guid));
+ printf("%ls:\n %pUl (%pUs)\n", name, guid, guid);
if (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
printf(" %04d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year,
tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
@@ -497,8 +463,7 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (verbose) {
- printf("GUID: %pUl %s\n", &guid,
- efi_guid_to_str((const efi_guid_t *)&guid));
+ printf("GUID: %pUl (%pUs)\n", &guid, &guid);
printf("Attributes: 0x%x\n", attributes);
}