\r
**/\r
\r
-#include <PiSmm.h>\r
-#include <Library/SmmServicesTableLib.h>\r
-#include <Library/SmmMemLib.h>\r
+#include <PiMm.h>\r
+#include <Library/MmServicesTableLib.h>\r
#include <Library/BaseLib.h>\r
#include <Protocol/SmmSwapAddressRange.h>\r
#include "FaultTolerantWrite.h"\r
#include "FaultTolerantWriteSmmCommon.h"\r
-#include <Protocol/SmmEndOfDxe.h>\r
+#include <Protocol/MmEndOfDxe.h>\r
\r
EFI_EVENT mFvbRegistration = NULL;\r
EFI_FTW_DEVICE *mFtwDevice = NULL;\r
//\r
// To get the SMM FVB protocol interface on the handle\r
//\r
- return gSmst->SmmHandleProtocol (\r
+ return gMmst->MmHandleProtocol (\r
FvBlockHandle,\r
&gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
(VOID **) FvBlock\r
//\r
// Locate Smm Swap Address Range protocol\r
//\r
- Status = gSmst->SmmLocateProtocol (\r
+ Status = gMmst->MmLocateProtocol (\r
&gEfiSmmSwapAddressRangeProtocolGuid,\r
NULL,\r
SarProtocol\r
BufferSize = 0;\r
*NumberHandles = 0;\r
*Buffer = NULL;\r
- Status = gSmst->SmmLocateHandle (\r
+ Status = gMmst->MmLocateHandle (\r
ByProtocol,\r
&gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
NULL,\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Status = gSmst->SmmLocateHandle (\r
+ Status = gMmst->MmLocateHandle (\r
ByProtocol,\r
&gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
NULL,\r
}\r
CommBufferPayloadSize = TempCommBufferSize - SMM_FTW_COMMUNICATE_HEADER_SIZE;\r
\r
- if (!SmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize)) {\r
+ if (!FtwSmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize)) {\r
DEBUG ((EFI_D_ERROR, "SmmFtwHandler: SMM communication buffer in SMRAM or overflow!\n"));\r
return EFI_SUCCESS;\r
}\r
);\r
if (!EFI_ERROR (Status)) {\r
//\r
- // The AsmLfence() call here is to ensure the previous range/content\r
- // checks for the CommBuffer have been completed before calling into\r
- // FtwWrite().\r
+ // The SpeculationBarrier() call here is to ensure the previous\r
+ // range/content checks for the CommBuffer have been completed before\r
+ // calling into FtwWrite().\r
//\r
- AsmLfence ();\r
+ SpeculationBarrier ();\r
Status = FtwWrite(\r
&mFtwDevice->FtwInstance,\r
SmmFtwWriteHeader->Lba,\r
EFI_STATUS Status;\r
EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;\r
EFI_HANDLE SmmFtwHandle;\r
- EFI_HANDLE FtwHandle;\r
\r
//\r
// Just return to avoid install SMM FaultTolerantWriteProtocol again\r
// if SMM Fault Tolerant Write protocol had been installed.\r
//\r
- Status = gSmst->SmmLocateProtocol (\r
+ Status = gMmst->MmLocateProtocol (\r
&gEfiSmmFaultTolerantWriteProtocolGuid,\r
NULL,\r
(VOID **) &FtwProtocol\r
//\r
// Install protocol interface\r
//\r
- Status = gSmst->SmmInstallProtocolInterface (\r
+ Status = gMmst->MmInstallProtocolInterface (\r
&mFtwDevice->Handle,\r
&gEfiSmmFaultTolerantWriteProtocolGuid,\r
EFI_NATIVE_INTERFACE,\r
///\r
/// Register SMM FTW SMI handler\r
///\r
- Status = gSmst->SmiHandlerRegister (SmmFaultTolerantWriteHandler, &gEfiSmmFaultTolerantWriteProtocolGuid, &SmmFtwHandle);\r
+ Status = gMmst->MmiHandlerRegister (SmmFaultTolerantWriteHandler, &gEfiSmmFaultTolerantWriteProtocolGuid, &SmmFtwHandle);\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Notify the Ftw wrapper driver SMM Ftw is ready\r
//\r
- FtwHandle = NULL;\r
- Status = gBS->InstallProtocolInterface (\r
- &FtwHandle,\r
- &gEfiSmmFaultTolerantWriteProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ FtwNotifySmmReady ();\r
\r
return EFI_SUCCESS;\r
}\r
**/\r
EFI_STATUS\r
EFIAPI\r
-SmmEndOfDxeCallback (\r
+MmEndOfDxeCallback (\r
IN CONST EFI_GUID *Protocol,\r
IN VOID *Interface,\r
IN EFI_HANDLE Handle\r
}\r
\r
/**\r
- This function is the entry point of the Fault Tolerant Write driver.\r
-\r
- @param[in] ImageHandle A handle for the image that is initializing this driver\r
- @param[in] SystemTable A pointer to the EFI system table\r
+ Shared entry point of the module\r
\r
@retval EFI_SUCCESS The initialization finished successfully.\r
@retval EFI_OUT_OF_RESOURCES Allocate memory error\r
@retval EFI_INVALID_PARAMETER Workspace or Spare block does not exist\r
-\r
**/\r
EFI_STATUS\r
-EFIAPI\r
-SmmFaultTolerantWriteInitialize (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+MmFaultTolerantWriteInitialize (\r
+ VOID\r
)\r
{\r
EFI_STATUS Status;\r
- VOID *SmmEndOfDxeRegistration;\r
+ VOID *MmEndOfDxeRegistration;\r
\r
//\r
// Allocate private data structure for SMM FTW protocol and do some initialization\r
//\r
// Register EFI_SMM_END_OF_DXE_PROTOCOL_GUID notify function.\r
//\r
- Status = gSmst->SmmRegisterProtocolNotify (\r
- &gEfiSmmEndOfDxeProtocolGuid,\r
- SmmEndOfDxeCallback,\r
- &SmmEndOfDxeRegistration\r
+ Status = gMmst->MmRegisterProtocolNotify (\r
+ &gEfiMmEndOfDxeProtocolGuid,\r
+ MmEndOfDxeCallback,\r
+ &MmEndOfDxeRegistration\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Register FvbNotificationEvent () notify function.\r
//\r
- Status = gSmst->SmmRegisterProtocolNotify (\r
+ Status = gMmst->MmRegisterProtocolNotify (\r
&gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
FvbNotificationEvent,\r
&mFvbRegistration\r