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:07 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NVwT6nif; 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=1646212807; x=1677748807; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ihUqy7lZHJ3eSwzzqENRqUW8Alf4J+2vHVeOMz1MmM0=; b=NVwT6nifg/JdH03MrcZuS0Q1W4CNmThl43Mo+sCuoukU579su+eHayLN /NSLP6Oje2N5DW9NroKgeZTCIaxXyP4Z10gLi6BuEy2peFNpLKevPVTmq GF8KtuM+8jglm62gcMPhiCfKqmVhwPY4lAAqt2IWiommB1LalMn4hQ391 AGV3gEZVjc3B4IyDJqtGq5zKfvIniPo0CyD+4/hWfe2zeYr0VXLb9CVc1 sHhPuwH1PyAGZtZPukJNlDYeEWhLaFXtkadv+Z7fkxSWgZYDI0f1dkoFf bkkSttM6N7tQI2P/9l/nEtR2XME8edEVGADg76eJSrUSFfVvQmEPFxbmc Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="233324224" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="233324224" 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:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="641630383" Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.239]) by orsmga004.jf.intel.com with ESMTP; 02 Mar 2022 01:20:05 -0800 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu Subject: [PATCH v1 5/7] OvmfPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Date: Wed, 2 Mar 2022 17:18:57 +0800 Message-Id: <20220302091859.2783-6-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 OvmfPkg\XenPlatformPei\MemDetect.c. Cc: Ard Biesheuvel Cc: Jiewen Yao Signed-off-by: Yu Pu --- OvmfPkg/XenPlatformPei/MemDetect.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/Me= mDetect.c index d412d1f4db6f..bd24612c21ef 100644 --- a/OvmfPkg/XenPlatformPei/MemDetect.c +++ b/OvmfPkg/XenPlatformPei/MemDetect.c @@ -30,6 +30,7 @@ Module Name: #include =0D #include =0D #include =0D +#include =0D =0D #include "Platform.h"=0D #include "Cmos.h"=0D @@ -180,15 +181,7 @@ AddressWidthInitialization ( VOID=0D )=0D {=0D - UINT32 RegEax;=0D -=0D - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);=0D - if (RegEax >=3D 0x80000008) {=0D - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);=0D - mPhysMemAddressWidth =3D (UINT8)RegEax;=0D - } else {=0D - mPhysMemAddressWidth =3D 36;=0D - }=0D + mPhysMemAddressWidth =3D GetPhysicalAddressBits(NULL, NULL);=0D =0D //=0D // IA-32e paging translates 48-bit linear addresses to 52-bit physical a= ddresses.=0D --=20 2.30.0.windows.2