public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID.
@ 2021-10-19  8:49 thiyagukb
  2021-10-20  0:40 ` Guo Dong
  0 siblings, 1 reply; 2+ messages in thread
From: thiyagukb @ 2021-10-19  8:49 UTC (permalink / raw)
  To: devel; +Cc: thiyagukb, Maurice Ma, Guo Dong, Ray Ni, Benjamin You,
	Zhiguang Liu

SystemTableInfo GUID is not a Spec defined GUID.
The latest CBL and SBL produces ACPI and SMBIOS table information
according to the Spec.
So removing the SystemTableInfo GUID implementation.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Thiyagu Kesavan Balakrishnan <thiyagux.kesavan.balakrishnan@intel.com>
---
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h                |  1 -
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf              |  1 -
 UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h         | 26 --------------------------
 UefiPayloadPkg/Include/Library/BlParseLib.h               | 25 ++++++++++++++++++++-----
 UefiPayloadPkg/Library/CbParseLib/CbParseLib.c            | 40 +++++++++++++++++++++++++++++++---------
 UefiPayloadPkg/Library/SblParseLib/SblParseLib.c          | 36 ++++++++++++++++++++++--------------
 UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf        |  3 ++-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c        | 64 +++++++++++++++++++++++++++++++++++-----------------------------
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h        |  1 -
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf      |  1 -
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf |  1 -
 11 files changed, 110 insertions(+), 89 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
index 3332a30eae..b16ca4cc59 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
@@ -20,7 +20,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/HobLib.h>
 
 #include <Guid/SmBios.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
 #include <Guid/GraphicsInfoHob.h>
 
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
index 1ccb250991..96d85d2b1d 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
@@ -42,7 +42,6 @@
   HobLib
 
 [Guids]
-  gUefiSystemTableInfoGuid
   gUefiAcpiBoardInfoGuid
   gEfiGraphicsInfoHobGuid
 
diff --git a/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h b/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h
deleted file mode 100644
index e742dd0ca5..0000000000
--- a/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-  This file defines the hob structure for system tables like ACPI, SMBIOS tables.
-
-  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef SYSTEM_TABLE_INFO_GUID_H_
-#define SYSTEM_TABLE_INFO_GUID_H_
-
-///
-/// System Table Information GUID
-///
-extern EFI_GUID gUefiSystemTableInfoGuid;
-
-typedef struct {
-  UINT8     Revision;
-  UINT8     Reserved0[3];
-  UINT64    AcpiTableBase;
-  UINT32    AcpiTableSize;
-  UINT64    SmbiosTableBase;
-  UINT32    SmbiosTableSize;
-} SYSTEM_TABLE_INFO;
-
-#endif
diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/Include/Library/BlParseLib.h
index 7198e419bd..5b5063b4e5 100644
--- a/UefiPayloadPkg/Include/Library/BlParseLib.h
+++ b/UefiPayloadPkg/Include/Library/BlParseLib.h
@@ -13,8 +13,9 @@
 #include <Guid/GraphicsInfoHob.h>
 #include <Guid/MemoryMapInfoGuid.h>
 #include <Guid/SerialPortInfoGuid.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
+#include <UniversalPayload/AcpiTable.h>
+#include <UniversalPayload/SmbiosTable.h>
 
 #define GET_BOOTLOADER_PARAMETER()      PcdGet64 (PcdBootloaderParameter)
 
@@ -55,9 +56,9 @@ ParseMemoryInfo (
   );
 
 /**
-  Acquire acpi table and smbios table from slim bootloader
+  Acquire SMBIOS table from bootloader.
 
-  @param  SystemTableInfo           Pointer to the system table info
+  @param  SmbiosTable           Pointer to the SMBIOS table info.
 
   @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
@@ -65,10 +66,24 @@ ParseMemoryInfo (
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+    OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   );
 
+/**
+  Acquire ACPI table from bootloader.
+
+  @param  AcpiTableHob              Pointer to the ACPI table info.
+
+  @retval RETURN_SUCCESS            Successfully find out the tables.
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  );
 
 /**
   Find the serial port information
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
index 46314e5566..61c5683260 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -410,9 +410,9 @@ ParseMemoryInfo (
 
 
 /**
-  Acquire acpi table and smbios table from coreboot
+  Acquire SMBIOS table from coreboot.
 
-  @param  SystemTableInfo          Pointer to the system table info
+  @param  SmbiosTable               Pointer to the SMBIOS table info.
 
   @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
@@ -420,8 +420,8 @@ ParseMemoryInfo (
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+  OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   )
 {
   EFI_STATUS       Status;
@@ -432,17 +432,39 @@ ParseSystemTable (
   if (EFI_ERROR (Status)) {
     return EFI_NOT_FOUND;
   }
-  SystemTableInfo->SmbiosTableBase = (UINT64) (UINTN)MemTable;
-  SystemTableInfo->SmbiosTableSize = MemTableSize;
+  SmbiosTable->SmBiosEntryPoint = (UINT64) (UINTN)MemTable;
+
+  return RETURN_SUCCESS;
+}
+
+
+/**
+  Acquire ACPI table from coreboot.
+
+  @param  AcpiTableHob              Pointer to the ACPI table info.
+
+  @retval RETURN_SUCCESS            Successfully find out the tables.
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  )
+{
+  EFI_STATUS       Status;
+  VOID             *MemTable;
+  UINT32           MemTableSize;
 
   Status = ParseCbMemTable (SIGNATURE_32 ('I', 'P', 'C', 'A'), &MemTable, &MemTableSize);
   if (EFI_ERROR (Status)) {
     return EFI_NOT_FOUND;
   }
-  SystemTableInfo->AcpiTableBase = (UINT64) (UINTN)MemTable;
-  SystemTableInfo->AcpiTableSize = MemTableSize;
+  AcpiTableHob->Rsdp = (UINT64) (UINTN)MemTable;
 
-  return Status;
+  return RETURN_SUCCESS;
 }
 
 
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
index eeb0dfe74a..5fa459255e 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
@@ -110,33 +110,41 @@ ParseMemoryInfo (
 }
 
 /**
-  Acquire acpi table and smbios table from slim bootloader
+  Acquire SMBIOS table from slim bootloader.
 
-  @param  SystemTableInfo           Pointer to the system table info
+  @param  SmbiosTable           Pointer to the SMBIOS table info.
 
-  @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
 
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+    OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   )
 {
-  SYSTEM_TABLE_INFO         *TableInfo;
+  DEBUG ((DEBUG_ERROR, "gUniversalPayloadSmbiosTableGuid should be produced by SlimBoot Loader.\n"));
+  return RETURN_NOT_FOUND;
+}
 
-  TableInfo = (SYSTEM_TABLE_INFO *)GetGuidHobDataFromSbl (&gUefiSystemTableInfoGuid);
-  if (TableInfo == NULL) {
-    ASSERT (FALSE);
-    return RETURN_NOT_FOUND;
-  }
 
-  CopyMem (SystemTableInfo, TableInfo, sizeof (SYSTEM_TABLE_INFO));
+/**
+  Acquire ACPI table from slim bootloader.
 
-  return RETURN_SUCCESS;
-}
+  @param  AcpiTableHob              Pointer to the ACPI table info.
 
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  )
+{
+  DEBUG ((DEBUG_ERROR, "gUniversalPayloadAcpiTableGuid should be produced by SlimBoot Loader.\n"));
+  return RETURN_NOT_FOUND;
+}
 
 /**
   Find the serial port information
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
index 535cca58a6..d0de75433d 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
@@ -36,7 +36,8 @@
   HobLib
 
 [Guids]
-  gUefiSystemTableInfoGuid
+  gUniversalPayloadAcpiTableGuid
+  gUniversalPayloadSmbiosTableGuid
   gUefiSerialPortInfoGuid
   gLoaderMemoryMapInfoGuid
   gEfiGraphicsInfoHobGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 9efe01d094..491fd2d3bb 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -224,8 +224,6 @@ BuildHobFromBl (
   )
 {
   EFI_STATUS                       Status;
-  SYSTEM_TABLE_INFO                SysTableInfo;
-  SYSTEM_TABLE_INFO                *NewSysTableInfo;
   ACPI_BOARD_INFO                  *AcpiBoardInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        GfxInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        *NewGfxInfo;
@@ -233,6 +231,8 @@ BuildHobFromBl (
   EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *NewGfxDeviceInfo;
   UNIVERSAL_PAYLOAD_SMBIOS_TABLE   *SmBiosTableHob;
   UNIVERSAL_PAYLOAD_ACPI_TABLE     *AcpiTableHob;
+  EFI_PEI_HOB_POINTERS              SmbiosHob;
+  EFI_PEI_HOB_POINTERS              AcpiHob;
 
   //
   // First find TOLUD
@@ -274,42 +274,48 @@ BuildHobFromBl (
   }
 
 
-  //
-  // Create guid hob for system tables like acpi table and smbios table
-  //
-  Status = ParseSystemTable(&SysTableInfo);
-  ASSERT_EFI_ERROR (Status);
-  if (!EFI_ERROR (Status)) {
-    NewSysTableInfo = BuildGuidHob (&gUefiSystemTableInfoGuid, sizeof (SYSTEM_TABLE_INFO));
-    ASSERT (NewSysTableInfo != NULL);
-    CopyMem (NewSysTableInfo, &SysTableInfo, sizeof (SYSTEM_TABLE_INFO));
-    DEBUG ((DEBUG_INFO, "Detected Acpi Table at 0x%lx, length 0x%x\n", SysTableInfo.AcpiTableBase, SysTableInfo.AcpiTableSize));
-    DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx, length 0x%x\n", SysTableInfo.SmbiosTableBase, SysTableInfo.SmbiosTableSize));
-  }
   //
   // Creat SmBios table Hob
   //
-  SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
-  ASSERT (SmBiosTableHob != NULL);
-  SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
-  SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE);
-  SmBiosTableHob->SmBiosEntryPoint = SysTableInfo.SmbiosTableBase;
-  DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n"));
-
+  SmbiosHob.Raw  = GetFirstGuidHob(&gUniversalPayloadSmbiosTableGuid);
+  if (SmbiosHob.Raw == NULL) {
+    SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
+    ASSERT (SmBiosTableHob != NULL);
+    SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
+    SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE);
+    DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n"));
+    Status = ParseSmbiosTable(SmBiosTableHob);
+    if (!EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx\n", SmBiosTableHob->SmBiosEntryPoint));
+    }
+  }
+  else {
+    SmBiosTableHob = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)(*(UINTN *)(GET_GUID_HOB_DATA (SmbiosHob.Raw)));
+    DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx\n", SmBiosTableHob->SmBiosEntryPoint));
+  }
   //
   // Creat ACPI table Hob
   //
-  AcpiTableHob = BuildGuidHob (&gUniversalPayloadAcpiTableGuid, sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE));
-  ASSERT (AcpiTableHob != NULL);
-  AcpiTableHob->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
-  AcpiTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE);
-  AcpiTableHob->Rsdp = SysTableInfo.AcpiTableBase;
-  DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadAcpiTableGuid guid hob\n"));
-
+  AcpiHob.Raw = GetFirstGuidHob(&gUniversalPayloadAcpiTableGuid);
+  if (AcpiHob.Raw == NULL) {
+    AcpiTableHob = BuildGuidHob (&gUniversalPayloadAcpiTableGuid, sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE));
+    ASSERT (AcpiTableHob != NULL);
+    AcpiTableHob->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
+    AcpiTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE);
+    DEBUG ((DEBUG_INFO, "Create ACPI table gUniversalPayloadAcpiTableGuid guid hob\n"));
+    Status = ParseAcpiTableInfo(AcpiTableHob);
+    if (!EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_INFO, "Detected ACPI Table at 0x%lx\n", AcpiTableHob->Rsdp));
+    }
+  }
+  else {
+    AcpiTableHob = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)(*(UINTN *)(GET_GUID_HOB_DATA (AcpiHob.Raw)));
+    DEBUG ((DEBUG_INFO, "Detected ACPI Table at 0x%lx\n", AcpiTableHob->Rsdp));
+  }
   //
   // Create guid hob for acpi board information
   //
-  AcpiBoardInfo = BuildHobFromAcpi (SysTableInfo.AcpiTableBase);
+  AcpiBoardInfo = BuildHobFromAcpi (AcpiTableHob->Rsdp);
   ASSERT (AcpiBoardInfo != NULL);
 
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 637ed9c20b..716430e3cb 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -27,7 +27,6 @@
 #include <IndustryStandard/Acpi.h>
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
 #include <Guid/SerialPortInfoGuid.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/MemoryMapInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
 #include <Guid/GraphicsInfoHob.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 96e4bb81f4..07a678bd46 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -59,7 +59,6 @@
 [Guids]
   gEfiMemoryTypeInformationGuid
   gEfiFirmwareFileSystem2Guid
-  gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
   gUefiAcpiBoardInfoGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 928bd2e42b..a8576305ad 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -57,7 +57,6 @@
 [Guids]
   gEfiMemoryTypeInformationGuid
   gEfiFirmwareFileSystem2Guid
-  gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
   gUefiAcpiBoardInfoGuid
-- 
2.33.0.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID.
  2021-10-19  8:49 [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID thiyagukb
@ 2021-10-20  0:40 ` Guo Dong
  0 siblings, 0 replies; 2+ messages in thread
