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,URIBL_BLOCKED, 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 2F83EC433EF for ; Thu, 9 Sep 2021 09:29:24 +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 04BF9611B0 for ; Thu, 9 Sep 2021 09:29:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 04BF9611B0 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 13E8A83216; Thu, 9 Sep 2021 11:29:20 +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="ZiuETsGd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 58BCA832A5; Thu, 9 Sep 2021 11:29:18 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (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 C0FD183216 for ; Thu, 9 Sep 2021 11:29:14 +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=1631179751; bh=53p6m9/KZKAFzyUVkRQVLzNBzF2eLL5ZDoi413vPZXs=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=ZiuETsGdaWYdYztR6F83IGEqSN9Zr/EiQG5TCn5BBPBGIidV1mtQlFkH02MxSq7UC Bao0AaBmUX5ZIo8cNpv9srLnauLKGEWWXggiTxwCoyxHrII6CBeNzbItNdHAlIaOxu 4ou0OvqIT7FtuV5CLTaGeNFbwD95KoN33QQyu5dU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MJVHU-1mdbMV1p28-00Jqo5; Thu, 09 Sep 2021 11:29:11 +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: <3050a6d1-60d6-6221-bf28-173fba6c48d9@gmx.de> Date: Thu, 9 Sep 2021 11:29:10 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:zKeUyn0+36sJeDRVqOk1HjBYihUPh0UsfzXfO+YkdouVSr2YSJR OyeNbr6AmYbzCsnz8RpK1amj7FjPdHNE29GR7nLKKCTMJUUnjjBEoYXbotrDpBiB/oJnD2q JCLGzv7vASiQOD/1jTTanWaKh+37zNLTI+xxUOMT2A/NudwhxCx3WXEu0h4mKKOY/YvJGNY oGa5CZyfFIA6GzWIw3H2Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:sUBK4eJOhVA=:SiOTu8qDBjnp/epknBG1bh k0misGRfcubutLGO8S1Qhe+C/e8vQsGj3IRYDmYLkgnABKtrEzxiKfO8UuCN5lBUuzJQLF26b u27e+mQNBStEqY4yFY0FNcXBXWSsuUXSM3GI6ciZcRmyxJl0n31QkMSmMpN4kEfb+xJvtyiV+ SVZg4oUIfblQU6Fywm1ek27lkI5HcG1GB4tgd7a4C98OBcuuRZUcqNbt/I3h8IO+tkk9qBCj3 qGccJ6fhqtsQD7FZ9ovWPNJIiTImoPFg2WRK/w45R/oUIr9wpQDdS76b0z3yXEb8VZJBiGBCU zgtWEF8loflqL9Jt6kKCJfiVom8CeJpeRcyKnUCTb8vMQ1xf82O7vG4zTgZezFRlmb9ECHQyn T3za2a6GPLYDAWRmDZDHznGyGlIYWAv7Cs77hKYJ8Lnh8z0AP4Rb26FM7CVCRKoUUZJ9Q95eC 5W972oogKvM3n5WDqNyCqnyh6I8BvUqGI83rZDvYc+Ey279dTzCdJ+DzfFuRMoh6ZTyu8rol4 Z7tDGwFAE9UlpJQ0N597lpjASteQe7OmYTJSpcc5ryjYK/mG+r8eilDEZMHM2ciOECBCyiPXP uXvRSPGosQF0LrruioEdXpsULD/sRvdMDUXe7N4e7iTBKVhLsUzZtom0D4PFwYbceN+eQPLtF 9qxPpgwl+hYbBlx3TzsHr/Eap66Ak4VgAY7KkAsZzN+MEEkwL0NZhKnC2Sq9o45aL+GQCeDDY SDWl1dPjB4KRoEYTy7EKWmJV8ZOjpBl5G5SXJHA2UE+wgxMZo7JNwLwhs00QQ1vyOij1Phfj2 6vDu+Zya6X9qLYjPLqkox0OCFotYgTeUmhFiITMUm4/Y5J5TjDx1PtJE3/twiGmLxRVxcfX4q 1YiCaEBX5+pe7ZG/oo99rcmt2lVNz0b3lyjgP6ynpUll36vVv2K0tvIxWKmha7xnvXgX/M/o1 vjKv4PkM3nBGKjo8jn5a8y2E4kaDc1f0LVF1GUL9PO19Aq2SN92upJGozfPjDsYdG2i7Y33Ej bB5RvI9eaDzIMBFATqQ/V+8s9Mezj/MKMGwPL6d/MfWg+aqs7o4cARwppTJasPbOvTeLN3gcb 1dL5IiHZv5QgKw= 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/9/21 10:57 AM, Simon Glass wrote: > Hi Heinrich, > > On Wed, 8 Sept 2021 at 11:34, Heinrich Schuchardt w= rote: >> >> >> >> 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 p= art >>> 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). > > Generally in U-Boot it is ulong so I try to be consistent here. Currently ulong and uintprt_t are the same technically. But for the sake of readability uintptr_t is much clearer. We use uintptr_t in 935 code locations already. Just grep for it. > Anyway, u32 is clearly not right for a 64-bit build as it gives > warnings. > >> >> 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_me= mmap); >>> >>> #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. > > We do need to be compatible with what the kernel expects, otherwise > there is no point in filling out this information. Why should we have separate fields for the low and high 32 bits of a pointer? Best regards Heinrich