mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
0c037b5fa7
commit
abc2f59523
|
@ -432,38 +432,6 @@ ExecuteFirstSmiInit (
|
|||
PERF_FUNCTION_END ();
|
||||
}
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
|
@ -759,7 +727,6 @@ PiSmmCpuEntryCommon (
|
|||
UINTN TileDataSize;
|
||||
UINTN TileSize;
|
||||
UINT8 *Stacks;
|
||||
VOID *Registration;
|
||||
UINT32 RegEax;
|
||||
UINT32 RegEbx;
|
||||
UINT32 RegEcx;
|
||||
|
@ -1231,16 +1198,6 @@ PiSmmCpuEntryCommon (
|
|||
Status = InitializeSmmCpuServices (mSmmCpuHandle);
|
||||
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
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,6 +11,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.
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue