From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.7269.1634633391615588732 for ; Tue, 19 Oct 2021 01:49:51 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: thiyagux.kesavan.balakrishnan@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10141"; a="208561584" X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="208561584" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 01:49:49 -0700 X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="494001692" Received: from tkesavax-mobl.gar.corp.intel.com ([10.235.192.135]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 01:49:46 -0700 From: "thiyagukb" To: devel@edk2.groups.io Cc: thiyagukb , Maurice Ma , Guo Dong , Ray Ni , Benjamin You , Zhiguang Liu Subject: [PATCH v4] UefiPayloadPkg: Remove SystemTableInfo GUID. Date: Tue, 19 Oct 2021 14:19:29 +0530 Message-Id: <20211019084929.1273-1-thiyagux.kesavan.balakrishnan@intel.com> X-Mailer: git-send-email 2.33.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Guo Dong Cc: Ray Ni Cc: Benjamin You Cc: Zhiguang Liu Signed-off-by: Guo Dong Signed-off-by: Thiyagu Kesavan Balakrishnan --- 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 #include -#include #include #include 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.
- 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 #include #include -#include #include +#include +#include #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 #include #include -#include #include #include #include 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