From: Guo Dong @ 2021-10-20  0:40 UTC (permalink / raw)
  To: Kesavan Balakrishnan, ThiyaguX, devel@edk2.groups.io
  Cc: Ma, Maurice, Ni, Ray, You, Benjamin, Liu, Zhiguang


+  SmbiosHob.Raw  = GetFirstGuidHob(&gUniversalPayloadSmbiosTableGuid);
+  if (SmbiosHob.Raw == NULL) {
+    SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));

In non-universal payload, there is no gUniversalPayloadSmbiosTableGuid in UEFI payload HOBs. SblParseLib could get it from
SBL HOB list as below:

ParseSmbiosTable (
    OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
  )
{
  UNIVERSAL_PAYLOAD_SMBIOS_TABLE           *BlSmbiosTable;

  BlSmbiosTable = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *) GetGuidHobDataFromSbl (&gUniversalPayloadSmbiosTableGuid);
  if (BlSmbiosTable == NULL) {
    return RETURN_NOT_FOUND;
  }

  CopyMem (SmbiosTable, BlSmbiosTable, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
  return RETURN_SUCCESS;
}

So in the UefiPayloadEntry.c, we don't need change the  HOB from the bootloader, we could just build the HOB as-is as below:

  Status = ParseGfxDeviceInfo (&SmBiosTableHob);
  if (!EFI_ERROR (Status)) {
    NewSmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (SmBiosTableHob));
    ASSERT (NewSmBiosTableHob != NULL);
    CopyMem (NewSmBiosTableHob, &SmBiosTableHob, sizeof (SmBiosTableHob));
    DEBUG ((DEBUG_INFO, "Created SMBIOS table hob\n"));
  }

