From: "Benjamin Doron" <benjamin.doron00@gmail.com>
To: devel@edk2.groups.io
Cc: Guo Dong <guo.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Sean Rhodes <sean@starlabs.systems>,
James Lu <james.lu@intel.com>, Gua Guo <gua.guo@intel.com>
Subject: [edk2-devel] [PATCH v2 1/4] UefiPayloadPkg/SblParseLib: Build SMM feature GUID HOBs from bootloader
Date: Mon, 11 Dec 2023 17:39:09 -0500 [thread overview]
Message-ID: <20231211223919.1225565-1-benjamin.doron00@gmail.com> (raw)
From: Benjamin Doron <benjamin.doron@9elements.com>
UefiPayload does not install all SBL HOBs, EDK2-relevant ones must be
installed individually. This was omitted from the SMM feature pushes.
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
---
UefiPayloadPkg/Library/SblParseLib/SblParseLib.c | 77 ++++++++++++++++++++
UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf | 5 ++
2 files changed, 82 insertions(+)
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
index d88238bfdccb..9775ad4ac2a6 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
@@ -15,6 +15,11 @@
#include <Library/HobLib.h>
#include <Library/BlParseLib.h>
#include <IndustryStandard/Acpi.h>
+#include <Guid/SmmRegisterInfoGuid.h>
+#include <Guid/SmramMemoryReserve.h>
+#include <Guid/SpiFlashInfoGuid.h>
+#include <Guid/NvVariableInfoGuid.h>
+#include <Guid/SmmS3CommunicationInfoGuid.h>
#include <UniversalPayload/PciRootBridges.h>
/**
@@ -264,6 +269,17 @@ ParseMiscInfo (
RETURN_STATUS Status;
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *BlRootBridgesHob;
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PldRootBridgesHob;
+ // TODO: Drop half by ignoring return?
+ PLD_SMM_REGISTERS *BlSmmRegisters;
+ PLD_SMM_REGISTERS *PldSmmRegisters;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *BlSmramHob;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *PldSmramHob;
+ SPI_FLASH_INFO *BlSpiFlashInfo;
+ SPI_FLASH_INFO *PldSpiFlashInfo;
+ NV_VARIABLE_INFO *BlNvVariableInfo;
+ NV_VARIABLE_INFO *PldNvVariableInfo;
+ PLD_S3_COMMUNICATION *BlS3Communication;
+ PLD_S3_COMMUNICATION *PldS3Communication;
Status = RETURN_NOT_FOUND;
BlRootBridgesHob = (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *)GetGuidHobDataFromSbl (
@@ -287,5 +303,66 @@ ParseMiscInfo (
}
}
+ // Perhaps payload does not perform SMM, do not override Status
+ BlSmmRegisters = GetGuidHobDataFromSbl (&gSmmRegisterInfoGuid);
+ if (BlSmmRegisters != NULL) {
+ PldSmmRegisters = BuildGuidDataHob (
+ &gSmmRegisterInfoGuid,
+ BlSmmRegisters,
+ sizeof (PLD_SMM_REGISTERS) + (BlSmmRegisters->Count * sizeof (PLD_GENERIC_REGISTER))
+ );
+ if (PldSmmRegisters != NULL) {
+ DEBUG ((DEBUG_INFO, "Create SMM register info guid hob\n"));
+ }
+ }
+
+ BlSmramHob = GetGuidHobDataFromSbl (&gEfiSmmSmramMemoryGuid);
+ if (BlSmramHob != NULL) {
+ PldSmramHob = BuildGuidDataHob (
+ &gEfiSmmSmramMemoryGuid,
+ BlSmramHob,
+ sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK) + ((BlSmramHob->number_of_smm_regions - 1) * sizeof (EFI_SMRAM_DESCRIPTOR))
+ );
+ if (PldSmramHob != NULL) {
+ DEBUG ((DEBUG_INFO, "Create SMM SMRAM memory info guid hob\n"));
+ }
+ }
+
+ BlSpiFlashInfo = GetGuidHobDataFromSbl (&gSpiFlashInfoGuid);
+ if (BlSpiFlashInfo != NULL) {
+ PldSpiFlashInfo = BuildGuidDataHob (
+ &gSpiFlashInfoGuid,
+ BlSpiFlashInfo,
+ sizeof (SPI_FLASH_INFO)
+ );
+ if (PldSpiFlashInfo != NULL) {
+ DEBUG ((DEBUG_INFO, "Create SPI flash info guid hob\n"));
+ }
+ }
+
+ BlNvVariableInfo = GetGuidHobDataFromSbl (&gNvVariableInfoGuid);
+ if (BlNvVariableInfo != NULL) {
+ PldNvVariableInfo = BuildGuidDataHob (
+ &gNvVariableInfoGuid,
+ BlNvVariableInfo,
+ sizeof (NV_VARIABLE_INFO)
+ );
+ if (PldNvVariableInfo != NULL) {
+ DEBUG ((DEBUG_INFO, "Create NV variable info guid hob\n"));
+ }
+ }
+
+ BlS3Communication = GetGuidHobDataFromSbl (&gS3CommunicationGuid);
+ if (BlS3Communication != NULL) {
+ PldS3Communication = BuildGuidDataHob (
+ &gS3CommunicationGuid,
+ BlS3Communication,
+ sizeof (PLD_S3_COMMUNICATION)
+ );
+ if (PldS3Communication != NULL) {
+ DEBUG ((DEBUG_INFO, "Create S3 communication guid hob\n"));
+ }
+ }
+
return Status;
}
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
index f83a10ccd826..1c77d86a8643 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
@@ -41,6 +41,11 @@
gEfiGraphicsInfoHobGuid
gEfiGraphicsDeviceInfoHobGuid
gUniversalPayloadPciRootBridgeInfoGuid
+ gSmmRegisterInfoGuid
+ gEfiSmmSmramMemoryGuid
+ gSpiFlashInfoGuid
+ gNvVariableInfoGuid
+ gS3CommunicationGuid
[Pcd]
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
--
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112336): https://edk2.groups.io/g/devel/message/112336
Mute This Topic: https://groups.io/mt/103119569/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next reply other threads:[~2023-12-11 22:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 22:39 Benjamin Doron [this message]
2023-12-11 22:39 ` [edk2-devel] [PATCH v2 2/4] UefiPayloadPkg: Introduce coreboot FMAP parser library Benjamin Doron
2023-12-11 22:39 ` [edk2-devel] [PATCH v2 3/4] [WIP] UefiPayloadPkg/CbParseLib: Initial coreboot support for SMM payload Benjamin Doron
2023-12-11 22:39 ` [edk2-devel] [PATCH v2 4/4] [WIP] UefiPayloadPkg: Support SMRAMC register Benjamin Doron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231211223919.1225565-1-benjamin.doron00@gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox