[U-Boot] [PATCH v3 6/8] cmd: efishell: add dh command
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Dec 20 07:49:25 UTC 2018
On 12/18/18 6:05 AM, AKASHI Takahiro wrote:
> "dh" command prints all the uefi handles used in the system.
> => efishell dh
> (T.B.D.)
> 0: (protocol info not available)
> 1: (protocol info not available)
> 2: (protocol info not available)
> 3: (protocol info not available)
> 4: (protocol info not available)
> 5: (protocol info not available)
> 6: (protocol info not available)
> 7: (protocol info not available)
> 8: (protocol info not available)
> 9: (protocol info not available)
> 10: (protocol info not available)
> 11: (protocol info not available)
> 12: (protocol info not available)
> 13: (protocol info not available)
> 14: (protocol info not available)
> 15: (protocol info not available)
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
> cmd/efishell.c | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/efishell.c b/cmd/efishell.c
> index 5a81a627d616..47ad77606062 100644
> --- a/cmd/efishell.c
> +++ b/cmd/efishell.c
> @@ -511,6 +511,33 @@ static int do_efi_show_memmap(int argc, char * const argv[])
> return CMD_RET_SUCCESS;
> }
>
> +static char *efi_get_proto_info(efi_handle_t handle)
> +{
> + return strdup("(protocol info not available)");
Shouldn't this enumerate all protocol GUIDs installed on the handles by
calling ProtocolsPerHandle()?
Also instances of installed drivers identifiable by the driver binding
protocol might be interesting.
Best regards
Heinrich
> +}
> +
> +static int do_efi_show_handles(int argc, char * const argv[])
> +{
> + efi_handle_t *handles = NULL, *handle;
> + char *info;
> + int i;
> +
> + handles = efi_get_handles_by_proto(NULL);
> + if (!handles)
> + return CMD_RET_SUCCESS;
> +
> + for (handle = handles, i = 0; *handle; handle++, i++) {
> + /* TODO: depends on protocols */
> + info = efi_get_proto_info(*handle);
> + printf("%d: %s\n", i, info ?: "");
> + free(info);
> + }
> +
> + free(handles);
> +
> + return CMD_RET_SUCCESS;
> +}
> +
> static int do_efi_boot_add(int argc, char * const argv[])
> {
> int id;
> @@ -900,6 +927,8 @@ static int do_efishell(cmd_tbl_t *cmdtp, int flag,
> return do_efi_show_images(argc, argv);
> else if (!strcmp(command, "memmap"))
> return do_efi_show_memmap(argc, argv);
> + else if (!strcmp(command, "dh"))
> + return do_efi_show_handles(argc, argv);
> else
> return CMD_RET_USAGE;
> }
> @@ -929,7 +958,9 @@ static char efishell_help_text[] =
> "efishell images\n"
> " - show loaded images\n"
> "efishell memmap\n"
> - " - show uefi memory map\n";
> + " - show uefi memory map\n"
> + "efishell dh\n"
> + " - show uefi handles\n";
> #endif
>
> U_BOOT_CMD(
>
More information about the U-Boot
mailing list