Same changes for ParseAcpiTableInfo().


Thanks,
Guo

-----Original Message-----
From: Kesavan Balakrishnan, ThiyaguX <thiyagux.kesavan.balakrishnan@intel.com> 
Sent: Tuesday, October 19, 2021 1:49 AM
To: devel@edk2.groups.io
Cc: Kesavan Balakrishnan, ThiyaguX <thiyagux.kesavan.balakrishnan@intel.com>; Ma, Maurice <maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; You, Benjamin <benjamin.you@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID.

SystemTableInfo GUID is not a Spec defined GUID.
The latest CBL and SBL produces ACPI and SMBIOS table information according to the Spec.
So removing the SystemTableInfo GUID implementation.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Thiyagu Kesavan Balakrishnan <thiyagux.kesavan.balakrishnan@intel.com>
---
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h                |  1 -
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf              |  1 -
 UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h         | 26 --------------------------
 UefiPayloadPkg/Include/Library/BlParseLib.h               | 25 ++++++++++++++++++++-----
 UefiPayloadPkg/Library/CbParseLib/CbParseLib.c            | 40 +++++++++++++++++++++++++++++++---------
 UefiPayloadPkg/Library/SblParseLib/SblParseLib.c          | 36 ++++++++++++++++++++++--------------
 UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf        |  3 ++-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c        | 64 +++++++++++++++++++++++++++++++++++-----------------------------
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h        |  1 -
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf      |  1 -
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf |  1 -
 11 files changed, 110 insertions(+), 89 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
