From nobody Mon Feb 9 02:12:36 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+87237+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+87237+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646234600; cv=none; d=zohomail.com; s=zohoarc; b=YCfIiwsPhQnr+lcSkW/mrfBuES5/zRUpzdEs0K0YuIRHOp+CKryTP2aZCYbCZo26rvk/EExaBMxx1ItD8XNjYZhJCJGCTbCY0Qp81JC30bDeG5f//j3zkaJ5gQduvyvZFvBpwobO3MtiRjDMBkGazIlYATUAfWnt2puRbqi442Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646234600; 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=NJkpvFy5N174tBaHEJEfI3WHlzEfCsfIOHxH91ZVQe8=; b=EC6EmW2Cl2I+GRtIR1MjC6bbo6YGrZp/tRSB5DbKdZMNkUI/2F0jBItWHhuqKPU2jd7eaqdFo0lSttaX/lOoOGkQBhUqoaeEeM8ZSj5z/W16xLxxGUFNrJVFTFjOXdg6qVgUUjhSUSMxNXaNPH9mG6JZq2a4dQalZXQGF7GeIKg= 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+87237+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 1646234600278934.2837383718924; Wed, 2 Mar 2022 07:23:20 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id oqTWYY1788612xRfkCDNWZ2G; 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:04 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="233324211" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="233324211" 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:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="641630364" X-Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.239]) by orsmga004.jf.intel.com with ESMTP; 02 Mar 2022 01:20:02 -0800 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu , Ard Biesheuvel , Sami Mujawar , Jiewen Yao Subject: [edk2-devel] [PATCH v1 4/7] StandaloneMmPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Date: Wed, 2 Mar 2022 17:18:56 +0800 Message-Id: <20220302091859.2783-5-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: 3hkUKnYkvKU0IjlwlK7IMPnwx1787277AA= 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=RgFPrSP5zsDqxIJuzl9zawg+q1dIbEDL9Yw6Aj7xz1w=; h=Cc:Date:From:Reply-To:Subject:To; b=Bru5gi8KGrnecmeKcrIvBmSwBVDcn+pmIr6/Mt3WUStCl9rjvd4SXzEAo4RuSiXd4jO 8fQsv3UZhzOhoJqlykGRdJzv0RVsvaGYCs0w84Lt7OzjRbvqS5qPXvyRTEWeL6MKbpXUe cRHAwxTxr7HsMHONuQ8ShTFpQoaWf3sKeiQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646235502687100002 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 StandaloneMmPkg\Library\StandaloneMmMemLib\X86StandaloneMmMemLibInternal.c Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Jiewen Yao Signed-off-by: Yu Pu --- StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c= | 10 ++-------- StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf = | 2 ++ StandaloneMmPkg/StandaloneMmPkg.dsc = | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemL= ibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMe= mLibInternal.c index c309d1bc6a56..4afd9b938934 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInter= nal.c +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInter= nal.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include #include @@ -40,7 +41,6 @@ MmMemLibInternalCalculateMaximumSupportAddress ( ) { VOID *Hob; - UINT32 RegEax; UINT8 PhysicalAddressBits; =20 // @@ -50,13 +50,7 @@ MmMemLibInternalCalculateMaximumSupportAddress ( 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 // diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.= inf b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf index b29d97a74607..94f7fbb1c4f7 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf @@ -43,12 +43,14 @@ [Packages] MdePkg/MdePkg.dec StandaloneMmPkg/StandaloneMmPkg.dec + UefiCpuPkg/UefiCpuPkg.dec =20 [LibraryClasses] BaseMemoryLib DebugLib HobLib MemoryAllocationLib + UefiCpuLib =20 [Guids] gMmCoreDataHobGuid ## SOMETIMES_CONSUMES ## HOB diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/Standalo= neMmPkg.dsc index 8012f93b7dcc..41449046799f 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dsc +++ b/StandaloneMmPkg/StandaloneMmPkg.dsc @@ -59,6 +59,7 @@ StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntry= Point/StandaloneMmCoreEntryPoint.inf StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint= /StandaloneMmDriverEntryPoint.inf VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/Variab= leMmDependency.inf + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf =20 [LibraryClasses.AARCH64, LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf --=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 (#87237): https://edk2.groups.io/g/devel/message/87237 Mute This Topic: https://groups.io/mt/89503327/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-