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 726EFC64EC7 for ; Sun, 26 Feb 2023 01:35:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D69B785BA5; Sun, 26 Feb 2023 02:34:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AXf2Rqvj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2AF4085927; Sun, 26 Feb 2023 02:33:30 +0100 (CET) Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 03C3985B7A for ; Sun, 26 Feb 2023 02:33:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12c.google.com with SMTP id b12so2085204ils.8 for ; Sat, 25 Feb 2023 17:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BMpXV/JeVJRY2/TLLN78jYNNai8eSd4to7gdhr2ve4U=; b=AXf2RqvjOAXHjFqizyk0WTlH/Bqp5JDSi+yc6oMf6C1bogZ4JiEf4tnIjp+eDFlbba RHZFMU6x07oJ5Xokh1ATcRfnvCNtU+YlXVOmzLOBsaZbzk+WjlRDYeVDs2hIlY5SpSAO Hz6JRu+6gZLchpQFQGJrI9Ur4cbjLtzTzfIQ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BMpXV/JeVJRY2/TLLN78jYNNai8eSd4to7gdhr2ve4U=; b=MGnQ4zDOnPRUirxLpoVsd6UEXK29bfc9AMM+w+Awd1zSqOQKz0hrbBy5ZpFF3bVg7j avDDQige73OY98pLfIfDtOvpX7GIL6Vc5aA2Oo6bgjCnIUtlOucspGp+n6wHZqYVW76v tYG9VgOhTjA5NP0yUTJvQtDv0Q27pOlNMBt8CyftOmVDCqGuoLSAZdGvkG7hJ9IX0RYK c5ruWowZfoyNJPjCTZi9ru77hOEqvcXNCR3g86DeaB4vGQ5ARCtsG0fmebxIsGhxKO+B wCepebCe+14FR9KheLzp8YXGtmLzJvsy6dR5cNM5NUdQaVpD5DAFk4RoEGuc17ugWiQ8 BYHQ== X-Gm-Message-State: AO0yUKVP5qvIBlhmfiHYbaLOPnBQGKvmpDNaQiw1Wltqx6+0CuFJ/tCO BlDHHlmPo7E8D00bX5RRuS+1nGdKj7kp0XiM X-Google-Smtp-Source: AK7set9X0pcypR8u7LzDJ2/VAwymCZUqDc6G3bNbzntppfsragoVX6zFWomU+/To1QIA9bDrox7oPw== X-Received: by 2002:a05:6e02:16c5:b0:315:4b70:8376 with SMTP id 5-20020a056e0216c500b003154b708376mr19598012ilx.29.1677375202098; Sat, 25 Feb 2023 17:33:22 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass Subject: [PATCH 09/10] efi: Support showing tables Date: Sat, 25 Feb 2023 18:33:04 -0700 Message-Id: <20230226013305.2251638-10-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean 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[]) +{ + struct efi_system_table *systab; + int i; + + if (IS_ENABLED(CONFIG_EFI_APP)) { + systab = efi_get_sys_table(); + if (!systab) { + printf("Cannot read system table\n"); + return CMD_RET_FAILURE; + } + } else { + int size; + int ret; + + ret = efi_info_get(EFIET_SYS_TABLE, (void **)&systab, &size); + if (ret) { + printf("Cannot find EFI system table (err=%d)\n", ret); + return CMD_RET_FAILURE; + } + } + for (i = 0; i < systab->nr_tables; i++) { + struct efi_configuration_table *tab = &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)); + } + + return 0; +} + static struct cmd_tbl efi_commands[] = { 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 *const argv[]) @@ -298,5 +335,6 @@ static int do_efi(struct cmd_tbl *cmdtp, int flag, int 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 below 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 runtime mapping 1: uncached + + + => efi tables + 000000001f8eda98 ee4e5898-3914-4259-9d6e-dc7bd79403cf EFI_LZMA_COMPRESSED + 000000001ff2ace0 05ad34ba-6f02-4214-952e-4da0398e2bb9 EFI_DXE_SERVICES + 000000001f8ea018 7739f24c-93d7-11d4-9a3a-0090273fc14d EFI_HOB_LIST + 000000001ff2bac0 4c19049f-4137-4dd3-9c10-8b97a83ffdfa EFI_MEMORY_TYPE + 000000001ff2cb10 49152e77-1ada-4764-b7a2-7afefed95e8b + 000000001f9ac018 060cc026-4c0d-4dda-8f41-595fef00a502 EFI_MEM_STATUS_CODE_REC + 000000001f9ab000 eb9d2d31-2d88-11d3-9a16-0090273fc14d EFI_SMBIOS + 000000001fb7e000 eb9d2d30-2d88-11d3-9a16-0090273fc14d EFI_GUID_EFI_ACPI1 + 000000001fb7e014 8868e871-e4f1-11d3-bc22-0080c73c8881 EFI_GUID_EFI_ACPI2 + 000000001e550018 dcfa911d-26eb-469f-a220-38b7dc461220 -- 2.39.2.637.g21b0678d19-goog