From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=XKqk8mso; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: yu.pu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646212814; x=1677748814; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6sByMBVxBpBgx8QhQweZHP8g2ruAFcQYNQj++NjJeE=; b=XKqk8msoOI5NvH/b5hnMgzQ7egIqLD81w4ODov+OEYA3p3dbOn1MmKVh 94GoBBvqskziJ7FXsP9tsu9j9cJMlvllnPhpYWcYFU8a1kaI3bd3320ew kkdeGhMVf5l7cb07dmdEJKWq73vJw+B9Syw+gSHZJTEnJj+r8+TexB1sq rBTP1tVmJmz38mGYH4v7r+qCnRSL8l+LPQzk3Gren53qdPb+c5BOWfvzD eUr4Kkv1SWbVZtC2NIIak0UK+D71RsfL1/23MS08eEoPpxnjjQD9UQ5XZ RcWj3eWQUOin93MTuhCz6TRaVYoeH8K7qU3uK8HQxzTr63eAv5IUNi8l9 A==; 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" 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" 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: [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> X-Mailer: git-send-email 2.30.0.windows.2 In-Reply-To: <20220302091859.2783-1-yu.pu@intel.com> References: <20220302091859.2783-1-yu.pu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- 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=0D =0D **/=0D +#include =0D =0D #include "UefiPayloadEntry.h"=0D =0D @@ -341,7 +342,6 @@ BuildGenericHob ( VOID=0D )=0D {=0D - UINT32 RegEax;=0D UINT8 PhysicalAddressBits;=0D EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;=0D =0D @@ -351,13 +351,7 @@ BuildGenericHob ( //=0D // Build CPU memory space and IO space hob=0D //=0D - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);=0D - if (RegEax >=3D 0x80000008) {=0D - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);=0D - PhysicalAddressBits =3D (UINT8)RegEax;=0D - } else {=0D - PhysicalAddressBits =3D 36;=0D - }=0D + PhysicalAddressBits =3D GetPhysicalAddressBits(NULL, NULL);=0D =0D BuildCpuHob (PhysicalAddressBits, 16);=0D =0D 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 =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D @@ -738,13 +739,7 @@ CreateIdentityMappingPageTables ( if (Hob !=3D NULL) {=0D PhysicalAddressBits =3D ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;=0D } else {=0D - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);=0D - if (RegEax >=3D 0x80000008) {=0D - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);=0D - PhysicalAddressBits =3D (UINT8)RegEax;=0D - } else {=0D - PhysicalAddressBits =3D 36;=0D - }=0D + PhysicalAddressBits =3D GetPhysicalAddressBits (NULL, NULL);=0D }=0D =0D //=0D --=20 2.30.0.windows.2