From nobody Sun Feb 8 12:58:33 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+71756+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+71756+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597615; cv=none; d=zohomail.com; s=zohoarc; b=PFqWP8mzjlxw9sEXetXdvVX73lCN7MKz2XYSk1FsVBO70vZdDbiJT75dxgbxuJziHgK8KzFus3Uc0cmc96MypoCHcBjqGc8hInCOto+LFamG5FIs5TdBlxdDF55oZG6ylvSajPRazWVZqDhSbniXfjN9CuNbfI5466PGzQYt4r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597615; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VkhdiXIvDx9c5+OkcCiL5vPxRY1Cv98IlPD1W4RyDkk=; b=WcuKKJoGroe7zB9TYBp6uMQ4ZolJSSrRJlsBf5zZ6+sinY4kygmmeHCK9g+0SKXs8o6h/fZXTq9eFNTIgMvQr1n8wAEULIXtw4be+WgG96CiKSo+DPMIQ83L39es5MOUY1NH5pLT7bKxtYmZZc1LFh/j9r4LpneMuOdaD7doyhs= 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+71756+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597614997627.4721832690182; Wed, 17 Feb 2021 13:33:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UqUEYY1788612xpDOah2nq66; Wed, 17 Feb 2021 13:33:34 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.600.1613597609171645908 for ; Wed, 17 Feb 2021 13:33:29 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id D38E520B57A0; Wed, 17 Feb 2021 13:33:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D38E520B57A0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Add Standalone MM support Date: Wed, 17 Feb 2021 13:32:27 -0800 Message-Id: <20210217213227.1277-6-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: jYdWWb6aBT12bU19tGFo9pt0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597614; bh=s8V36YnNIPU+fAowhF7mheXeNfFoLVzGadXC1PnnyyQ=; h=Cc:Date:From:Reply-To:Subject:To; b=YFqu/1Nimg++psgU/k9ho829rWgHMOwxGhXckvxDUJE9emENCf5uYOEhRi0Iky1H3DK atDOg5788kpr2n73jhLEolTXIUx9sIj44oOeY9ucSGUqW52iM9G/CxbH6vMjkS147nBEq BPDGPSbPpp8Ru4pk13gxgANhBILBHR5QB5s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3218 Adds an INF for StandaloneMmCpuFeaturesLib, which supports building the SmmCpuFeaturesLib code for Standalone MM. Minimal code changes are made to allow reuse of existing code for Standalone MM. The original INF file names are left intact (continue to use SMM terminology) to retain backward compatibility with platforms that use those INFs. Similarly, the pre-existing C file names are unchanged to be consistent with the INF file names. Note that all references in library source files to PiSmm.h have been changed to PiMm.h for consistency. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Laszlo Ersek --- UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c | 50 += +++++++++++++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf | 38 += ++++++++++++++ UefiCpuPkg/UefiCpuPkg.dsc | 1 + 9 files changed, 95 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c b/Ue= fiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c index 399ddd742dd7..24bd6d0a946d 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include =20 #include "SmmStm.h" diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index 00948a191fad..29e3b650acee 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include "CpuFeaturesLib.h" =20 /** diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c= b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 50379f3aea19..fa3a866ab6f6 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include #include #include diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c = b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c index c562582ccee0..823dbe906cb8 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include #include "CpuFeaturesLib.h" =20 diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Lib= rary/SmmCpuFeaturesLib/SmmStm.c index dcc2e9f9a09a..c92387625ddc 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include #include #include diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLi= b.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c new file mode 100644 index 000000000000..dec6e53e5b55 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c @@ -0,0 +1,50 @@ +/** @file +Standalone MM CPU specific programming. + +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "CpuFeaturesLib.h" + +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ) +{ + return FixedPcdGet32 (PcdCpuMaxLogicalProcessorNumber); +} + +/** + The Standalone MM library constructor. + + @param[in] ImageHandle Image handle of this driver. + @param[in] SystemTable A Pointer to the EFI System Table. + + @retval EFI_SUCCESS This constructor always returns success. + +**/ +EFI_STATUS +EFIAPI +StandaloneMmCpuFeaturesLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *SystemTable + ) +{ + CpuFeaturesLibInitialization (); + + return EFI_SUCCESS; +} diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c index aacc1455a90c..c8a3f58e0ca5 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include =20 #include "SmmStm.h" diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLi= b.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf new file mode 100644 index 000000000000..ec97041d8b75 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf @@ -0,0 +1,38 @@ +## @file +# Standalone MM CPU specific programming. +# +# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D StandaloneMmCpuFeaturesLib + MODULE_UNI_FILE =3D SmmCpuFeaturesLib.uni + FILE_GUID =3D BB554A2D-F5DF-41D3-8C62-46476A2B2B18 + MODULE_TYPE =3D MM_STANDALONE + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x00010032 + LIBRARY_CLASS =3D SmmCpuFeaturesLib + CONSTRUCTOR =3D StandaloneMmCpuFeaturesLibConstructor + +[Sources] + CpuFeaturesLib.h + StandaloneMmCpuFeaturesLib.c + SmmCpuFeaturesLibCommon.c + SmmCpuFeaturesLibNoStm.c + +[Packages] + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + MemoryAllocationLib + PcdLib + +[FixedPcd] + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOME= TIMES_CONSUMES diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 9128cef076dd..7db419471deb 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -154,6 +154,7 @@ [Components.IA32, Components.X64] UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.i= nf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf + UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf --=20 2.28.0.windows.1 -=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 (#71756): https://edk2.groups.io/g/devel/message/71756 Mute This Topic: https://groups.io/mt/80715273/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-