summaryrefslogtreecommitdiff
path: root/cmd/efidebug.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-10 16:56:59 -0400
committerTom Rini <trini@konsulko.com>2021-04-10 16:56:59 -0400
commit59e84da0b88e4465f15d196bba59f22c906fa50d (patch)
treeba62f7bab206bd44dfd516c5689b7d87ab2b064f /cmd/efidebug.c
parent3f2e3c7845df11ca8359a6cc804bfd6eb5ce215b (diff)
parentf8cd72d1ac6aac8cfa48777b5c0681ee2f9e3671 (diff)
Merge tag 'efi-2021-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2021-07-rc1 Bug fixes: * support EFI, HOST, VIRTIO in fsinfo command * simplify efi_get_device_path_text() * add missing EFI_UNACCEPTED_MEMORY_TYPE * mkeficapsule: improve online help * avoid several build warnings Documentation: * UEFI documentation for initrd loading options * describe building OP-TEE with for UEFI variables * mmc man-page
Diffstat (limited to 'cmd/efidebug.c')
-rw-r--r--cmd/efidebug.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 6e36575a94e..0bf7b8856ca 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -341,27 +341,27 @@ static int do_efi_capsule(struct cmd_tbl *cmdtp, int flag,
#endif /* CONFIG_EFI_HAVE_CAPSULE_SUPPORT */
/**
- * efi_get_device_handle_info() - get information of UEFI device
+ * efi_get_device_path_text() - get device path text
*
- * @handle: Handle of UEFI device
- * @dev_path_text: Pointer to text of device path
- * Return: 0 on success, -1 on failure
+ * Return the text representation of the device path of a handle.
*
- * Currently return a formatted text of device path.
+ * @handle: handle of UEFI device
+ * Return:
+ * Pointer to the device path text or NULL.
+ * The caller is responsible for calling FreePool().
*/
-static int efi_get_device_handle_info(efi_handle_t handle, u16 **dev_path_text)
+static u16 *efi_get_device_path_text(efi_handle_t handle)
{
- struct efi_device_path *dp;
+ struct efi_handler *handler;
efi_status_t ret;
- ret = EFI_CALL(BS->open_protocol(handle, &efi_guid_device_path,
- (void **)&dp, NULL /* FIXME */, NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL));
- if (ret == EFI_SUCCESS) {
- *dev_path_text = efi_dp_str(dp);
- return 0;
+ ret = efi_search_protocol(handle, &efi_guid_device_path, &handler);
+ if (ret == EFI_SUCCESS && handler->protocol_interface) {
+ struct efi_device_path *dp = handler->protocol_interface;
+
+ return efi_dp_str(dp);
} else {
- return -1;
+ return NULL;
}
}
@@ -401,7 +401,8 @@ static int do_efi_show_devices(struct cmd_tbl *cmdtp, int flag,
printf("Device%.*s Device Path\n", EFI_HANDLE_WIDTH - 6, spc);
printf("%.*s ====================\n", EFI_HANDLE_WIDTH, sep);
for (i = 0; i < num; i++) {
- if (!efi_get_device_handle_info(handles[i], &dev_path_text)) {
+ dev_path_text = efi_get_device_path_text(handles[i]);
+ if (dev_path_text) {
printf("%p %ls\n", handles[i], dev_path_text);
efi_free_pool(dev_path_text);
}