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>
This commit is contained in:
Jiaxin Wu
2025-03-20 16:43:24 +08:00
committed by mergify[bot]
parent b7ef717177
commit 5c6fea49ee
4 changed files with 49 additions and 0 deletions

View File

@@ -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>
@@ -207,6 +208,43 @@ MmIplBuildMmCpuSyncConfigHob (
*HobBufferSize = HobLength;
}
/**
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
@@ -957,6 +995,13 @@ CreateMmFoundationHobList (
MmIplBuildMmCpuSyncConfigHob (FoundationHobList + UsedSize, &HobLength);
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
//

View File

@@ -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

View File

@@ -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.

View File

@@ -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.