From 2ef927eadb1b8cd4d97a0b5c0a20236cd4b27bd0 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Sat, 22 Jun 2024 14:58:04 +0800 Subject: [PATCH 1/8] Platform/Intel: Force PE/COFF sections 4KB aligned Force PE/COFF sections to be aligned at 4KB boundaries to support MemoryAttribute table. Signed-off-by: Jiaxin Wu --- .../BoardX58Ich10/OpenBoardPkgBuildOption.dsc | 4 ++++ 1 file changed, 4 insertions(+) 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 From 540f410e825eb8df865fc40fde0a6ccfc6c7b28b Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Sat, 22 Jun 2024 14:02:07 +0800 Subject: [PATCH 2/8] Platform/Intel: Update dynamic PCD to fixed PCD for MM_STANDALONE This patch changes below dynamic PCD to fixed PCD for MM_STANDALONE: gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 Signed-off-by: Jiaxin Wu --- .../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 4 ++-- Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c | 1 - Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc index 6ca06d56ba7..9337044b4f3 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc @@ -200,6 +200,8 @@ gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear|2015 gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2099 gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable |TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 [PcdsPatchableInModule.common] ###################################### @@ -219,8 +221,6 @@ # Edk2 Configuration ###################################### gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE - gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 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 From c5a44b276186547cb9c89731c43e39250c7f5d11 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Mon, 24 Jun 2024 13:32:48 +0800 Subject: [PATCH 3/8] Platform/Intel: Restart MM Dispatcher once MM Entry Point is registered Enable PcdRestartMmDispatcherOnceMmEntryRegistered PCD Signed-off-by: Jiaxin Wu --- .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc index 9337044b4f3..54b9e1bc5c6 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc @@ -77,6 +77,8 @@ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|TRUE gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable|TRUE + gStandaloneMmPkgTokenSpaceGuid.PcdRestartMmDispatcherOnceMmEntryRegistered|TRUE + [PcdsFeatureFlag.X64] ###################################### # Edk2 Configuration From a44c2e4e4a4d3dd29e1b35668c0628228005c3a8 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Sat, 22 Jun 2024 11:23:19 +0800 Subject: [PATCH 4/8] Platform/Intel: Add PcdStandaloneMmEnable feature PCD Add PcdStandaloneMmEnable feature PCD, default set to FALSE. Signed-off-by: Jiaxin Wu --- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 1 + .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 1 + 2 files changed, 2 insertions(+) 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/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc index 54b9e1bc5c6..df588fb0319 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc @@ -46,6 +46,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|FALSE gUefiCpuPkgTokenSpaceGuid.PcdSmrrEnable|TRUE + gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable|FALSE ###################################### # Platform Configuration From 763739080b7049a82482630788252edcb5475f3e Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Sat, 22 Jun 2024 14:09:53 +0800 Subject: [PATCH 5/8] Silicon/Intel: Include required StandaloneMm drivers Include required StandaloneMm drivers under PcdStandaloneMmEnable PCD. Signed-off-by: Jiaxin Wu --- Silicon/Intel/SimicsIch10Pkg/IchUefiBootInclude.fdf | 6 +++++- Silicon/Intel/SimicsX58SktPkg/SktUefiBootInclude.fdf | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 From ebd866ecad4445bb37c6b1ff0ea9e5e8fa8e5c1e Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Sat, 22 Jun 2024 14:11:19 +0800 Subject: [PATCH 6/8] Platform/Intel: Include required StandaloneMm modules Include required StandaloneMm Drivers and Libs under PcdStandaloneMmEnable PCD. Change the PcdStandaloneMmEnable to TRUE to enable the MM on QSP. Signed-off-by: Jiaxin Wu --- .../Include/Dsc/CoreCommonLib.dsc | 2 +- .../Include/Dsc/CoreDxeInclude.dsc | 64 +++++++++++++------ .../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 31 ++++++++- .../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc | 7 +- .../Include/Fdf/CoreOsBootInclude.fdf | 48 +++++++++----- .../Include/Fdf/CoreSecurityLateInclude.fdf | 14 ++-- .../Intel/MinPlatformPkg/MinPlatformPkg.dsc | 1 + .../BoardX58Ich10/OpenBoardPkg.dsc | 43 +++++++++---- .../BoardX58Ich10/OpenBoardPkg.fdf | 12 +++- .../BoardX58Ich10/OpenBoardPkgPcd.dsc | 4 +- 10 files changed, 169 insertions(+), 57 deletions(-) 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 { + + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLibStandaloneMm.inf + } + + !else + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { + + 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 { - - 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 { + + 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.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..bc3f3f4cc92 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 @@ -163,7 +164,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 +179,7 @@ ####################################### # S3 SMM driver # @todo: UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf - UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf { - - LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf - } + UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf ####################################### # Silicon Initialization Package @@ -243,9 +241,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 { + + NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf + NULL|StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf + } + !endif ShellPkg/Application/Shell/Shell.inf { @@ -278,18 +287,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/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc index df588fb0319..0dcc5b99f0d 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc @@ -46,7 +46,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|FALSE gUefiCpuPkgTokenSpaceGuid.PcdSmrrEnable|TRUE - gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable|FALSE + gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable|TRUE ###################################### # Platform Configuration @@ -78,7 +78,9 @@ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|TRUE gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable|TRUE +!if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE gStandaloneMmPkgTokenSpaceGuid.PcdRestartMmDispatcherOnceMmEntryRegistered|TRUE +!endif [PcdsFeatureFlag.X64] ###################################### From e22f50995198a75ad45650d7829657774128c4ef Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Wed, 7 Aug 2024 13:48:03 +0800 Subject: [PATCH 7/8] Platform/Intel: Add SmmProfile enable/disable control for QSP Add PcdCpuSmmProfileEnable & PcdCpuSmmRestrictedMemoryAccess for the SmmProfile enable/disable control for QSP. Signed-off-by: Jiaxin Wu --- .../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc index 0dcc5b99f0d..1ebd945954e 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" @@ -207,6 +211,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable |TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmRestrictedMemoryAccess|TRUE [PcdsPatchableInModule.common] ###################################### From d72886c378fca333a75c723c12028bfe24982ab5 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Thu, 8 Aug 2024 16:09:33 +0800 Subject: [PATCH 8/8] Platform/Intel: Override BaseMemoryLib if SMM profile enable The instructions in BaseMemoryLibRepStr could potentially trigger multiple #PF (Page Faults) before the Debug Trap handler is invoked if the size of the memory being copied exceeds 8KB. This would result in the number of recorded old entries bigger than the MAX_PF_ENTRY_COUNT limit of 10. The relevant instructions are: mov rcx, r8 and r8, 7 shr rcx, 3 rep movsq To prevent this issue, override the BaseMemoryLib with BaseMemoryLibSse2 when the SMM profile is enabled. This change avoids the use of the "rep movsq" instruction, which is the source of the problem. Signed-off-by: Jiaxin Wu --- .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc index bc3f3f4cc92..4a7dce7bab2 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc @@ -121,6 +121,10 @@ PlatformCmosAccessLib|BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.inf CmosAccessLib|BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf +!if gMinPlatformPkgTokenSpaceGuid.PcdStandaloneMmEnable == TRUE && gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileEnable == TRUE + BaseMemoryLib|MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf +!endif + [LibraryClasses.common.SEC] ####################################### # Edk2 Packages