index 3332a30eae..b16ca4cc59 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
@@ -20,7 +20,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include <Library/HobLib.h>
 
 #include <Guid/SmBios.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
 #include <Guid/GraphicsInfoHob.h>
 
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
index 1ccb250991..96d85d2b1d 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
@@ -42,7 +42,6 @@
   HobLib
 
 [Guids]
-  gUefiSystemTableInfoGuid
   gUefiAcpiBoardInfoGuid
   gEfiGraphicsInfoHobGuid
 
diff --git a/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h b/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h
deleted file mode 100644
index e742dd0ca5..0000000000
--- a/UefiPayloadPkg/Include/Guid/SystemTableInfoGuid.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-  This file defines the hob structure for system tables like ACPI, SMBIOS tables.
-
-  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef SYSTEM_TABLE_INFO_GUID_H_
-#define SYSTEM_TABLE_INFO_GUID_H_
-
-///
-/// System Table Information GUID
-///
-extern EFI_GUID gUefiSystemTableInfoGuid;
-
-typedef struct {
-  UINT8     Revision;
-  UINT8     Reserved0[3];
-  UINT64    AcpiTableBase;
-  UINT32    AcpiTableSize;
-  UINT64    SmbiosTableBase;
-  UINT32    SmbiosTableSize;
-} SYSTEM_TABLE_INFO;
-
-#endif
diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/Include/Library/BlParseLib.h
index 7198e419bd..5b5063b4e5 100644
--- a/UefiPayloadPkg/Include/Library/BlParseLib.h
+++ b/UefiPayloadPkg/Include/Library/BlParseLib.h
@@ -13,8 +13,9 @@
 #include <Guid/GraphicsInfoHob.h>
 #include <Guid/MemoryMapInfoGuid.h>
 #include <Guid/SerialPortInfoGuid.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
