From nobody Sun Feb 8 19:02:49 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+87236+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87236+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646234599; cv=none; d=zohomail.com; s=zohoarc; b=aPzbjBaMYHLobmwfI0jJ7JSCYmu1hJDtDEKiW9Rx2yBf3Q+4AbIBeM3BYk3EwGEISho0u+6lsJ1NtAaV6aSnXeyWEqsFbfIeoJ7cylbTS3lWFv7vAOm1EJdfszMMdyhe0+jj4oUq/4Qnz+zK7TV+rORh0mSgO5/UpgV39w2OtXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646234599; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=yJvK9TaZePd/5dtYgtu2XMP8Edy5nsDUqiPfrv5s4oo=; b=XQtn3POL0gbzDJ1N9nGCOsteK/bIH6PxbpvosK4vPROQqxfaboe42AFI4ywPiGVStUcIfGB7PG7nLDOoyP9GzQXxpeY7mvPrQmliLg9ljBa+6P2QA+rTfL21EJ9H/obmWpxuPCY5ZUqG0AAu45cFsjkajwqE6qzwEl7XhgUlQns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87236+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646234599568741.6300190659588; Wed, 2 Mar 2022 07:23:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id V3xzYY1788612xRGpePMWOWF; Wed, 02 Mar 2022 07:23:19 -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:01 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="233324199" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="233324199" 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:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="641630343" X-Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.239]) by orsmga004.jf.intel.com with ESMTP; 02 Mar 2022 01:20:00 -0800 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu , Chasel Chiu Subject: [edk2-devel] [PATCH v1 3/7] IntelFsp2Pkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Date: Wed, 2 Mar 2022 17:18:55 +0800 Message-Id: <20220302091859.2783-4-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: ANfzrpT72weore1kAE1Nze6Hx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646234599; bh=yvR/5YCxadl1feZJxt5WI9H2el7vo2EbDLRTe2aVJL4=; h=Cc:Date:From:Reply-To:Subject:To; b=DGr8pehO/T/NZv6AKniGGSKIErvoA23Ug7aXVewjqfmyt0b/rTkjJNKot+/HMRuK9LE r8oE81eOrp4oYbtfBaUF1ouviVCBXeJnz1LyUG8c4tfXpayRsJ48X1vbq31LDXPOJpnzT g+00cS8Pcehg/Syhcfi7/gRgRGdq0MWWRTs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646235502689100003 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 address mask calculation and remove the duplicated code in edk2\IntelFsp2Pkg\Library\BaseCacheLib\CacheLib.c. Cc: Chasel Chiu Signed-off-by: Yu Pu Reviewed-by: Chasel Chiu --- IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c | 10 ++-------- IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c b/IntelFsp2Pkg/Li= brary/BaseCacheLib/CacheLib.c index f879c268e7ec..3f8ed122b2be 100644 --- a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c +++ b/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "CacheLibInternal.h" =20 /** @@ -388,15 +389,8 @@ SetCacheAttributes ( UINT32 UsedMsrNum; EFI_MEMORY_CACHE_TYPE UsedMemoryCacheType; UINT64 ValidMtrrAddressMask; - UINT32 Cpuid_RegEax; =20 - AsmCpuid (CPUID_EXTENDED_FUNCTION, &Cpuid_RegEax, NULL, NULL, NULL); - if (Cpuid_RegEax >=3D CPUID_VIR_PHY_ADDRESS_SIZE) { - AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &Cpuid_RegEax, NULL, NULL, NULL); - ValidMtrrAddressMask =3D (LShiftU64 ((UINT64)1, (Cpuid_RegEax & 0xFF))= - 1) & (~(UINT64)0x0FFF); - } else { - ValidMtrrAddressMask =3D (LShiftU64 ((UINT64)1, 36) - 1) & (~(UINT64)0= x0FFF); - } + GetPhysicalAddressBits(NULL, &ValidMtrrAddressMask); =20 // // Check for invalid parameter diff --git a/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf b/IntelFsp2= Pkg/Library/BaseCacheLib/BaseCacheLib.inf index 9a513fb6df77..e6b14ae4a802 100644 --- a/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf +++ b/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf @@ -21,9 +21,11 @@ =20 [Packages] MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec IntelFsp2Pkg/IntelFsp2Pkg.dec =20 [LibraryClasses] BaseMemoryLib CacheAsRamLib + UefiCpuLib =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 (#87236): https://edk2.groups.io/g/devel/message/87236 Mute This Topic: https://groups.io/mt/89503326/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-