diff options
author | Kun Qin <kuqin@microsoft.com> | 2025-04-23 11:27:39 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-06-19 06:17:18 +0000 |
commit | 84f140bf86ec6b944a7a3955def554142af5faeb (patch) | |
tree | 09090a6079264b86106a4a4dbdfb42d0888fd9aa | |
parent | ad46860061f590c9a5f1a2dc6f80030faa444591 (diff) | |
download | edk2-84f140bf86ec6b944a7a3955def554142af5faeb.zip edk2-84f140bf86ec6b944a7a3955def554142af5faeb.tar.gz edk2-84f140bf86ec6b944a7a3955def554142af5faeb.tar.bz2 |
OvmfPkg: StandaloneMmCpuFeaturesLib: Introduce SmmCpuFeaturesLib for Ovmf
This change adds the implementation of SmmCpuFeaturesLib for Ovmf to
operate with Standalone MM supported platforms.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
-rw-r--r-- | OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c | 75 | ||||
-rw-r--r-- | OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf | 42 | ||||
-rw-r--r-- | OvmfPkg/OvmfPkg.ci.yaml | 3 |
3 files changed, 119 insertions, 1 deletions
diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c new file mode 100644 index 0000000..9f3b54c --- /dev/null +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c @@ -0,0 +1,75 @@ +/** @file
+ The CPU specific programming for Standalone MM environment.
+
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <PiMm.h>
+#include <Library/SmmCpuFeaturesLib.h>
+#include <Library/MmServicesTableLib.h>
+
+/**
+ The common constructor function
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+MmCpuFeaturesLibConstructorCommon (
+ VOID
+ );
+
+/**
+ Hook point in normal execution mode that allows the one CPU that was elected
+ as monarch during System Management Mode initialization to perform additional
+ initialization actions immediately after all of the CPUs have processed their
+ first SMI and called SmmCpuFeaturesInitializeProcessor() relocating SMBASE
+ into a buffer in SMRAM and called SmmCpuFeaturesHookReturnFromSmm().
+**/
+VOID
+EFIAPI
+SmmCpuFeaturesSmmRelocationComplete (
+ VOID
+ )
+{
+ // Do nothing for Standalone MM instance.
+}
+
+/**
+ Processor specific hook point each time a CPU exits System Management Mode.
+
+ @param[in] CpuIndex The index of the CPU that is exiting SMM. The value
+ must be between 0 and the NumberOfCpus field in the
+ System Management System Table (SMST).
+**/
+VOID
+EFIAPI
+SmmCpuFeaturesRendezvousExit (
+ IN UINTN CpuIndex
+ )
+{
+ // Do nothing for Standalone MM instance.
+}
+
+/**
+ The constructor function
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+StandalonMmCpuFeaturesLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *SystemTable
+ )
+{
+ return MmCpuFeaturesLibConstructorCommon ();
+}
diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf b/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf new file mode 100644 index 0000000..ae7396a --- /dev/null +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf @@ -0,0 +1,42 @@ +## @file
+# The CPU specific programming for Standalone MM environment.
+#
+# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StandaloneMmCpuFeaturesLib
+ MODULE_UNI_FILE = StandaloneMmCpuFeaturesLib.uni
+ FILE_GUID = 74B868F6-7DC6-4CDE-86B1-27E9A7CEBFCC
+ MODULE_TYPE = MM_STANDALONE
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x00010032
+ LIBRARY_CLASS = SmmCpuFeaturesLib
+ CONSTRUCTOR = StandalonMmCpuFeaturesLibConstructor
+
+[Sources]
+ SmmCpuFeaturesLib.c
+ StandaloneMmCpuFeaturesLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ MemEncryptSevLib
+ PcdLib
+
+[Guids]
+ gSmmBaseHobGuid ## CONSUMES
+
+[Pcd]
+ gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase
diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml index e4b729b..62f3aef 100644 --- a/OvmfPkg/OvmfPkg.ci.yaml +++ b/OvmfPkg/OvmfPkg.ci.yaml @@ -53,7 +53,8 @@ "UefiCpuPkg/UefiCpuPkg.dec",
"ShellPkg/ShellPkg.dec",
"EmbeddedPkg/EmbeddedPkg.dec",
- "SourceLevelDebugPkg/SourceLevelDebugPkg.dec"
+ "SourceLevelDebugPkg/SourceLevelDebugPkg.dec",
+ "StandaloneMmPkg/StandaloneMmPkg.dec"
],
# For host based unit tests
"AcceptableDependencies-HOST_APPLICATION":[
|