diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2024-06-25 00:40:32 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-28 15:25:27 +0000 |
commit | abc2f595235d0b87f1d15f1a75a345b22ff86c75 (patch) | |
tree | 2ff50cb5b02644df060b8e3895633eeedf5bad3f /UefiCpuPkg | |
parent | 0c037b5fa7d14bc40294b4fa4edd42b4a5111f64 (diff) | |
download | edk2-abc2f595235d0b87f1d15f1a75a345b22ff86c75.tar.gz edk2-abc2f595235d0b87f1d15f1a75a345b22ff86c75.tar.bz2 edk2-abc2f595235d0b87f1d15f1a75a345b22ff86c75.zip |
UefiCpuPkg/PiSmmCpuDxeSmm: Move GetUefiMemoryMap into DxeSmm code
MM can not call GetUefiMemoryMap() function, so, move it into
DxeSmm code. Define a SmmReadyToLockEventNotify to handler the
logic. This will make PiSmmCpuEntryCommon to be common function
for SMM and MM.
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.c | 43 | ||||
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h | 1 | ||||
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 43 |
3 files changed, 44 insertions, 43 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.c index 1ba5967fd6..78bfc8a3e7 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.c @@ -433,38 +433,6 @@ ExecuteFirstSmiInit ( }
/**
- SMM Ready To Lock event notification handler.
-
- mSmmReadyToLock is set to perform additional lock actions that must be
- performed from SMM on the next SMI.
-
- @param[in] Protocol Points to the protocol's unique identifier.
- @param[in] Interface Points to the interface instance.
- @param[in] Handle The handle on which the interface was installed.
-
- @retval EFI_SUCCESS Notification handler runs successfully.
- **/
-EFI_STATUS
-EFIAPI
-SmmReadyToLockEventNotify (
- IN CONST EFI_GUID *Protocol,
- IN VOID *Interface,
- IN EFI_HANDLE Handle
- )
-{
- //
- // Cache a copy of UEFI memory map before we start profiling feature.
- //
- GetUefiMemoryMap ();
-
- //
- // Set SMM ready to lock flag and return
- //
- mSmmReadyToLock = TRUE;
- return EFI_SUCCESS;
-}
-
-/**
Function to compare 2 SMM_BASE_HOB_DATA pointer based on ProcessorIndex.
@param[in] Buffer1 pointer to SMM_BASE_HOB_DATA poiner to compare
@@ -759,7 +727,6 @@ PiSmmCpuEntryCommon ( UINTN TileDataSize;
UINTN TileSize;
UINT8 *Stacks;
- VOID *Registration;
UINT32 RegEax;
UINT32 RegEbx;
UINT32 RegEcx;
@@ -1232,16 +1199,6 @@ PiSmmCpuEntryCommon ( ASSERT_EFI_ERROR (Status);
//
- // register SMM Ready To Lock Protocol notification
- //
- Status = gMmst->MmRegisterProtocolNotify (
- &gEfiSmmReadyToLockProtocolGuid,
- SmmReadyToLockEventNotify,
- &Registration
- );
- ASSERT_EFI_ERROR (Status);
-
- //
// Initialize SMM Profile feature
//
InitSmmProfile (Cr3);
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h index ed0badf431..e662f2dc45 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h @@ -270,6 +270,7 @@ extern UINT8 mSmmSaveStateRegisterLma; extern BOOLEAN mBtsSupported;
extern UINTN mMsrDsAreaSize;
extern BOOLEAN mAcpiS3Enable;
+extern BOOLEAN mSmmReadyToLock;
#define PAGE_TABLE_POOL_ALIGNMENT BASE_128KB
#define PAGE_TABLE_POOL_UNIT_SIZE BASE_128KB
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index 5f126a5f23..22b0de13c7 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -12,6 +12,38 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "PiSmmCpuCommon.h"
/**
+ SMM Ready To Lock event notification handler.
+
+ mSmmReadyToLock is set to perform additional lock actions that must be
+ performed from SMM on the next SMI.
+
+ @param[in] Protocol Points to the protocol's unique identifier.
+ @param[in] Interface Points to the interface instance.
+ @param[in] Handle The handle on which the interface was installed.
+
+ @retval EFI_SUCCESS Notification handler runs successfully.
+ **/
+EFI_STATUS
+EFIAPI
+SmmReadyToLockEventNotify (
+ IN CONST EFI_GUID *Protocol,
+ IN VOID *Interface,
+ IN EFI_HANDLE Handle
+ )
+{
+ //
+ // Cache a copy of UEFI memory map before we start profiling feature.
+ //
+ GetUefiMemoryMap ();
+
+ //
+ // Set SMM ready to lock flag and return
+ //
+ mSmmReadyToLock = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
Get SmmCpuSyncConfig data: RelaxedMode, SyncTimeout, SyncTimeout2.
@param[in,out] RelaxedMode It indicates if Relaxed CPU synchronization method or
@@ -149,6 +181,7 @@ PiCpuSmmEntry ( )
{
EFI_STATUS Status;
+ VOID *Registration;
//
// Save the PcdPteMemoryEncryptionAddressOrMask value into a global variable.
@@ -182,5 +215,15 @@ PiCpuSmmEntry ( ASSERT_EFI_ERROR (Status);
}
+ //
+ // Register SMM Ready To Lock Protocol notification
+ //
+ Status = gMmst->MmRegisterProtocolNotify (
+ &gEfiSmmReadyToLockProtocolGuid,
+ SmmReadyToLockEventNotify,
+ &Registration
+ );
+ ASSERT_EFI_ERROR (Status);
+
return Status;
}
|