Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 878D4C678D4 for ; Mon, 6 Mar 2023 09:39:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A2A19855F5; Mon, 6 Mar 2023 10:39:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=gmx.de header.i=xypron.glpk@gmx.de header.b="MNoVcn+c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E66485650; Mon, 6 Mar 2023 10:39:19 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F2BDD83CB1 for ; Mon, 6 Mar 2023 10:39:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1678095552; i=xypron.glpk@gmx.de; bh=czyAr3ElSdScB5uhlaXPkh6T3/M9zG353SPdNF/t2gQ=; h=X-UI-Sender-Class:Date:Subject:To:References:From:Cc:In-Reply-To; b=MNoVcn+cywo6e8lKuGxadbYcSZFKcdfzYDfPVVrD3C6bRhAL9zT76SBRVwXcbtxHk NYdPFLqWl7C9XP+qsVpqglFv/X6qGTGeYx8XKKKbuYTitm6oVUMHkUWTG/L7sRUMV6 liSRA0mJwtlv52C8Mr7TqimkaaAv6XajQFKFB9wYgmYXxXxzpK9NVK3nR81URXRAZh CA1ptfuUUc1DZg7lRJfSseezxbHknkSVxpkA6BGz0qquzUwEY1FKJZjPsgAmFY1vh2 RqlBYr3jrteS3iULe9Nzw2AQE4CkRUZCaHp2m/TFuxH8N8XGra8QP3XEaeg0ELaIgH UP10tAXSINfdg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.67] ([88.152.145.137]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxDkw-1qWR3X3yzw-00xdcU; Mon, 06 Mar 2023 10:39:12 +0100 Message-ID: Date: Mon, 6 Mar 2023 10:39:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 09/10] efi: Support showing tables Content-Language: en-US To: Simon Glass References: <20230226013305.2251638-1-sjg@chromium.org> <20230226013305.2251638-10-sjg@chromium.org> From: Heinrich Schuchardt Cc: U-Boot Mailing List In-Reply-To: <20230226013305.2251638-10-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:U50MHhj3D+/2TWDuFvchsSL+vwW9LyCUQDhy85OmNt31oS6EVHE q8Sb3uT3iQLoBd8ZbPY4LXkZ2O+QdKNWQKPw7EVw40Y4ZsLQXSd06hY9PldeHw5pt2hb4/u pfa+JVqB4cFi7BCEQKoC8Vtb5arlQf99ujqwEsJjlEgP5J6zEXNqwhOFsoCewTXUnQ/E1P1 SBM02nwrQTduEQSNpxIBg== UI-OutboundReport: notjunk:1;M01:P0:ta3xFHTM7g0=;fSSjRdOFZJsvFlUpJN1t0Iq/Om9 /zYnkA+/oVmOzhUeDGdr+XzwN5OAv5/xxKhKTxzzBdO+EIWreyCDAk+guv8JaXdvgQ28agtHx aAIgIy4wj2UEaHfuDIsJyH3sz0fJPCKOsetqKIyvB5zudkgIG+LQWXI0oO6quT59wo+cx/xYD O5AJzugQzVvr7yIqxo8q+qpiCKJKbNqhZS/dnbzH9RMLukJADw+YWVWgWdQyimT6drGj7zSWD 2I5Gk/7w0FR2X3Dsskt/U5bddrKWUfoLN8LvAq3oI7nu3s3lKhUt+MNBSYfRWgPijpsdlX1DR 2567CbzLT5vrEWxOVof+gM0JRP5yut7QpgcxwvAFTLVximwE8RvJa3kAdzBnbcDxnjIl+n6IX 1gBjnlOzp8sTYX+Oe8QBdLRYiUpsGCVQqG4O6OrgaL2Iou8Vc7jXXoZyzCPy5XbSwcR7OSnI8 1+YhRFfhab1tPLWuv/PBOJcv/L4+k31H/8XN4BgPnLnoRtedmz1ys+VYUJPNyOF+Ja7jWk3Ee d3tvV8JKCcuvdsec2N9uEMJh0tStfdgFvsAB0ny/kOk7b5NP2lXjtm6Mas4ZakIH4gDXrdW8G btKoZzOrCR9Z3eImN9gYl+A57+eMCMJEqOVbk3SB4LDGUDL5DUPk6IYHw+8eh+8/J2v8BLRh7 N0Y/AelwFsAShQRzZWmB+jePiHKbHDH2hv1YgcWEtMXkr7DmgxkOTLHxFQzGvj/78waI4WHdJ e1mnWsAqtSU3quBNiu6G+mOB6TOXKRRBqv1X3eyQkx5WLbT7aNgsgtsNe1CFuEtIfXk7VzsCL OrhNVj8vKG9Ru3LyGOUvcJxrfUpQH/LbBjDy0Uwq9ajmEAJeewP4ky/TvHzYFZN7JNQ6O2ktE 635GU5fzpSdw/q7R2n0+4XNiMHCnLJwnZt+5pbQ/2kAkkf1PAk4CfXlWpCQO6HNZsnsv3zXZE aTbduCgF5qC8jZLw3qSFA8Y27VI= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 2/26/23 02:33, Simon Glass wrote: > Add a command to display the tables provided by EFI. > > Signed-off-by: Simon Glass > --- > > cmd/efi.c | 40 +++++++++++++++++++++++++++++++++++++++- > doc/usage/cmd/efi.rst | 22 ++++++++++++++++++++++ > 2 files changed, 61 insertions(+), 1 deletion(-) > > diff --git a/cmd/efi.c b/cmd/efi.c > index c0384e0db28..86988d9e9e2 100644 > --- a/cmd/efi.c > +++ b/cmd/efi.c > @@ -7,10 +7,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#include > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -273,8 +275,43 @@ done: > return ret ? CMD_RET_FAILURE : 0; > } > > +static int do_efi_tables(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) We already have function do_efi_show_tables() to print the list of EFI configuration tables. Please, avoid code duplication. > +{ > + struct efi_system_table *systab; > + int i; > + > + if (IS_ENABLED(CONFIG_EFI_APP)) { > + systab =3D efi_get_sys_table(); > + if (!systab) { > + printf("Cannot read system table\n"); > + return CMD_RET_FAILURE; > + } > + } else { > + int size; > + int ret; > + > + ret =3D efi_info_get(EFIET_SYS_TABLE, (void **)&systab, &size); > + if (ret) { > + printf("Cannot find EFI system table (err=3D%d)\n", ret); > + return CMD_RET_FAILURE; > + } > + } > + for (i =3D 0; i < systab->nr_tables; i++) { > + struct efi_configuration_table *tab =3D &systab->tables[i]; > + char guid_str[37]; > + > + uuid_bin_to_str(tab->guid.b, guid_str, 1); > + printf("%p %s %s\n", tab->table, guid_str, > + uuid_guid_get_str(tab->guid.b)); do_efi_show_tables() does this with printf("%pUl (%pUs)\n",..). > + } > + > + return 0; > +} > + > static struct cmd_tbl efi_commands[] =3D { > U_BOOT_CMD_MKENT(mem, 1, 1, do_efi_mem, "", ""), > + U_BOOT_CMD_MKENT(tables, 1, 1, do_efi_tables, "", ""), > }; > > static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *con= st argv[]) > @@ -298,5 +335,6 @@ static int do_efi(struct cmd_tbl *cmdtp, int flag, i= nt argc, char *const argv[]) > U_BOOT_CMD( > efi, 3, 1, do_efi, > "EFI access", > - "mem [all] Dump memory information [include boot services]" > + "mem [all] Dump memory information [include boot services]\n" > + "tables Dump tables" > ); > diff --git a/doc/usage/cmd/efi.rst b/doc/usage/cmd/efi.rst > index c029c423879..2424d3bb587 100644 > --- a/doc/usage/cmd/efi.rst > +++ b/doc/usage/cmd/efi.rst > @@ -10,6 +10,7 @@ Synopsis > :: > > efi mem [all] > + efi tables > > Description > ----------- > @@ -54,6 +55,14 @@ Attributes > Shows a code for memory attributes. The key for this is shown belo= w the > table. > > +efi tables > +~~~~~~~~~~ > + > +This shows a list of the EFI tables provided in the system table. These= use > +GUIDs so it is not possible in general to show the name of a table. But= some > +effort is made to provide a useful table, where the GUID is known by U-= Boot. > + > + > Example > ------- > > @@ -195,3 +204,16 @@ Example > f: uncached, write-coalescing, write-through, write-back > rf: uncached, write-coalescing, write-through, write-back, needs r= untime mapping > 1: uncached > + > + > + =3D> efi tables > + 000000001f8eda98 ee4e5898-3914-4259-9d6e-dc7bd79403cf EFI_LZMA_CO= MPRESSED > + 000000001ff2ace0 05ad34ba-6f02-4214-952e-4da0398e2bb9 EFI_DXE_SER= VICES > + 000000001f8ea018 7739f24c-93d7-11d4-9a3a-0090273fc14d EFI_HOB_LIS= T > + 000000001ff2bac0 4c19049f-4137-4dd3-9c10-8b97a83ffdfa EFI_MEMORY_= TYPE > + 000000001ff2cb10 49152e77-1ada-4764-b7a2-7afefed95e8b This is what 'efi tables' / printf("%pUl (%pUs)\n",..). would output for an unknown table: 8868e871-e4f1-11d3-bc22-0080c73c8881 (8868e871-e4f1-11d3-bc22-0080c73c8881= ) Maybe uuid_guid_get_str() should return an empty string in case of an unknown GUID. > + 000000001f9ac018 060cc026-4c0d-4dda-8f41-595fef00a502 EFI_MEM_STA= TUS_CODE_REC > + 000000001f9ab000 eb9d2d31-2d88-11d3-9a16-0090273fc14d EFI_SMBIOS > + 000000001fb7e000 eb9d2d30-2d88-11d3-9a16-0090273fc14d EFI_GUID_EF= I_ACPI1 > + 000000001fb7e014 8868e871-e4f1-11d3-bc22-0080c73c8881 EFI_GUID_EF= I_ACPI2 > + 000000001e550018 dcfa911d-26eb-469f-a220-38b7dc461220 Who would care about the address of the table? Best regards Heinrich