+#include <UniversalPayload/AcpiTable.h> #include 
+<UniversalPayload/SmbiosTable.h>
 
 #define GET_BOOTLOADER_PARAMETER()      PcdGet64 (PcdBootloaderParameter)
 
@@ -55,9 +56,9 @@ ParseMemoryInfo (
   );
 
 /**
-  Acquire acpi table and smbios table from slim bootloader
+  Acquire SMBIOS table from bootloader.
 
-  @param  SystemTableInfo           Pointer to the system table info
+  @param  SmbiosTable           Pointer to the SMBIOS table info.
 
   @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
@@ -65,10 +66,24 @@ ParseMemoryInfo (
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+    OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   );
 
+/**
+  Acquire ACPI table from bootloader.
+
+  @param  AcpiTableHob              Pointer to the ACPI table info.
+
+  @retval RETURN_SUCCESS            Successfully find out the tables.
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  );
 
 /**
   Find the serial port information
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
index 46314e5566..61c5683260 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -410,9 +410,9 @@ ParseMemoryInfo (
 
 
 /**
-  Acquire acpi table and smbios table from coreboot
+  Acquire SMBIOS table from coreboot.
 
-  @param  SystemTableInfo          Pointer to the system table info
+  @param  SmbiosTable               Pointer to the SMBIOS table info.
 
   @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
@@ -420,8 +420,8 @@ ParseMemoryInfo (
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+  OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   )
 {
   EFI_STATUS       Status;
@@ -432,17 +432,39 @@ ParseSystemTable (
   if (EFI_ERROR (Status)) {
     return EFI_NOT_FOUND;
   }
-  SystemTableInfo->SmbiosTableBase = (UINT64) (UINTN)MemTable;
-  SystemTableInfo->SmbiosTableSize = MemTableSize;
+  SmbiosTable->SmBiosEntryPoint = (UINT64) (UINTN)MemTable;
+
+  return RETURN_SUCCESS;
+}
+
+
+/**
+  Acquire ACPI table from coreboot.
+
+  @param  AcpiTableHob              Pointer to the ACPI table info.
+
+  @retval RETURN_SUCCESS            Successfully find out the tables.
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  )
+{
+  EFI_STATUS       Status;
+  VOID             *MemTable;
+  UINT32           MemTableSize;
 
   Status = ParseCbMemTable (SIGNATURE_32 ('I', 'P', 'C', 'A'), &MemTable, &MemTableSize);
   if (EFI_ERROR (Status)) {
     return EFI_NOT_FOUND;
   }
-  SystemTableInfo->AcpiTableBase = (UINT64) (UINTN)MemTable;
-  SystemTableInfo->AcpiTableSize = MemTableSize;
+  AcpiTableHob->Rsdp = (UINT64) (UINTN)MemTable;
 
-  return Status;
+  return RETURN_SUCCESS;
 }
 
 
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
index eeb0dfe74a..5fa459255e 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
@@ -110,33 +110,41 @@ ParseMemoryInfo (
 }
 
 /**
-  Acquire acpi table and smbios table from slim bootloader
+  Acquire SMBIOS table from slim bootloader.
 
-  @param  SystemTableInfo           Pointer to the system table info
+  @param  SmbiosTable           Pointer to the SMBIOS table info.
 
-  @retval RETURN_SUCCESS            Successfully find out the tables.
   @retval RETURN_NOT_FOUND          Failed to find the tables.
 
 **/
 RETURN_STATUS
 EFIAPI
