diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
index 790fccf4009..780e2c27b93 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
@@ -112,7 +112,7 @@
   #
   # Platform
   #
-  TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
+  TimerLib|UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf
 
   #
   # Misc
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
index 600a9565370..1641d7eec51 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
@@ -40,14 +40,25 @@
   #
   # Real variables for stages 5+
   #
-  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
+    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf {
+      <LibraryClasses>
+        NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+        NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLibStandaloneMm.inf
+    }
+
+  !else
+    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
+    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
+      <LibraryClasses>
+        NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+        NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf
+        NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf
+    }
+  !endif
+
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
-  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
-    <LibraryClasses>
-      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
-      NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf
-      NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf
-  }
 
   MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
 
@@ -126,21 +137,33 @@
       PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
 
-  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
-  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf
+    StandaloneMmPkg/Core/StandaloneMmCore.inf {
+      <LibraryClasses>
+        DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+        HobPrintLib|MdeModulePkg/Library/HobPrintLib/HobPrintLib.inf
+    }
+
+    MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterStandaloneMm.inf
+    MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf
+    UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
+    MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.inf
+  !else
+    MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+    MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
+
+    MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf
+    MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
+    UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
+    MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
+    MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
+  !endif
 
-  MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf
-  MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
-
-  #UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
-
-  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
   MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
-  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
 
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
-  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE
@@ -155,7 +178,12 @@
       NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
       NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
   }
-  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf
+  !else
+    SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
+  !endif
+
   SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
   SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
 !endif
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
index 3b9cf101f18..a18a2a1bb0a 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
@@ -24,7 +24,11 @@
 
   HstiLib|MdePkg/Library/DxeHstiLib/DxeHstiLib.inf
 
-  LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
+  !else
+    LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf
+  !endif
 
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -93,6 +97,31 @@
   VariableReadLib|MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf
   VariableWriteLib|MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf
 
+[LibraryClasses.common.MM_STANDALONE]
+  MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
+  ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf
+  HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
+  StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+  MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
+  SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
+  MmSaveStateLib|UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
+  SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
+  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
+
+[LibraryClasses.common.MM_CORE_STANDALONE]
+  HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+  ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
+  FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf
+  MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
+  MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
+  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+  MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+
 [LibraryClasses.common.SMM_CORE]
   MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
   SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
index b5d5d009318..bd16a9e1cd1 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
@@ -28,7 +28,11 @@
   ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
   ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibBase.inf
-  LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
+  !else
+    LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
+  !endif
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE
@@ -64,3 +68,4 @@
 
   SmmRelocationLib|UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf
   SmmControlLib|IntelSiliconPkg/Feature/SmmControl/Library/PeiSmmControlLib/PeiSmmControlLib.inf
+  MmUnblockMemoryLib|UefiCpuPkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLib.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf
index 64bfcd9745c..f6612f9e81f 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf
+++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf
@@ -8,26 +8,44 @@
 ##
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
-INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
-INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
-INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
+  INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
+    INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
+  !else
+    INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
+    INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
+  !endif
 !endif
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
-INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
-INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
-INF  MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf
-INF  MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
-#INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
-INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
-INF  MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
-INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
+  INF  MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  StandaloneMmPkg/Core/StandaloneMmCore.inf
+    INF  StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf
+
+    INF  MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterStandaloneMm.inf
+    INF  MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf
+    INF  UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
+  !else
+    INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+    INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
+
+    INF  MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf
+    INF  MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
+    INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
+    INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
+  !endif
 !endif
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
-INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
-INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
-INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+  INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
+  INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.inf
+  !else
+    INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
+  !endif
 !endif
 
diff --git a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf
index 3edc878e173..6d3e6fadeec 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf
+++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf
@@ -12,9 +12,13 @@ INF  SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.i
 !endif
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE
-INF  SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
-INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
-INF  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
-INF  RuleOverride = DRIVER_ACPITABLE SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
-INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+  INF  SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
+  INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+  INF  RuleOverride = DRIVER_ACPITABLE SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
+  INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf
+  !else
+    INF  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
+  !endif
 !endif
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 09312d32924..67965d3e245 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -425,3 +425,4 @@
   gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable             |FALSE|BOOLEAN|0xF00000A5
   gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable      |FALSE|BOOLEAN|0xF00000A7
   gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable   |FALSE|BOOLEAN|0xF00000B0
