summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-04-02 12:30:02 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-04-10 13:00:24 +0300
commitd473063d9de7041dcafd2fbedf8f33eb3eff51f5 (patch)
tree4f0787ceacd218b1b9edda2e8772f0c963d0d94b /cmd
parent59ffe0e3392ed3346a67fbac59d938bfb569c143 (diff)
downloadu-boot-d473063d9de7041dcafd2fbedf8f33eb3eff51f5.tar.xz
efi_loader: simplify efi_get_device_path_text()
Replace static function efi_get_device_handle_info() by a simplified function efi_get_device_path_text() avoiding EFI_CALL(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/efidebug.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 6e36575a94..0bf7b8856c 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);
}