summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2022-02-25 11:58:59 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-04-09 18:12:48 +0000
commitc67d975cfca4ecefeba34b593ec35b29d5a313ec (patch)
tree60cccae60d9df2913ca08d87df2a72d61ac19482
parentd23edb21a3571ddbf119fdfac9271022c2873a1b (diff)
downloadedk2-c67d975cfca4ecefeba34b593ec35b29d5a313ec.zip
edk2-c67d975cfca4ecefeba34b593ec35b29d5a313ec.tar.gz
edk2-c67d975cfca4ecefeba34b593ec35b29d5a313ec.tar.bz2
UefiPayloadPkg: Add SmmStoreInfoGuid
Add a new InfoHob that contains the SmmStore information passed from coreboot tables when the SMMSTOREV2 feature is enabled. This will be used to implement the FVB on top of the SMI installed by coreboot. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
-rw-r--r--UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h26
-rw-r--r--UefiPayloadPkg/Include/Library/SmmStoreParseLib.h29
-rw-r--r--UefiPayloadPkg/Library/CbParseLib/CbParseLib.c43
-rw-r--r--UefiPayloadPkg/Library/SblParseLib/SblParseLib.c18
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c13
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h2
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf1
-rw-r--r--UefiPayloadPkg/UefiPayloadPkg.dec2
8 files changed, 134 insertions, 0 deletions
diff --git a/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h b/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h
new file mode 100644
index 0000000..19b4bdc
--- /dev/null
+++ b/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h
@@ -0,0 +1,26 @@
+/** @file
+ This file defines the hob structure for coreboot's SmmStore.
+
+ Copyright (c) 2022, 9elements GmbH<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SMMSTORE_GUID_H_
+#define SMMSTORE_GUID_H_
+
+///
+/// System Table Information GUID
+///
+extern EFI_GUID gEfiSmmStoreInfoHobGuid;
+
+typedef struct {
+ UINT64 ComBuffer;
+ UINT32 ComBufferSize;
+ UINT32 NumBlocks;
+ UINT32 BlockSize;
+ UINT64 MmioAddress;
+ UINT8 ApmCmd;
+} SMMSTORE_INFO;
+
+#endif // SMMSTORE_GUID_H_
diff --git a/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h b/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h
new file mode 100644
index 0000000..ec84aef
--- /dev/null
+++ b/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h
@@ -0,0 +1,29 @@
+/** @file
+ This library parses the coreboot table in memory to extract required
+ information.
+
+ Copyright (c) 2021, Star Labs Systems. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SMM_STORE_PARSE_LIB_H_
+#define SMM_STORE_PARSE_LIB_H_
+
+#include <Guid/SmmStoreInfoGuid.h>
+
+/**
+ Find the SmmStore HOB.
+
+ @param SmmStoreInfo Pointer to the SMMSTORE_INFO structure
+
+ @retval RETURN_SUCCESS Successfully found the Smm store buffer information.
+ @retval RETURN_NOT_FOUND Failed to find the Smm store buffer information.
+**/
+RETURN_STATUS
+EFIAPI
+ParseSmmStoreInfo (
+ OUT SMMSTORE_INFO *SmmStoreInfo
+ );
+
+#endif // SMM_STORE_PARSE_LIB_H_
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
index 03b6431..d7282e0 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -14,6 +14,7 @@
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <Library/BlParseLib.h>
+#include <Library/SmmStoreParseLib.h>
#include <IndustryStandard/Acpi.h>
#include <Coreboot.h>
@@ -595,3 +596,45 @@ ParseMiscInfo (
{
return RETURN_SUCCESS;
}
+
+/**
+ Find the SmmStore HOB.
+
+ @param SmmStoreInfo Pointer to the SMMSTORE_INFO structure
+
+ @retval RETURN_SUCCESS Successfully found the Smm store buffer information.
+ @retval RETURN_NOT_FOUND Failed to find the Smm store buffer information.
+**/
+RETURN_STATUS
+EFIAPI
+ParseSmmStoreInfo (
+ OUT SMMSTORE_INFO *SmmStoreInfo
+ )
+{
+ struct cb_smmstorev2 *CbSSRec;
+
+ if (SmmStoreInfo == NULL) {
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ CbSSRec = FindCbTag (CB_TAG_SMMSTOREV2);
+ if (CbSSRec == NULL) {
+ return RETURN_NOT_FOUND;
+ }
+
+ DEBUG ((DEBUG_INFO, "Found Smm Store information\n"));
+ DEBUG ((DEBUG_INFO, "block size: 0x%x\n", CbSSRec->block_size));
+ DEBUG ((DEBUG_INFO, "number of blocks: 0x%x\n", CbSSRec->num_blocks));
+ DEBUG ((DEBUG_INFO, "communication buffer: 0x%x\n", CbSSRec->com_buffer));
+ DEBUG ((DEBUG_INFO, "communication buffer size: 0x%x\n", CbSSRec->com_buffer_size));
+ DEBUG ((DEBUG_INFO, "MMIO address of store: 0x%x\n", CbSSRec->mmap_addr));
+
+ SmmStoreInfo->ComBuffer = CbSSRec->com_buffer;
+ SmmStoreInfo->ComBufferSize = CbSSRec->com_buffer_size;
+ SmmStoreInfo->BlockSize = CbSSRec->block_size;
+ SmmStoreInfo->NumBlocks = CbSSRec->num_blocks;
+ SmmStoreInfo->MmioAddress = CbSSRec->mmap_addr;
+ SmmStoreInfo->ApmCmd = CbSSRec->apm_cmd;
+
+ return RETURN_SUCCESS;
+}
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
index d88238b..de139a5 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
@@ -14,6 +14,7 @@
#include <Library/IoLib.h>
#include <Library/HobLib.h>
#include <Library/BlParseLib.h>
+#include <Library/SmmStoreParseLib.h>
#include <IndustryStandard/Acpi.h>
#include <UniversalPayload/PciRootBridges.h>
@@ -289,3 +290,20 @@ ParseMiscInfo (
return Status;
}
+
+/**
+ Find the SmmStore HOB.
+
+ @param SmmStoreInfo Pointer to the SMMSTORE_INFO structure
+
+ @retval RETURN_SUCCESS Successfully found the Smm store buffer information.
+ @retval RETURN_NOT_FOUND Failed to find the Smm store buffer information.
+**/
+RETURN_STATUS
+EFIAPI
+ParseSmmStoreInfo (
+ OUT SMMSTORE_INFO *SmmStoreInfo
+ )
+{
+ return RETURN_NOT_FOUND;
+}
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 2ecea0c..eb5f14e 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -338,6 +338,8 @@ BuildHobFromBl (
{
EFI_STATUS Status;
ACPI_BOARD_INFO *AcpiBoardInfo;
+ SMMSTORE_INFO SmmStoreInfo;
+ SMMSTORE_INFO *NewSmmStoreInfo;
EFI_PEI_GRAPHICS_INFO_HOB GfxInfo;
EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo;
EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo;
@@ -385,6 +387,17 @@ BuildHobFromBl (
}
//
+ // Create guid hob for SmmStore
+ //
+ Status = ParseSmmStoreInfo (&SmmStoreInfo);
+ if (!EFI_ERROR (Status)) {
+ NewSmmStoreInfo = BuildGuidHob (&gEfiSmmStoreInfoHobGuid, sizeof (SmmStoreInfo));
+ ASSERT (NewSmmStoreInfo != NULL);
+ CopyMem (NewSmmStoreInfo, &SmmStoreInfo, sizeof (SmmStoreInfo));
+ DEBUG ((DEBUG_INFO, "Created SmmStore info hob\n"));
+ }
+
+ //
// Creat SmBios table Hob
//
SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 077e526..b6fe5ef 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -22,6 +22,7 @@
#include <Library/IoLib.h>
#include <Library/PeCoffLib.h>
#include <Library/BlParseLib.h>
+#include <Library/SmmStoreParseLib.h>
#include <Library/PlatformSupportLib.h>
#include <Library/CpuLib.h>
#include <IndustryStandard/Acpi.h>
@@ -37,6 +38,7 @@
#include <UniversalPayload/SerialPortInfo.h>
#include <UniversalPayload/DeviceTree.h>
#include <Guid/PcdDataBaseSignatureGuid.h>
+#include <Guid/SmmStoreInfoGuid.h>
#define LEGACY_8259_MASK_REGISTER_MASTER 0x21
#define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 1ed319f..702be0d 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -71,6 +71,7 @@
gUniversalPayloadSmbiosTableGuid
gUniversalPayloadAcpiTableGuid
gUniversalPayloadSerialPortInfoGuid
+ gEfiSmmStoreInfoHobGuid
[FeaturePcd.IA32]
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec
index a6ab2dd..491e542 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -45,6 +45,8 @@
gS3CommunicationGuid = { 0x88e31ba1, 0x1856, 0x4b8b, { 0xbb, 0xdf, 0xf8, 0x16, 0xdd, 0x94, 0xa, 0xef } }
gUplPciSegmentInfoHobGuid = {0x37e0e3a9, 0xb3fc, 0x4e85, { 0x97, 0x2b, 0x40, 0x82, 0xfc, 0x79, 0x40, 0x54 } }
+ gEfiSmmStoreInfoHobGuid = { 0xf585ca19, 0x881b, 0x44fb, { 0x3f, 0x3d, 0x81, 0x89, 0x7c, 0x57, 0xbb, 0x01 } }
+
[Ppis]
gEfiPayLoadHobBasePpiGuid = { 0xdbe23aa1, 0xa342, 0x4b97, {0x85, 0xb6, 0xb2, 0x26, 0xf1, 0x61, 0x73, 0x89} }