diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2025-03-20 16:43:24 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-03-27 02:28:30 +0000 |
commit | 5c6fea49ee582fa1fbb66396acc7609f38446865 (patch) | |
tree | 64e31a19e121c50171920e762c730b91b25e1d44 | |
parent | b7ef7171779f8446203f3c5dc4b3db20af813ee6 (diff) | |
download | edk2-5c6fea49ee582fa1fbb66396acc7609f38446865.zip edk2-5c6fea49ee582fa1fbb66396acc7609f38446865.tar.gz edk2-5c6fea49ee582fa1fbb66396acc7609f38446865.tar.bz2 |
StandaloneMmPkg: Produce gMmStatusCodeUseSerialHobGuid HOB
Produce gMmStatusCodeUseSerialHobGuid as MM Foundation HOB to
describe the status code use serial port or not.
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
4 files changed, 49 insertions, 0 deletions
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c index 2f02920..96e0416 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c @@ -13,6 +13,7 @@ #include <Guid/MmCpuSyncConfig.h>
#include <Guid/MmProfileData.h>
#include <Guid/MmUnblockRegion.h>
+#include <Guid/MmStatusCodeUseSerial.h>
#include <Register/Intel/Cpuid.h>
#include <Register/Intel/ArchitecturalMsr.h>
@@ -208,6 +209,43 @@ MmIplBuildMmCpuSyncConfigHob ( }
/**
+ Builds MM Status Code Use Serial HOB.
+
+ This function builds MM Status Code Use Serial HOB.
+ It can only be invoked during PEI phase;
+ If new HOB buffer is NULL, then ASSERT().
+
+ @param[in] Hob The pointer of new HOB buffer.
+ @param[in, out] HobBufferSize The available size of the HOB buffer when as input.
+ The used size of when as output.
+
+**/
+VOID
+MmIplBuildMmStatusCodeUseSerialHob (
+ IN UINT8 *Hob,
+ IN OUT UINTN *HobBufferSize
+ )
+{
+ EFI_HOB_GUID_TYPE *GuidHob;
+ MM_STATUS_CODE_USE_SERIAL *MmStatusCodeUseSerial;
+ UINT16 HobLength;
+
+ HobLength = ALIGN_VALUE (sizeof (EFI_HOB_GUID_TYPE) + sizeof (MM_STATUS_CODE_USE_SERIAL), 8);
+ if (*HobBufferSize >= HobLength) {
+ ASSERT (Hob != NULL);
+ MmIplCreateHob (Hob, EFI_HOB_TYPE_GUID_EXTENSION, HobLength);
+
+ GuidHob = (EFI_HOB_GUID_TYPE *)Hob;
+ CopyGuid (&GuidHob->Name, &gMmStatusCodeUseSerialHobGuid);
+
+ MmStatusCodeUseSerial = (MM_STATUS_CODE_USE_SERIAL *)(GuidHob + 1);
+ MmStatusCodeUseSerial->StatusCodeUseSerial = PcdGetBool (PcdStatusCodeUseSerial);
+ }
+
+ *HobBufferSize = HobLength;
+}
+
+/**
Copies a data buffer to a newly-built HOB for GUID HOB
This function builds a customized HOB tagged with a GUID for identification, copies the
@@ -958,6 +996,13 @@ CreateMmFoundationHobList ( UsedSize += HobLength;
//
+ // Build MM Status Code Use Serial HOB
+ //
+ HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
+ MmIplBuildMmStatusCodeUseSerialHob (FoundationHobList + UsedSize, &HobLength);
+ UsedSize += HobLength;
+
+ //
// Build CPU SMM base HOB in MM HOB list
//
HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf index f07f26e..0341a98 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf +++ b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.inf @@ -56,6 +56,7 @@ gMmCpuSyncConfigHobGuid
gMmProfileDataHobGuid
gMmUnblockRegionHobGuid
+ gMmStatusCodeUseSerialHobGuid
[Ppis]
gEfiPeiMmControlPpiGuid
@@ -69,6 +70,7 @@ [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdMmCommBufferPages
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout2 ## CONSUMES
diff --git a/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h b/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h index 2f302bb..ec01152 100644 --- a/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h +++ b/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h @@ -30,6 +30,7 @@ * 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.
+ * Single GUIDed (gMmStatusCodeUseSerialHobGuid) HOB to describe the status code use serial port.
@param[in] Buffer The free buffer to be used for HOB creation.
@param[in, out] BufferSize The buffer size.
diff --git a/StandaloneMmPkg/Library/MmPlatformHobProducerLibNull/MmPlatformHobProducerLibNull.c b/StandaloneMmPkg/Library/MmPlatformHobProducerLibNull/MmPlatformHobProducerLibNull.c index 814ea1c..79f55d5 100644 --- a/StandaloneMmPkg/Library/MmPlatformHobProducerLibNull/MmPlatformHobProducerLibNull.c +++ b/StandaloneMmPkg/Library/MmPlatformHobProducerLibNull/MmPlatformHobProducerLibNull.c @@ -31,6 +31,7 @@ * 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.
+ * Single GUIDed (gMmStatusCodeUseSerialHobGuid) HOB to describe the status code use serial port.
@param[in] Buffer The free buffer to be used for HOB creation.
@param[in, out] BufferSize The buffer size.
|