From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1816C433F5 for ; Sat, 25 Sep 2021 00:32:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5884E61212 for ; Sat, 25 Sep 2021 00:32:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5884E61212 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3E64883508; Sat, 25 Sep 2021 02:32:20 +0200 (CEST) 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="fDFQQgu1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E50CF8352A; Sat, 25 Sep 2021 02:31:32 +0200 (CEST) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (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 AC031834E3 for ; Sat, 25 Sep 2021 02:31:06 +0200 (CEST) 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-ot1-x32a.google.com with SMTP id x33-20020a9d37a4000000b0054733a85462so15444708otb.10 for ; Fri, 24 Sep 2021 17:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0xoC7JIWdep3dRrYvKS8/IOVhsT+evo8DhE5+SoZvgQ=; b=fDFQQgu1SNKl3B1lNANxBHenCCHr/Az86WcqY5mrj97BfYbWL1VhzZhbpj7FUJzk/n RAJ9jSZJxt5oZ/Yiu2b9c5Cp0D1h10H+6Efwi5bBjwoHAudtJx0YULpVmN3UEER/TOta q0a/NCHDzJHqxJ3J+t9FFxdiCeQkx2vhF3QL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0xoC7JIWdep3dRrYvKS8/IOVhsT+evo8DhE5+SoZvgQ=; b=8R0hh7r3ike8/nhdbCIHcfICCNXYj9fyYGhgfqjs734EZAj+huDuectrH0hfmOPfxh BHMj6tMxBE4qdbIesByZxUt2Z8LRk3SdFQsT2U8SHTESrC1DP+UOvJe1WSGWbts8jroH MI/IDXYv0/27egwNEdxIylqKgIeQCl06ikKQpa/6KCJFTOIiiAPBERaZwsV92kgb7Dwa VvgpFBvYtauZcd9YlBSjSENzOPly9w5hXFAANw54b0qpbaX2yS10dDKWLuPVzx8pAxPC vKxuux5X5ssE+Pd+z3H+2Y0HzSRK8pxFTsebtsOVynxioiiG4k+x1gfsebE3LlKKiaf6 NkPA== X-Gm-Message-State: AOAM532SxOu8Lv09wlBJ39+EG9qYGYuxUsWdBV5uT/z2aBHiLhk6qEg6 XrPFPdLILG27OSfc45TdL5uuwcBaafJDgA== X-Google-Smtp-Source: ABdhPJxeniw8zyHkcljFmi661/AHVjeWVV1F/cIHWwZvKRSH4wxbf1WMYK40s9UKIUYjJ/isGEKBFw== X-Received: by 2002:a9d:3e54:: with SMTP id h20mr6489160otg.236.1632529865198; Fri, 24 Sep 2021 17:31:05 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y83sm2491462oia.47.2021.09.24.17.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 17:31:04 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Bin Meng , Christian Melki , Tom Rini , Ilias Apalodimas , Simon Glass Subject: [PATCH v2 05/39] x86: Show some EFI info with the bdinfo command Date: Fri, 24 Sep 2021 18:30:21 -0600 Message-Id: <20210924183029.v2.5.I64a9f2e15201e8dba68a24e903cc1ac59237169e@changeid> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog In-Reply-To: <20210925003055.759305-1-sjg@chromium.org> References: <20210925003055.759305-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean It is useful to see some basic EFI info with the command as it forms part of the information about a board. Add a hook for this and show the table address as a start. While here, fix an invalid cast in setup_efi_info(). Note that this function is using a data structure defined by Linux so we cannot change it. Also note that ulong is used since this is the standard in U-Boot (>6k uses), despite there being quite a bit of the more verbose uintptr_t (930 uses). Signed-off-by: Simon Glass --- Changes in v2: - Update commit message to mention why the data structure is like it is - Update commit message to mention why ulong is used arch/x86/cpu/efi/payload.c | 13 +++++++++++-- arch/x86/include/asm/efi.h | 7 +++++++ arch/x86/lib/Makefile | 1 + arch/x86/lib/bdinfo.c | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 arch/x86/lib/bdinfo.c diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 9a73b768e9b..3a9f7d72868 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -280,15 +280,24 @@ void setup_efi_info(struct efi_info *efi_info) } efi_info->efi_memdesc_size = map->desc_size; efi_info->efi_memdesc_version = map->version; - efi_info->efi_memmap = (u32)(map->desc); + efi_info->efi_memmap = (ulong)(map->desc); efi_info->efi_memmap_size = size - sizeof(struct efi_entry_memmap); #ifdef CONFIG_EFI_STUB_64BIT efi_info->efi_systab_hi = table->sys_table >> 32; - efi_info->efi_memmap_hi = (u64)(u32)(map->desc) >> 32; + efi_info->efi_memmap_hi = (u64)(ulong)map->desc >> 32; signature = EFI64_LOADER_SIGNATURE; #else signature = EFI32_LOADER_SIGNATURE; #endif memcpy(&efi_info->efi_loader_signature, signature, 4); } + +void efi_show_bdinfo(void) +{ + struct efi_entry_systable *table = NULL; + int size, ret; + + ret = efi_info_get(EFIET_SYS_TABLE, (void **)&table, &size); + bdinfo_print_num_l("efi_table", (ulong)table); +} diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index c1735e4dc5f..dfd858b78ba 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -29,4 +29,11 @@ void setup_video(struct screen_info *screen_info); */ void setup_efi_info(struct efi_info *efi_info); +/** + * efi_show_bdinfo() - Show information about EFI for the 'bdinfo' command + * + * This looks up the EFI table pointer and shows related info + */ +void efi_show_bdinfo(void); + #endif diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 65d9b3bd6a3..18757b29aa9 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -3,6 +3,7 @@ # (C) Copyright 2002-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. +obj-y += bdinfo.o ifndef CONFIG_X86_64 ifndef CONFIG_TPL_BUILD obj-y += bios.o diff --git a/arch/x86/lib/bdinfo.c b/arch/x86/lib/bdinfo.c new file mode 100644 index 00000000000..0cb79b01bd3 --- /dev/null +++ b/arch/x86/lib/bdinfo.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * x86-specific information for the 'bd' command + * + * Copyright 2021 Google LLC + */ + +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +void arch_print_bdinfo(void) +{ + bdinfo_print_num_l("prev table", gd->arch.table); + + if (IS_ENABLED(CONFIG_EFI_STUB)) + efi_show_bdinfo(); +} -- 2.33.0.685.g46640cef36-goog