-ParseSystemTable (
-  OUT SYSTEM_TABLE_INFO     *SystemTableInfo
+ParseSmbiosTable (
+    OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE     *SmbiosTable
   )
 {
-  SYSTEM_TABLE_INFO         *TableInfo;
+  DEBUG ((DEBUG_ERROR, "gUniversalPayloadSmbiosTableGuid should be 
+produced by SlimBoot Loader.\n"));
+  return RETURN_NOT_FOUND;
+}
 
-  TableInfo = (SYSTEM_TABLE_INFO *)GetGuidHobDataFromSbl (&gUefiSystemTableInfoGuid);
-  if (TableInfo == NULL) {
-    ASSERT (FALSE);
-    return RETURN_NOT_FOUND;
-  }
 
-  CopyMem (SystemTableInfo, TableInfo, sizeof (SYSTEM_TABLE_INFO));
+/**
+  Acquire ACPI table from slim bootloader.
 
-  return RETURN_SUCCESS;
-}
+  @param  AcpiTableHob              Pointer to the ACPI table info.
 
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseAcpiTableInfo (
+  OUT UNIVERSAL_PAYLOAD_ACPI_TABLE        *AcpiTableHob
+  )
+{
+  DEBUG ((DEBUG_ERROR, "gUniversalPayloadAcpiTableGuid should be 
+produced by SlimBoot Loader.\n"));
+  return RETURN_NOT_FOUND;
+}
 
 /**
   Find the serial port information
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
index 535cca58a6..d0de75433d 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
@@ -36,7 +36,8 @@
   HobLib
 
 [Guids]
-  gUefiSystemTableInfoGuid
+  gUniversalPayloadAcpiTableGuid
+  gUniversalPayloadSmbiosTableGuid
   gUefiSerialPortInfoGuid
   gLoaderMemoryMapInfoGuid
   gEfiGraphicsInfoHobGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 9efe01d094..491fd2d3bb 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -224,8 +224,6 @@ BuildHobFromBl (
   )
 {
   EFI_STATUS                       Status;
-  SYSTEM_TABLE_INFO                SysTableInfo;
-  SYSTEM_TABLE_INFO                *NewSysTableInfo;
   ACPI_BOARD_INFO                  *AcpiBoardInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        GfxInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        *NewGfxInfo;
@@ -233,6 +231,8 @@ BuildHobFromBl (
   EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *NewGfxDeviceInfo;
   UNIVERSAL_PAYLOAD_SMBIOS_TABLE   *SmBiosTableHob;
   UNIVERSAL_PAYLOAD_ACPI_TABLE     *AcpiTableHob;
+  EFI_PEI_HOB_POINTERS              SmbiosHob;
+  EFI_PEI_HOB_POINTERS              AcpiHob;
 
   //
   // First find TOLUD
@@ -274,42 +274,48 @@ BuildHobFromBl (
   }
 
 
-  //
-  // Create guid hob for system tables like acpi table and smbios table
-  //
-  Status = ParseSystemTable(&SysTableInfo);
-  ASSERT_EFI_ERROR (Status);
-  if (!EFI_ERROR (Status)) {
-    NewSysTableInfo = BuildGuidHob (&gUefiSystemTableInfoGuid, sizeof (SYSTEM_TABLE_INFO));
-    ASSERT (NewSysTableInfo != NULL);
-    CopyMem (NewSysTableInfo, &SysTableInfo, sizeof (SYSTEM_TABLE_INFO));
-    DEBUG ((DEBUG_INFO, "Detected Acpi Table at 0x%lx, length 0x%x\n", SysTableInfo.AcpiTableBase, SysTableInfo.AcpiTableSize));
-    DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx, length 0x%x\n", SysTableInfo.SmbiosTableBase, SysTableInfo.SmbiosTableSize));
-  }
   //
   // Creat SmBios table Hob
   //
-  SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
-  ASSERT (SmBiosTableHob != NULL);
-  SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
-  SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE);
-  SmBiosTableHob->SmBiosEntryPoint = SysTableInfo.SmbiosTableBase;
-  DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n"));
-
+  SmbiosHob.Raw  = GetFirstGuidHob(&gUniversalPayloadSmbiosTableGuid);
+  if (SmbiosHob.Raw == NULL) {
+    SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE));
+    ASSERT (SmBiosTableHob != NULL);
+    SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
+    SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE);
+    DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n"));
+    Status = ParseSmbiosTable(SmBiosTableHob);
+    if (!EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx\n", SmBiosTableHob->SmBiosEntryPoint));
+    }
+  }
+  else {
+    SmBiosTableHob = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)(*(UINTN *)(GET_GUID_HOB_DATA (SmbiosHob.Raw)));
+    DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx\n", 
+ SmBiosTableHob->SmBiosEntryPoint));
+  }
   //
   // Creat ACPI table Hob
   //
-  AcpiTableHob = BuildGuidHob (&gUniversalPayloadAcpiTableGuid, sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE));
-  ASSERT (AcpiTableHob != NULL);
-  AcpiTableHob->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
-  AcpiTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE);
-  AcpiTableHob->Rsdp = SysTableInfo.AcpiTableBase;
-  DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadAcpiTableGuid guid hob\n"));
-
+  AcpiHob.Raw = GetFirstGuidHob(&gUniversalPayloadAcpiTableGuid);
+  if (AcpiHob.Raw == NULL) {
+    AcpiTableHob = BuildGuidHob (&gUniversalPayloadAcpiTableGuid, sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE));
+    ASSERT (AcpiTableHob != NULL);
+    AcpiTableHob->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
+    AcpiTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE);
+    DEBUG ((DEBUG_INFO, "Create ACPI table gUniversalPayloadAcpiTableGuid guid hob\n"));
+    Status = ParseAcpiTableInfo(AcpiTableHob);
+    if (!EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_INFO, "Detected ACPI Table at 0x%lx\n", AcpiTableHob->Rsdp));
+    }
+  }
+  else {
+    AcpiTableHob = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)(*(UINTN *)(GET_GUID_HOB_DATA (AcpiHob.Raw)));
+    DEBUG ((DEBUG_INFO, "Detected ACPI Table at 0x%lx\n", 
+ AcpiTableHob->Rsdp));  }
   //
   // Create guid hob for acpi board information
   //
-  AcpiBoardInfo = BuildHobFromAcpi (SysTableInfo.AcpiTableBase);
+  AcpiBoardInfo = BuildHobFromAcpi (AcpiTableHob->Rsdp);
   ASSERT (AcpiBoardInfo != NULL);
 
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 637ed9c20b..716430e3cb 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -27,7 +27,6 @@
 #include <IndustryStandard/Acpi.h>
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
 #include <Guid/SerialPortInfoGuid.h>
-#include <Guid/SystemTableInfoGuid.h>
 #include <Guid/MemoryMapInfoGuid.h>
 #include <Guid/AcpiBoardInfoGuid.h>
 #include <Guid/GraphicsInfoHob.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 96e4bb81f4..07a678bd46 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -59,7 +59,6 @@
 [Guids]
   gEfiMemoryTypeInformationGuid
   gEfiFirmwareFileSystem2Guid
-  gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
   gUefiAcpiBoardInfoGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 928bd2e42b..a8576305ad 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -57,7 +57,6 @@
 [Guids]
   gEfiMemoryTypeInformationGuid
   gEfiFirmwareFileSystem2Guid
-  gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
   gUefiAcpiBoardInfoGuid
--
2.33.0.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-20  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19  8:49 [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID thiyagukb
2021-10-20  0:40 ` Guo Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox