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 8AE48C6FD1E for ; Fri, 10 Mar 2023 20:53:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0BAF485FE5; Fri, 10 Mar 2023 21:50:25 +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="VYU9qACw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C0D7485F6E; Fri, 10 Mar 2023 21:49:42 +0100 (CET) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 3388585F6E for ; Fri, 10 Mar 2023 21:49:31 +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-io1-xd2a.google.com with SMTP id e11so2548913ioe.3 for ; Fri, 10 Mar 2023 12:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678481367; 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=NY0+nzRBeU2ii4YnmtnYk1asEyAstTqymvCC/GBvbYA=; b=VYU9qACwhfvfPBUYcYVuiwxHoZd8FtmP8PvfpZMDmz8gHgj/ghNXWAqQHlrg8y9Whz D/X/R25Rhk+OZ4EOb0opQZWuYxylzKS3EIfM9rSSN4SObHA7Yq0uG1h+R8W6g6gH7IxV UmnSFRfsbsNMM9xMBLx4rQapolu+S0v+bez34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678481367; 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=NY0+nzRBeU2ii4YnmtnYk1asEyAstTqymvCC/GBvbYA=; b=7sFo6T+7939WP2USVLOOkbP+bZgmb5LSr8B+Z1zNF6SGTTtJmvwrcnVCHd6UJ9DE6b 4NJQUnhIO547p3Ddfe0zHawo4Rwlm7dFTqgzflNAZvEA7kzogmEC+ZqHZ6PxrFz6GZV6 ts5R9dvgKe65MM6DOQxk8BPq16TbcrslZzk6vXt+0e248qYhSMjANd6sbuEBFxqjhKvv BR6Cccs01oSfeuxbBHiK6SJPjyQ/BbJxO35Ugkye5PNjcQUFRYvLKmJWox3snwq6vDcj jcS/jI56ElrCM4AjQyz3dTAYJI/JzTuGx7JLiWI1NCfC/9OsL/O2iXF3IwvlZly4yD75 tS0Q== X-Gm-Message-State: AO0yUKX7s07K7JnmV3zyfCQBmrLtt9VXckSI5OLfL09D/10TjbWjvsSK cbuvwAd7LkerpfCu6dhJBeYVBlh1qAuyhvGnEK0= X-Google-Smtp-Source: AK7set/ZFsQZ380zkAaaR22nJXETMg3Aoe8+Jv4YlR8ATfL6Ru23/Mrl2HtcVtiWBC+K9FFT6WyOqA== X-Received: by 2002:a5d:8858:0:b0:721:d759:ab16 with SMTP id t24-20020a5d8858000000b00721d759ab16mr16197400ios.18.1678481367404; Fri, 10 Mar 2023 12:49:27 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id a7-20020a056e020e0700b00315785bfabfsm273817ilk.47.2023.03.10.12.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 12:49:26 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass Subject: [PATCH v2 11/12] efi: Support showing tables Date: Fri, 10 Mar 2023 12:49:01 -0800 Message-Id: <20230310204903.416969-12-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230310204903.416969-1-sjg@chromium.org> References: <20230310204903.416969-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.8 at phobos.denx.de X-Virus-Status: Clean Add a command (for the app and payload) to display the tables provided by EFI. Signed-off-by: Simon Glass --- Changes in v2: - Make use of common code cmd/Makefile | 2 +- cmd/efi.c | 33 ++++++++++++++++++++++++++++++++- doc/usage/cmd/efi.rst | 22 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/cmd/Makefile b/cmd/Makefile index 1c5c6f3c00c..a0bfa2acefe 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -62,7 +62,7 @@ obj-$(CONFIG_CMD_EXTENSION) += extension_board.o obj-$(CONFIG_CMD_ECHO) += echo.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o obj-$(CONFIG_CMD_EEPROM) += eeprom.o -obj-$(CONFIG_EFI) += efi.o +obj-$(CONFIG_EFI) += efi.o efi_common.o obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o efi_common.o obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o ifdef CONFIG_CMD_EFICONFIG diff --git a/cmd/efi.c b/cmd/efi.c index c0384e0db28..4d0edfa7f27 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,36 @@ 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; + + 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; + } + } + + efi_show_tables(systab); + + 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 +328,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..ef37ff2f4c1 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 + 000000001f8edf98 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 (unknown) + 000000001f9ac018 060cc026-4c0d-4dda-8f41-595fef00a502 EFI_MEM_STATUS_CODE_REC + 000000001f9ab000 eb9d2d31-2d88-11d3-9a16-0090273fc14d SMBIOS table + 000000001fb7e000 eb9d2d30-2d88-11d3-9a16-0090273fc14d EFI_GUID_EFI_ACPI1 + 000000001fb7e014 8868e871-e4f1-11d3-bc22-0080c73c8881 ACPI table + 000000001e654018 dcfa911d-26eb-469f-a220-38b7dc461220 (unknown) -- 2.40.0.rc1.284.g88254d51c5-goog