]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg: Add PCI root bridge info hob support for SBL
authorMa, Maurice <maurice.ma@intel.com>
Thu, 30 Sep 2021 16:59:07 +0000 (09:59 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 13 Oct 2021 23:03:50 +0000 (23:03 +0000)
Current UefiPayloadPkg can suport PCI root bridge info HOB
provided by bootloader. For UniversalPayload, bootloader can
directly provide this HOB for payload consumption. However,
for legacy UEFI payload, it is required to migrate the HOB
information from bootloader HOB space to UEFI payload HOB
space. This patch added the missing part for the bootloader
ParseLib in order to support both legacy and universal UEFI
payload.

This patch was tested on Slim Bootloader with latest UEFI
payload, and it worked as expected.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
UefiPayloadPkg/Include/Library/BlParseLib.h
UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c

index 1244190d4e87237c07e715fe69879157fd0d0f7e..49eac3124818a40692c4c1ea1f43f0ce09bf5dbb 100644 (file)
@@ -116,4 +116,18 @@ ParseGfxDeviceInfo (
   OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB       *GfxDeviceInfo\r
   );\r
 \r
+/**\r
+  Parse and handle the misc info provided by bootloader\r
+\r
+  @retval RETURN_SUCCESS           The misc information was parsed successfully.\r
+  @retval RETURN_NOT_FOUND         Could not find required misc info.\r
+  @retval RETURN_OUT_OF_RESOURCES  Insufficant memory space.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ParseMiscInfo (\r
+  VOID\r
+  );\r
+\r
 #endif\r
index 4f90687e407ebd168d7c42509476a3337bdb538b..f81aa0f301d88b461246b0ca710833a20e15aba0 100644 (file)
@@ -560,3 +560,19 @@ ParseGfxDeviceInfo (
   return RETURN_NOT_FOUND;\r
 }\r
 \r
+/**\r
+  Parse and handle the misc info provided by bootloader\r
+\r
+  @retval RETURN_SUCCESS           The misc information was parsed successfully.\r
+  @retval RETURN_NOT_FOUND         Could not find required misc info.\r
+  @retval RETURN_OUT_OF_RESOURCES  Insufficant memory space.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ParseMiscInfo (\r
+  VOID\r
+  )\r
+{\r
+  return RETURN_SUCCESS;\r
+}\r
index 7214fd87d20c65e60f50d7ff0b9d249d8ff594df..ccdcbfc07db941913fabee358943aa32dd2ccb2d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This library will parse the Slim Bootloader to get required information.\r
 \r
-  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -15,7 +15,7 @@
 #include <Library/HobLib.h>\r
 #include <Library/BlParseLib.h>\r
 #include <IndustryStandard/Acpi.h>\r
-\r
+#include <UniversalPayload/PciRootBridges.h>\r
 \r
 /**\r
   This function retrieves the parameter base address from boot loader.\r
@@ -221,3 +221,46 @@ ParseGfxDeviceInfo (
   return RETURN_SUCCESS;\r
 }\r
 \r
+/**\r
+  Parse and handle the misc info provided by bootloader\r
+\r
+  @retval RETURN_SUCCESS           The misc information was parsed successfully.\r
+  @retval RETURN_NOT_FOUND         Could not find required misc info.\r
+  @retval RETURN_OUT_OF_RESOURCES  Insufficant memory space.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ParseMiscInfo (\r
+  VOID\r
+  )\r
+{\r
+  RETURN_STATUS                          Status;\r
+  UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES     *BlRootBridgesHob;\r
+  UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES     *PldRootBridgesHob;\r
+\r
+  Status = RETURN_NOT_FOUND;\r
+  BlRootBridgesHob = (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *) GetGuidHobDataFromSbl (\r
+                       &gUniversalPayloadPciRootBridgeInfoGuid\r
+                     );\r
+  if (BlRootBridgesHob != NULL) {\r
+    //\r
+    // Migrate bootloader root bridge info hob from bootloader to payload.\r
+    //\r
+    PldRootBridgesHob = BuildGuidHob (\r
+                                      &gUniversalPayloadPciRootBridgeInfoGuid,\r
+                                      BlRootBridgesHob->Header.Length\r
+                                     );\r
+    ASSERT (PldRootBridgesHob != NULL);\r
+    if (PldRootBridgesHob != NULL) {\r
+      CopyMem (PldRootBridgesHob, BlRootBridgesHob, BlRootBridgesHob->Header.Length);\r
+      DEBUG ((DEBUG_INFO, "Create PCI root bridge info guid hob\n"));\r
+      Status = RETURN_SUCCESS;\r
+    } else {\r
+      Status = RETURN_OUT_OF_RESOURCES;\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
index 665a5a8adcef815c3e9b158bf2203314fa8db022..535cca58a63c5c39a442964afa7e277b3e27b0b9 100644 (file)
@@ -41,6 +41,7 @@
   gLoaderMemoryMapInfoGuid\r
   gEfiGraphicsInfoHobGuid\r
   gEfiGraphicsDeviceInfoHobGuid\r
+  gUniversalPayloadPciRootBridgeInfoGuid\r
 \r
 [Pcd]\r
   gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter\r
index f2ac3d2c692532f7e47aa48837342722b5188f0a..5a1e5786687a7ef15285dcc834d8a1f40391c70d 100644 (file)
@@ -321,6 +321,14 @@ BuildHobFromBl (
     return Status;\r
   }\r
 \r
+  //\r
+  // Parse the misc info provided by bootloader\r
+  //\r
+  Status = ParseMiscInfo ();\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_WARN, "Error when parsing misc info, Status = %r\n", Status));\r
+  }\r
+\r
   //\r
   // Parse platform specific information.\r
   //\r