From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.15422.1633021169074242646 for ; Thu, 30 Sep 2021 09:59:29 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: maurice.ma@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10123"; a="310781490" X-IronPort-AV: E=Sophos;i="5.85,336,1624345200"; d="scan'208";a="310781490" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 09:59:24 -0700 X-IronPort-AV: E=Sophos;i="5.85,336,1624345200"; d="scan'208";a="480014324" Received: from mxma-mobl1.amr.corp.intel.com ([10.212.171.201]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 09:59:24 -0700 From: "Ma, Maurice" To: devel@edk2.groups.io Cc: Maurice Ma , Ray Ni , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 1/1] UefiPayloadPkg: Add PCI root bridge info hob support for SBL Date: Thu, 30 Sep 2021 09:59:07 -0700 Message-Id: X-Mailer: git-send-email 2.29.2.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Cc: Guo Dong Cc: Benjamin You Signed-off-by: Maurice Ma --- UefiPayloadPkg/Include/Library/BlParseLib.h | 14 ++++++ .../Library/CbParseLib/CbParseLib.c | 16 +++++++ .../Library/SblParseLib/SblParseLib.c | 47 ++++++++++++++++++- .../Library/SblParseLib/SblParseLib.inf | 1 + .../UefiPayloadEntry/UefiPayloadEntry.c | 8 ++++ 5 files changed, 84 insertions(+), 2 deletions(-) diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/I= nclude/Library/BlParseLib.h index 1244190d4e87..49eac3124818 100644 --- a/UefiPayloadPkg/Include/Library/BlParseLib.h +++ b/UefiPayloadPkg/Include/Library/BlParseLib.h @@ -116,4 +116,18 @@ ParseGfxDeviceInfo ( OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo=0D );=0D =0D +/**=0D + Parse and handle the misc info provided by bootloader=0D +=0D + @retval RETURN_SUCCESS The misc information was parsed success= fully.=0D + @retval RETURN_NOT_FOUND Could not find required misc info.=0D + @retval RETURN_OUT_OF_RESOURCES Insufficant memory space.=0D +=0D +**/=0D +RETURN_STATUS=0D +EFIAPI=0D +ParseMiscInfo (=0D + VOID=0D + );=0D +=0D #endif=0D diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPk= g/Library/CbParseLib/CbParseLib.c index 4f90687e407e..f81aa0f301d8 100644 --- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c +++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c @@ -560,3 +560,19 @@ ParseGfxDeviceInfo ( return RETURN_NOT_FOUND;=0D }=0D =0D +/**=0D + Parse and handle the misc info provided by bootloader=0D +=0D + @retval RETURN_SUCCESS The misc information was parsed success= fully.=0D + @retval RETURN_NOT_FOUND Could not find required misc info.=0D + @retval RETURN_OUT_OF_RESOURCES Insufficant memory space.=0D +=0D +**/=0D +RETURN_STATUS=0D +EFIAPI=0D +ParseMiscInfo (=0D + VOID=0D + )=0D +{=0D + return RETURN_SUCCESS;=0D +}=0D diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayload= Pkg/Library/SblParseLib/SblParseLib.c index 7214fd87d20c..ccdcbfc07db9 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c @@ -1,7 +1,7 @@ /** @file=0D This library will parse the Slim Bootloader to get required information.= =0D =0D - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -15,7 +15,7 @@ #include =0D #include =0D #include =0D -=0D +#include =0D =0D /**=0D This function retrieves the parameter base address from boot loader.=0D @@ -221,3 +221,46 @@ ParseGfxDeviceInfo ( return RETURN_SUCCESS;=0D }=0D =0D +/**=0D + Parse and handle the misc info provided by bootloader=0D +=0D + @retval RETURN_SUCCESS The misc information was parsed success= fully.=0D + @retval RETURN_NOT_FOUND Could not find required misc info.=0D + @retval RETURN_OUT_OF_RESOURCES Insufficant memory space.=0D +=0D +**/=0D +RETURN_STATUS=0D +EFIAPI=0D +ParseMiscInfo (=0D + VOID=0D + )=0D +{=0D + RETURN_STATUS Status;=0D + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *BlRootBridgesHob;=0D + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PldRootBridgesHob;=0D +=0D + Status =3D RETURN_NOT_FOUND;=0D + BlRootBridgesHob =3D (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *) GetGuidHobDa= taFromSbl (=0D + &gUniversalPayloadPciRootBridgeInfoGuid=0D + );=0D + if (BlRootBridgesHob !=3D NULL) {=0D + //=0D + // Migrate bootloader root bridge info hob from bootloader to payload.= =0D + //=0D + PldRootBridgesHob =3D BuildGuidHob (=0D + &gUniversalPayloadPciRootBridgeInfoG= uid,=0D + BlRootBridgesHob->Header.Length=0D + );=0D + ASSERT (PldRootBridgesHob !=3D NULL);=0D + if (PldRootBridgesHob !=3D NULL) {=0D + CopyMem (PldRootBridgesHob, BlRootBridgesHob, BlRootBridgesHob->Head= er.Length);=0D + DEBUG ((DEBUG_INFO, "Create PCI root bridge info guid hob\n"));=0D + Status =3D RETURN_SUCCESS;=0D + } else {=0D + Status =3D RETURN_OUT_OF_RESOURCES;=0D + }=0D + }=0D +=0D + return Status;=0D +}=0D +=0D diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPaylo= adPkg/Library/SblParseLib/SblParseLib.inf index 665a5a8adcef..535cca58a63c 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf @@ -41,6 +41,7 @@ gLoaderMemoryMapInfoGuid=0D gEfiGraphicsInfoHobGuid=0D gEfiGraphicsDeviceInfoHobGuid=0D + gUniversalPayloadPciRootBridgeInfoGuid=0D =0D [Pcd]=0D gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index f2ac3d2c6925..5a1e5786687a 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -321,6 +321,14 @@ BuildHobFromBl ( return Status;=0D }=0D =0D + //=0D + // Parse the misc info provided by bootloader=0D + //=0D + Status =3D ParseMiscInfo ();=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_WARN, "Error when parsing misc info, Status =3D %r\n", S= tatus));=0D + }=0D +=0D //=0D // Parse platform specific information.=0D //=0D --=20 2.29.2.windows.2