+  gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable     |FALSE|BOOLEAN|0xF00000B1
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 405a3afb01e..7ff85ddf1c5 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -97,6 +97,7 @@
   TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  MmUnblockMemoryLib|UefiCpuPkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   #
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 95214a63339..2880e4743b5 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -100,6 +100,7 @@
   CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
+  StandaloneMmMemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
 
   #####################################
   # Platform Package
@@ -150,6 +151,11 @@
   TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
   SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf
 
+  #######################################
+  # Board Package
+  #######################################
+  MmPlatformHobProducerLib|$(BOARD_PKG)/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.inf
+
 [LibraryClasses.common.DXE_DRIVER]
 
   #####################################
@@ -163,7 +169,7 @@
   BoardBdsHookLib|$(BOARD_PKG)/Library/BoardBdsHookLib/BoardBdsHookLib.inf
   BoardBootManagerLib|$(BOARD_PKG)/Library/BoardBootManagerLib/BoardBootManagerLib.inf
 
-[LibraryClasses.common.DXE_SMM_DRIVER]
+[LibraryClasses.common.DXE_SMM_DRIVER, LibraryClasses.common.MM_STANDALONE]
   #######################################
   # Silicon Initialization Package
   #######################################
@@ -178,10 +184,7 @@
   #######################################
   #  S3 SMM driver
   #  @todo: UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
-  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {
-    <LibraryClasses>
-      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
-  }
+  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
 
   #######################################
   # Silicon Initialization Package
@@ -243,9 +246,20 @@
   MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
   UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
