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 X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E327C433EF for ; Wed, 8 Sep 2021 17:29:56 +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 76F4D61153 for ; Wed, 8 Sep 2021 17:29:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 76F4D61153 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de 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 5C5A8833B6; Wed, 8 Sep 2021 19:29:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (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 (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="VENtUQGg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55CA6833E7; Wed, 8 Sep 2021 19:29:51 +0200 (CEST) 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 0C744833AB for ; Wed, 8 Sep 2021 19:29:48 +0200 (CEST) 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.net; s=badeba3b8450; t=1631122185; bh=hl7Ecr8iWBsFrnKiFN35Q0RhqFhhs/9EVlMOVgjFIMo=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=VENtUQGgXptpqAQky4bM3hqD3jAUU2YfUsZiDKzf+hVD4lYLQo4i1zV8vMXivDUGl XlZo2rB5tnRqKbM83lDW9lCzwW/1N+gVJrTrHmqKvE1x4W/GmwpvXhcfzbVoKl4VYP qvqPGuyEdJ7FrEo9buaBR+XJk23qTMHcNXuHdFpE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MBUqL-1mEvFm0usx-00CyrU; Wed, 08 Sep 2021 19:29:45 +0200 Subject: Re: [PATCH 03/35] x86: Show some EFI info with the bdinfo command To: Simon Glass Cc: Ilias Apalodimas , Bin Meng , Tom Rini , Christian Melki , U-Boot Mailing List References: <20210908133405.696481-1-sjg@chromium.org> <20210908073355.3.I64a9f2e15201e8dba68a24e903cc1ac59237169e@changeid> From: Heinrich Schuchardt Message-ID: Date: Wed, 8 Sep 2021 19:29:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210908073355.3.I64a9f2e15201e8dba68a24e903cc1ac59237169e@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:NtoRKKJqDzVppTDI4Gt/9JLLYdAL5ebMWGz3jt32wHhf5lHCVxF pSdhmPQc8RKREQCkS+gce+0J/z5sd4qJEpzQ1pDliamjvDUAWgMbs8h9utua2YgCNNQB5lI ZKnCy/p21KEJr4nATkKcvxxRzX4cyQHq85/gPtu8VCcvguR/hK49tXnaWWokFQ33CZla49I U3KS9H2+gOlt599Z0tT0Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:EI25cwb8SMQ=:d5vJ+ToMFbA1/FWN+C6KuA nD1IJzNEGj1HdPyGZGIlOYjJj7/P07VU7WxM3YVEHq66LN/19lsYKuCyexXnVJYe8amg+352P 7wX43F2mpNDI0I+g3gqyfmWhP/aSOCCyJ1uR8NB7lAkVk9Fc4d68IjmleV2Gc3rwI9oz3t868 vI7p6M4dC6zQ9bgMwi1+06vmPF+IptVwp7GWs+rOsxQfF5OCCv2I7dSFHBm0ST78ntGnJOjY/ lt7Vq3K7KxTDhlTNyaP0m+Twb1vAapXIGurBZsV3j0G1/cokXiVQllU9fNUDTbCpTIO9jIPaX DvNfQ8Ulx9XKTb22O8TLzAyRmgVY9xOKYTDM7roYQMsHj7fbdVXq5gPUxwObbReMz6F1OU84G Q2JXUJ3jSo7xDVHPDnuaPOzrSTTRZ+bZ3CRWCC41uan7/cAgLFmlqKIo4w70nZvoad7pb+2+q 9vZ0KZlCNLjtbD5XfazQcseUYOuT89xeiK1bpqgIMee1B/phoudlLcm82jMwgG6C9N6f1WKIy GU/XGAhQClvdcNO6IjYX/8zn8WOOFWL7AF0G2spxnJU4XFZ8UGwQdPDOqHr/RzylczVI8VemY nmh4J/pH0ZhGdQlUUl//NF/UOqSvsw7Hi7asVqE0kdNr8hzKhiWIz2wTOT/Prh/dXxRmFMd4Q +V+7HvdYY2hHsqjpjfRavPCFCZQjvFMFTqvk1cuXZ+l4CFOpDfOHjGeyUU8mmMxVX8XxSbffl TPPSsjTxlhYltZ6uqbaXy3rm62lcBsERKngVR7LiHNnxquiOsm/IbCAWUjoqRkBHlM3OuEhxT jF//bTutrD2pubSRBcUuBJCkcCzYLpZTcMFrrSlFMwFA943YoZ97DkYvnOtl188m8FVPgj9j1 VrABmwwaGDpGUekB8zuVKuIuiZhXl3ABlUEytS4XRmwYOCQdqAaXcuws3Og5xOwelf6wDR1Kt 3b6P+/aMtdZdf4Gy1m4fVmSezJN8t1I/us3Q6kKOw27pDv5tIWAOKc7G6OzAwUwKB0GsNBkad GYXYGrutgQwV5jkmDSBBUhXRB34yESVeyD8nAVTxApuvfnP1PxdJVdWchBn7Vg5ccSIzqfdAu 5mu3pWfvyl9geg= 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 On 9/8/21 3:33 PM, Simon Glass wrote: > It is useful to see some basic EFI info with the command as it forms par= t > 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(). > > Signed-off-by: Simon Glass > --- > > 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 =3D map->desc_size; > efi_info->efi_memdesc_version =3D map->version; > - efi_info->efi_memmap =3D (u32)(map->desc); > + efi_info->efi_memmap =3D (ulong)(map->desc); When converting a pointer to integer we use (uintptr_t). arch/x86/include/asm/bootparam.h defines efi_info->efi_memmap as u32. This type is too small to hold a pointer. > efi_info->efi_memmap_size =3D size - sizeof(struct efi_entry_memmap); > > #ifdef CONFIG_EFI_STUB_64BIT > efi_info->efi_systab_hi =3D table->sys_table >> 32; > - efi_info->efi_memmap_hi =3D (u64)(u32)(map->desc) >> 32; > + efi_info->efi_memmap_hi =3D (u64)(ulong)map->desc >> 32; You should not use two fields to hold a single pointer. Please, replace all of these duplicate fields. Best regards Heinrich > signature =3D EFI64_LOADER_SIGNATURE; > #else > signature =3D EFI32_LOADER_SIGNATURE; > #endif > memcpy(&efi_info->efi_loader_signature, signature, 4); > } > + > +void efi_show_bdinfo(void) > +{ > + struct efi_entry_systable *table =3D NULL; > + int size, ret; > + > + ret =3D 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' comm= and > + * > + * 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 +=3D bdinfo.o > ifndef CONFIG_X86_64 > ifndef CONFIG_TPL_BUILD > obj-y +=3D 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(); > +} >