From nobody Sun Feb 8 19:37:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87240+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87240+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 164623460198898.06861468330271; Wed, 2 Mar 2022 07:23:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zjoQYY1788612xONDB5fvtrM; Wed, 02 Mar 2022 07:23:22 -0800 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.5530.1646212796036188164 for ; Wed, 02 Mar 2022 01:20:14 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="233324291" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="233324291" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 01:20:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="641630450" X-Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.239]) by orsmga004.jf.intel.com with ESMTP; 02 Mar 2022 01:20:12 -0800 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu , Guo Dong , Ray Ni Subject: [edk2-devel] [PATCH v1 7/7] UefiPayloadPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Date: Wed, 2 Mar 2022 17:18:59 +0800 Message-Id: <20220302091859.2783-8-yu.pu@intel.com> In-Reply-To: <20220302091859.2783-1-yu.pu@intel.com> References: <20220302091859.2783-1-yu.pu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yu.pu@intel.com X-Gm-Message-State: MmewdXwdxXKQymEvqwG9lRApx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646234602; bh=szo/BICFmKHAw6AaBIKfb6uIgMxaMuY1w7UNtSCMwlw=; h=Cc:Date:From:Reply-To:Subject:To; b=f97OFPmKyT+sH+ugISfJAM7xysyC/UVSRXefsinw+Z01nrw7jG41X8nUHTW6QOucgK+ 9pju5nEz4pKlmU51yQuBcSNF0+VC6DD0VmvZ+TgU5tlbGfDkFLfqzZN67YaAChtOrJ335 jCQwkn5W4NWr8v81q01wXRN4gkE/jb+MZz0= X-ZohoMail-DKIM: fail (Signature date is -1 seconds in the future.) X-ZM-MESSAGEID: 1646234603284100026 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3394 Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical addr= ess mask calculation and remove the duplicated code in UefiPayloadPkg\UefiPaylo= adEntry Cc: Guo Dong Cc: Ray Ni Signed-off-by: Yu Pu Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 10 ++-------- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index 0fed1e36918a..4378aa4f1d97 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -4,6 +4,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ +#include =20 #include "UefiPayloadEntry.h" =20 @@ -341,7 +342,6 @@ BuildGenericHob ( VOID ) { - UINT32 RegEax; UINT8 PhysicalAddressBits; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; =20 @@ -351,13 +351,7 @@ BuildGenericHob ( // // Build CPU memory space and IO space hob // - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >=3D 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - PhysicalAddressBits =3D (UINT8)RegEax; - } else { - PhysicalAddressBits =3D 36; - } + PhysicalAddressBits =3D GetPhysicalAddressBits(NULL, NULL); =20 BuildCpuHob (PhysicalAddressBits, 16); =20 diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayl= oadPkg/UefiPayloadEntry/X64/VirtualMemory.c index ac0d58e685c8..c61aeeda7f2e 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c @@ -25,6 +25,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -738,13 +739,7 @@ CreateIdentityMappingPageTables ( if (Hob !=3D NULL) { PhysicalAddressBits =3D ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace; } else { - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >=3D 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - PhysicalAddressBits =3D (UINT8)RegEax; - } else { - PhysicalAddressBits =3D 36; - } + PhysicalAddressBits =3D GetPhysicalAddressBits (NULL, NULL); } =20 // --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87240): https://edk2.groups.io/g/devel/message/87240 Mute This Topic: https://groups.io/mt/89503330/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-