summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/Library
diff options
context:
space:
mode:
authorDhaval <dhaval@rivosinc.com>2024-08-29 14:50:55 +0530
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-14 03:38:47 +0000
commit9fff9912fdea5bd871acfe548fe2f20fdb17dd64 (patch)
tree00b571482790b1186fd0fc5259bcf04b9c5df4e6 /UefiPayloadPkg/Library
parent4d35077048eb5de182edf1ba5c4f253651190a02 (diff)
downloadedk2-9fff9912fdea5bd871acfe548fe2f20fdb17dd64.tar.gz
edk2-9fff9912fdea5bd871acfe548fe2f20fdb17dd64.tar.bz2
edk2-9fff9912fdea5bd871acfe548fe2f20fdb17dd64.zip
UefiPayloadPkg: Parse fdt and create smbios table
Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
Diffstat (limited to 'UefiPayloadPkg/Library')
-rw-r--r--UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
index 76ff326ed8..4684f11497 100644
--- a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
+++ b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
@@ -226,15 +226,16 @@ ParseReservedMemory (
IN INT32 Node
)
{
- INT32 SubNode;
- INT32 TempLen;
- CONST CHAR8 *TempStr;
- CONST FDT_PROPERTY *PropertyPtr;
- UINT64 *Data64;
- UINT64 StartAddress;
- UINT64 NumberOfBytes;
- UNIVERSAL_PAYLOAD_ACPI_TABLE *PlatformAcpiTable;
- FDT_NODE_HEADER *NodePtr;
+ INT32 SubNode;
+ INT32 TempLen;
+ CONST CHAR8 *TempStr;
+ CONST FDT_PROPERTY *PropertyPtr;
+ UINT64 *Data64;
+ UINT64 StartAddress;
+ UINT64 NumberOfBytes;
+ UNIVERSAL_PAYLOAD_ACPI_TABLE *PlatformAcpiTable;
+ UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable;
+ FDT_NODE_HEADER *NodePtr;
PlatformAcpiTable = NULL;
@@ -282,6 +283,15 @@ ParseReservedMemory (
PlatformAcpiTable->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
PlatformAcpiTable->Header.Length = sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE);
}
+ } else if (AsciiStrnCmp (TempStr, "smbios", AsciiStrLen ("smbios")) == 0) {
+ DEBUG ((DEBUG_INFO, " build smbios, NumberOfBytes:%x", NumberOfBytes));
+ BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiBootServicesData);
+ SmbiosTable = BuildGuidHob (&gUniversalPayloadSmbios3TableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
+ if (SmbiosTable != NULL) {
+ SmbiosTable->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
+ SmbiosTable->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE);
+ SmbiosTable->SmBiosEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)(StartAddress);
+ }
} else if (AsciiStrnCmp (TempStr, "acpi-nvs", AsciiStrLen ("acpi-nvs")) == 0) {
DEBUG ((DEBUG_INFO, " acpi-nvs"));
BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiACPIMemoryNVS);
@@ -840,9 +850,11 @@ ParseDtb (
} // end of memory node
else {
PropertyPtr = FdtGetProperty (Fdt, Node, "compatible", &TempLen);
- if (PropertyPtr == NULL)
+ if (PropertyPtr == NULL) {
continue;
- TempStr = (CHAR8 *)(PropertyPtr->Data);
+ }
+
+ TempStr = (CHAR8 *)(PropertyPtr->Data);
if (AsciiStrnCmp (TempStr, "pci-rb", AsciiStrLen ("pci-rb")) == 0) {
RootBridgeCount++;
}