-  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.inf
+  !else
+    UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+  !endif
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf {
+      <LibraryClasses>
+        NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+        NULL|StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf
+    }
+  !endif
 
   ShellPkg/Application/Shell/Shell.inf {
     <PcdsFixedAtBuild>
@@ -278,18 +292,26 @@
   # Silicon Initialization Package
   #######################################
   SimicsIch10BinPkg/UndiBinary/UndiDxe.inf
-!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
-  $(PCH_PKG)/SmmControl/RuntimeDxe/SmmControl2Dxe.inf
-  $(PCH_PKG)/Spi/Smm/PchSpiSmm.inf
-  IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
-  IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
-!endif
+  !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
+    $(PCH_PKG)/SmmControl/RuntimeDxe/SmmControl2Dxe.inf
+    IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
+    !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+      $(PCH_PKG)/Spi/Smm/PchSpiStandaloneMm.inf
+      IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
+    !else
+      $(PCH_PKG)/Spi/Smm/PchSpiSmm.inf
+      IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+    !endif
+  !endif
 
   #####################################
   # Platform Package
   #####################################
   $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitDxe/PlatformInitDxe.inf
-  $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+  !else
+    $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
+  !endif
 
   #######################################
   # Board Package
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index ceace433a69..3db28d86865 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -204,7 +204,6 @@ INF  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
 
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
-INF  IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
 INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 INF  BoardModulePkg/LegacySioDxe/LegacySioDxe.inf
 INF  BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
@@ -219,9 +218,18 @@ INF  RuleOverride=ACPITABLE $(BOARD_PKG)/AcpiTables/AcpiTables.inf
 
 INF $(BOARD_PKG)/SimicsVideoDxe/SimicsVideoDxe.inf
 INF  MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.inf
-INF  MinPlatformPkg/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
 INF  $(BOARD_PKG)/SimicsDxe/SimicsDxe.inf
 
+!if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+  #INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.inf
+  INF  StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf
+  INF  IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
+!else
+  #INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+  INF  IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+  INF  MinPlatformPkg/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
+!endif
+
 FILE FREEFORM = 7BB28B99-61BB-11D5-9A5D-0090273FC14D {
   SECTION RAW = $(BOARD_PKG)/Logo/Logo.bmp
 }
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgBuildOption.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgBuildOption.dsc
index 25998b83e7f..f729ff29b05 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgBuildOption.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgBuildOption.dsc
@@ -76,3 +76,7 @@
 #[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
 #  MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096
 #  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+
+[BuildOptions.common.EDKII.MM_CORE_STANDALONE, BuildOptions.common.EDKII.MM_STANDALONE]
+  MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
+  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 /FILEALIGN:4096
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
index 6ca06d56ba7..20f0f66256f 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
@@ -32,6 +32,10 @@
   ######################################
   # Edk2 Configuration
   ######################################
+  #
+  # For X64, PcdCpuSmmRestrictedMemoryAccess must be FALSE if PcdCpuSmmProfileEnable is TRUE.
+  #
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileEnable|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
 !if $(PEI_ARCH) == "IA32" && $(DXE_ARCH) == "X64"
@@ -46,6 +50,7 @@
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE
   gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|FALSE
   gUefiCpuPkgTokenSpaceGuid.PcdSmrrEnable|TRUE
+  gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable|TRUE
 
   ######################################
   # Platform Configuration
@@ -200,6 +205,9 @@
   gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear|2015
   gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2099
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable |TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmRestrictedMemoryAccess|TRUE
 
  [PcdsPatchableInModule.common]
   ######################################
@@ -219,8 +227,6 @@
   # Edk2 Configuration
   ######################################
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
-  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
 
diff --git a/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.c b/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.c
new file mode 100644
index 00000000000..cff8dd075d7
--- /dev/null
+++ b/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.c
@@ -0,0 +1,340 @@
+/** @file
+  Instance of MM Platform HOB Producer Library Class.
+
+  CreateMmPlatformHob() function is called by StandaloneMm IPL to create all
+  Platform specific HOBs that required by Standalone MM environment. In this
+  library instance, a list of ResourceDescriptorHob are generated to report
+  MMIO ranges. All memory ranges except SMRAM and EFI_RESOURCE_SYSTEM_MEMORY
+  type memory ranges are treated as MMIO.
+
+  Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <PiPei.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BaseLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/HobLib.h>
+#include <Library/MmPlatformHobProducerLib.h>
+
+#include <Guid/SmramMemoryReserve.h>
+
+typedef struct {
+  EFI_PHYSICAL_ADDRESS    Base;
+  UINT64                  Length;
+} MM_PLATFORM_MEMORY_REGION;
+
+/**
+  Initialize the EFI_HOB_GENERIC_HEADER based on input Hob.
+
+  @param[in] Hob          Pointer to the new HOB buffer.
+  @param[in] HobType      Type of the new HOB.
+  @param[in] HobLength    Length of the new HOB to allocate.
+
+**/
+VOID
+MmCreateHob (
+  IN VOID    *Hob,
+  IN UINT16  HobType,
+  IN UINT16  HobLength
+  )
+{
+  //
+  // Check Length to avoid data overflow.
+  //
+  ASSERT (HobLength < MAX_UINT16 - 0x7);
+
+  ((EFI_HOB_GENERIC_HEADER *)Hob)->HobType   = HobType;
+  ((EFI_HOB_GENERIC_HEADER *)Hob)->HobLength = HobLength;
+  ((EFI_HOB_GENERIC_HEADER *)Hob)->Reserved  = 0;
+}
+
+/**
+  Builds a EFI_HOB_TYPE_RESOURCE_DESCRIPTOR HOB.
+
+  @param[in] Hob                 Pointer to the new HOB buffer.
+  @param[in] ResourceType        The type of resource described by this HOB.
+  @param[in] ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param[in] PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param[in] NumberOfBytes       The length of the memory described by this HOB in bytes.
+
+**/
+VOID
+MmBuildResourceDescriptorHob (
+  IN EFI_HOB_RESOURCE_DESCRIPTOR  *Hob,
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes
+  )
+{
+  ASSERT (Hob != NULL);
+  MmCreateHob (Hob, EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
+
+  Hob->ResourceType      = ResourceType;
+  Hob->ResourceAttribute = ResourceAttribute;
+  Hob->PhysicalStart     = PhysicalStart;
+  Hob->ResourceLength    = NumberOfBytes;
+}
+
+/**
+  Calculate the maximum support address.
+
+  @return the maximum support address.
+**/
+static
+UINT8
+MmCalculateMaximumSupportAddress (
+  VOID
+  )
+{
+  UINT32  RegEax;
+  UINT8   PhysicalAddressBits;
+  VOID    *Hob;
+
+  //
+  // Get physical address bits supported.
+  //
+  Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
+  if (Hob != NULL) {
+    PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
+  } else {
+    AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
+    if (RegEax >= 0x80000008) {
+      AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
+      PhysicalAddressBits = (UINT8)RegEax;
+    } else {
+      PhysicalAddressBits = 36;
+    }
+  }
+
+  return PhysicalAddressBits;
+}
+
+/**
+  Builds resource HOB list for all MMIO range.
+
+  This function treats all all ranges outside the system memory range and smram range
+  as mmio and builds resource HOB list for all MMIO range.
+
+  @param[in] Create        FALSE to indicate Buffer is not used and the return buffer size
+                           is increased by the required buffer size.
+  @param[in] MemoryRegion  MM_PLATFORM_MEMORY_REGION that describes all system memory range.
+  @param[in] Count         Number of MM_PLATFORM_MEMORY_REGION.
+  @param[in] Buffer        The pointer of new HOB buffer.
+
+  @return The expected/used buffer size.
+**/
+UINTN
+MmBuildHobForMmio (
+  IN BOOLEAN                    Create,
+  IN MM_PLATFORM_MEMORY_REGION  *MemoryRegion,
+  IN UINTN                      Count,
+  IN UINT8                      *Buffer
+  )
+{
+  UINT64  PreviousAddress;
+  UINT64  Base;
+  UINT64  Limit;
+  UINT8   PhysicalAddressBits;
+  UINTN   Index;
+  UINTN   BufferSize;
+
+  Index               = 0;
+  PreviousAddress     = 0;
+  PhysicalAddressBits = MmCalculateMaximumSupportAddress ();
+  Limit               = LShiftU64 (1, PhysicalAddressBits);
+  BufferSize          = 0;
+
+  for (Index = 0; Index <= Count; Index++) {
+    //
+    // When Index is equal to Count, Base covers the very last region.
+    //
+    Base = (Index == Count) ? Limit : MemoryRegion[Index].Base;
+    if (Base > PreviousAddress) {
+      if (Create) {
+        MmBuildResourceDescriptorHob (
+          (EFI_HOB_RESOURCE_DESCRIPTOR *)(Buffer + BufferSize),
+          EFI_RESOURCE_MEMORY_MAPPED_IO,
+          0,
+          PreviousAddress,
+          Base - PreviousAddress
+          );
+      }
+
+      BufferSize += sizeof (EFI_HOB_RESOURCE_DESCRIPTOR);
+    }
+
+    if (Index < Count) {
+      PreviousAddress = MemoryRegion[Index].Base + MemoryRegion[Index].Length;
+    }
+  }
+
+  return BufferSize;
+}
+
+/**
+  Function to compare 2 MM_PLATFORM_MEMORY_REGION pointer based on Base.
+
+  @param[in] Buffer1  pointer to MP_INFORMATION2_HOB_DATA poiner to compare
+  @param[in] Buffer2  pointer to second MP_INFORMATION2_HOB_DATA pointer to compare
+
+  @retval 0   Buffer1 equal to Buffer2
+  @retval <0  Buffer1 is less than Buffer2
+  @retval >0  Buffer1 is greater than Buffer2
+**/
+static
+INTN
+EFIAPI
+MmMemoryDescriptorCompare (
+  IN  CONST VOID  *Buffer1,
+  IN  CONST VOID  *Buffer2
+  )
+{
+  if (((MM_PLATFORM_MEMORY_REGION *)Buffer1)->Base > ((MM_PLATFORM_MEMORY_REGION *)Buffer2)->Base) {
+    return 1;
+  } else if (((MM_PLATFORM_MEMORY_REGION *)Buffer1)->Base < ((MM_PLATFORM_MEMORY_REGION *)Buffer2)->Base) {
+    return -1;
+  }
+
+  return 0;
+}
+
+/**
+  Create the platform specific HOBs needed by the Standalone MM environment.
+
+  The following HOBs are created by StandaloneMm IPL common logic.
+  Hence they should NOT be created by this function:
+  * Single EFI_HOB_TYPE_FV to describe the Firmware Volume where MM Core resides.
+  * Single GUIDed (gEfiSmmSmramMemoryGuid) HOB to describe the MM regions.
+  * Single EFI_HOB_MEMORY_ALLOCATION_MODULE to describe the MM region used by MM Core.
+  * Multiple EFI_HOB_RESOURCE_DESCRIPTOR to describe the non-MM regions and their access permissions.
+    Note: All accessible non-MM regions should be described by EFI_HOB_RESOURCE_DESCRIPTOR HOBs.
+  * Single GUIDed (gMmCommBufferHobGuid) HOB to identify MM Communication buffer in non-MM region.
+  * Multiple GUIDed (gSmmBaseHobGuid) HOB to describe the SMM base address of each processor.
+  * Multiple GUIDed (gMpInformation2HobGuid) HOB to describe the MP information.
+  * Single GUIDed (gMmCpuSyncConfigHobGuid) HOB to describe how BSP synchronizes with APs in x86 SMM.
+  * Single GUIDed (gMmAcpiS3EnableHobGuid) HOB to describe the ACPI S3 enable status.
+  * Single GUIDed (gEfiAcpiVariableGuid) HOB to identify the S3 data root region in x86.
+  * Single GUIDed (gMmProfileDataHobGuid) HOB to describe the MM profile data region.
+
+  @param[in]      Buffer            The free buffer to be used for HOB creation.
+  @param[in, out] BufferSize        The buffer size.
+                                    On return, the expected/used size.
+
+  @retval RETURN_INVALID_PARAMETER  BufferSize is NULL.
+  @retval RETURN_INVALID_PARAMETER  Buffer is NULL and BufferSize is not 0.
+  @retval RETURN_BUFFER_TOO_SMALL   The buffer is too small for HOB creation.
+                                    BufferSize is updated to indicate the expected buffer size.
+                                    When the input BufferSize is bigger than the expected buffer size,
+                                    the BufferSize value will be changed to the used buffer size.
+  @retval RETURN_SUCCESS            The HOB list is created successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateMmPlatformHob (
+  IN VOID       *Buffer,
+  IN OUT UINTN  *BufferSize
+  )
+{
+  EFI_PEI_HOB_POINTERS            Hob;
+  EFI_PEI_HOB_POINTERS            FirstResHob;
+  UINTN                           Count;
+  UINTN                           Index;
+  MM_PLATFORM_MEMORY_REGION       *MemoryRegion;
+  MM_PLATFORM_MEMORY_REGION       SortBuffer;
+  UINTN                           RequiredSize;
+  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *SmramHob;
+
+  if (BufferSize == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  if ((*BufferSize != 0) && (Buffer == NULL)) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  Count        = 0;
+  RequiredSize = 0;
+
+  //
+  // Count the Resource HOB number
+  //
+  Hob.Raw     = GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR);
+  FirstResHob = Hob;
+  while (Hob.Raw != NULL) {
+    if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
+      Count++;
+    }
+
+    Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, GET_NEXT_HOB (Hob));
+  }
+
+  //
+  // Count the gEfiSmmSmramMemoryGuid Descriptor number
+  //
+  Hob.Raw = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
+  ASSERT (Hob.Raw != NULL);
+  SmramHob = GET_GUID_HOB_DATA (Hob.Raw);
+  Count   += SmramHob->NumberOfSmmReservedRegions;
+
+  MemoryRegion = AllocatePool (Count * sizeof (MM_PLATFORM_MEMORY_REGION));
+  ASSERT (MemoryRegion != NULL);
+
+  //
+  // Cache gEfiSmmSmramMemoryGuid Descriptor
+  //
+  Index = 0;
+  while (Index < SmramHob->NumberOfSmmReservedRegions) {
+    MemoryRegion[Index].Base   = SmramHob->Descriptor[Index].PhysicalStart;
+    MemoryRegion[Index].Length = SmramHob->Descriptor[Index].PhysicalSize;
+    Index++;
+  }
+
+  //
+  // Cache resource HOB
+  //
+  Hob = FirstResHob;
+  while (Hob.Raw != NULL) {
+    if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
+      MemoryRegion[Index].Base   = Hob.ResourceDescriptor->PhysicalStart;
+      MemoryRegion[Index].Length = Hob.ResourceDescriptor->ResourceLength;
+      Index++;
+    }
+
+    Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, GET_NEXT_HOB (Hob));
+  }
+
+  ASSERT (Index == Count);
+
+  //
+  // Perform QuickSort for all MM_PLATFORM_MEMORY_REGION range for calculating the MMIO
+  //
+  QuickSort (MemoryRegion, Count, sizeof (MM_PLATFORM_MEMORY_REGION), (BASE_SORT_COMPARE)MmMemoryDescriptorCompare, &SortBuffer);
+
+  //
+  // Calculate needed buffer size.
+  //
+  RequiredSize = MmBuildHobForMmio (FALSE, MemoryRegion, Count, NULL);
+
+  if (*BufferSize < RequiredSize) {
+    *BufferSize = RequiredSize;
+    FreePool (MemoryRegion);
+    return EFI_BUFFER_TOO_SMALL;
+  }
+
+  //
+  // Build resource HOB for MMIO range.
+  //
+  *BufferSize = MmBuildHobForMmio (TRUE, MemoryRegion, Count, Buffer);
+  FreePool (MemoryRegion);
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.inf b/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.inf
new file mode 100644
index 00000000000..6b1d9105581
--- /dev/null
+++ b/Platform/Intel/SimicsOpenBoardPkg/Library/MmPlatformHobProducerLib/MmPlatformHobProducerLib.inf
@@ -0,0 +1,40 @@
+## @file
+# Instance of MM Platform HOB Producer Library Class.
+#
+# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = MmPlatformHobProducerLib
+  FILE_GUID                      = 98700A68-CB99-4B2A-97DC-F0A0C8755EE7
+  MODULE_TYPE                    = PEIM
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = MmPlatformHobProducerLib
+
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  MmPlatformHobProducerLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
+  SimicsOpenBoardPkg/OpenBoardPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
+  HobLib
+
+[Guids]
+  gEfiSmmSmramMemoryGuid
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
index 28dff3f702c..ac07b914757 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
@@ -484,7 +484,6 @@ ReserveEmuVariableNvStore (
           VariableStore,
           (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024
         ));
-  PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
 }
 
 
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
index c26b400d536..f9405a78405 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
@@ -85,7 +85,6 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
-  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
diff --git a/Silicon/Intel/SimicsIch10Pkg/IchUefiBootInclude.fdf b/Silicon/Intel/SimicsIch10Pkg/IchUefiBootInclude.fdf
index 8211a8a6274..ed345ec5ccc 100644
--- a/Silicon/Intel/SimicsIch10Pkg/IchUefiBootInclude.fdf
+++ b/Silicon/Intel/SimicsIch10Pkg/IchUefiBootInclude.fdf
@@ -9,5 +9,9 @@
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
   INF  $(PCH_PKG)/SmmControl/RuntimeDxe/SmmControl2Dxe.inf
-  INF  $(PCH_PKG)/Spi/Smm/PchSpiSmm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  $(PCH_PKG)/Spi/Smm/PchSpiStandaloneMm.inf
+  !else
+    INF  $(PCH_PKG)/Spi/Smm/PchSpiSmm.inf
+  !endif
 !endif
diff --git a/Silicon/Intel/SimicsX58SktPkg/SktUefiBootInclude.fdf b/Silicon/Intel/SimicsX58SktPkg/SktUefiBootInclude.fdf
index 42c8408c05c..28d970912e4 100644
--- a/Silicon/Intel/SimicsX58SktPkg/SktUefiBootInclude.fdf
+++ b/Silicon/Intel/SimicsX58SktPkg/SktUefiBootInclude.fdf
@@ -9,6 +9,10 @@
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
   INF  IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
-  INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE
+    INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.inf
+  !else
+    INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+  !endif
 !endif
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf