From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id A09547803D1 for ; Wed, 29 May 2024 20:25:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=C50J06myzfAvd+xClHbhB+KfP4vJCVW1Oi+A92oFNnE=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1717014328; v=1; b=OC9bUhsDNRx+aLBYIFEfx6Xm/BE4nKLechFNJ884sPb3rwlXt2t8x06hUh9NiCZ54yXr2ASy 19KFimMcBLXT3Nf6YTNWrQ2ER2lO7miWx+KmuXHwIXht3pLFNrYvj7FCXDLGMMtkrv08ISFfgxG eE2iR6hk4/KeOcQ90R/+NUWyxecX0tUt2QJfrmLsRmP37IA1pXDejaSDfZ3QFC5eIHZOGu/b7Xj lIsebnICL6Skv0LRojIphtZ2EqEkgEmEsMEQyI/r4CbmQWk11wNh8wDMKuftKF6DHM/FrXdxGX5 SE1gA/3tcgTIjpqr16lhjEhmi81Yfzx2LUNe8V4pzbgiA== X-Received: by 127.0.0.2 with SMTP id nFd5YY7687511xYQA0oYaf04; Wed, 29 May 2024 13:25:27 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by mx.groups.io with SMTP id smtpd.web11.717.1717014326056728908 for ; Wed, 29 May 2024 13:25:26 -0700 X-CSE-ConnectionGUID: v/GYxuhyRD6syrpeUfjB0w== X-CSE-MsgGUID: TdXfAMMrQzCxfci7N2QUHw== X-IronPort-AV: E=McAfee;i="6600,9927,11087"; a="13574016" X-IronPort-AV: E=Sophos;i="6.08,199,1712646000"; d="scan'208";a="13574016" X-Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2024 13:25:25 -0700 X-CSE-ConnectionGUID: jk+/RW5KQs65zyBAlSMozQ== X-CSE-MsgGUID: YUvxiIFqQLCyv8S5oGBcNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,199,1712646000"; d="scan'208";a="35588332" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 29 May 2024 13:25:25 -0700 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 29 May 2024 13:25:24 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 29 May 2024 13:25:24 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 29 May 2024 13:25:24 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 29 May 2024 13:25:23 -0700 X-Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by PH0PR11MB5805.namprd11.prod.outlook.com (2603:10b6:510:14a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Wed, 29 May 2024 20:25:20 +0000 X-Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3baa:3852:4315:38f7]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3baa:3852:4315:38f7%7]) with mapi id 15.20.7611.016; Wed, 29 May 2024 20:25:20 +0000 From: "Chiu, Chasel" To: "Liu, Linus" , "devel@edk2.groups.io" CC: "Lin, Benny" , "Guo, Gua" , "Lu, James" , Dhaval Sharma , "Dong, Guo" Subject: Re: [edk2-devel] [PATCH v3 5/6] UefiPayloadPkg: Add FDT Paser relative LIBs. Thread-Topic: [PATCH v3 5/6] UefiPayloadPkg: Add FDT Paser relative LIBs. Thread-Index: AQHarZDWtYvk27QRRk25INBXje3TULGudraw Date: Wed, 29 May 2024 20:25:20 +0000 Message-ID: References: <20240524041400.1231-1-linus.liu@intel.com> In-Reply-To: <20240524041400.1231-1-linus.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|PH0PR11MB5805:EE_ x-ms-office365-filtering-correlation-id: fdc0ab81-8fcb-42ca-febe-08dc801d761f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?B1SgSAzBcFPYaK4gCSte5uHgHaRGCqKdCuIAsnDtvo8DSftc8KsYy1bf4V+P?= =?us-ascii?Q?hHDze85di6BuvexdsFYVQH3TTAXkfVt9NMsfrB9WlbIOZkUaEQvmH66JbQyh?= =?us-ascii?Q?/gNeTzIsH9CLXiyVJfqOOfIUCm/t2q5jpWYrhDdCBnUTJ8siFAUpcaoD69fP?= =?us-ascii?Q?MUUfK7tBtI7874D1Xu888kzu3JulbUC8xwmcCXgGS/vh3LyuIysyvcARRgs4?= =?us-ascii?Q?jya3WdMidneYFJUaJmlS+VxGqR6hTb+8glhii5Am7WZiUZ2nC+7PtXivh0/L?= =?us-ascii?Q?wkUrBb0/AlXTmbznc9iltnkUNKI+SdXn2c8ply/J/Auc1/SpggMO3ceQZWbb?= =?us-ascii?Q?Kby5OX0dtrEADAKCx5EsAYUPaym+sGoZhsJL0O0hLLnMFDXbBjtQsfVhjQwx?= =?us-ascii?Q?hXdmjcuICMVBPUtTmwbTPGjl+xFqQwMcic3YHTQDmXzRqSugbX5VPjSRWng5?= =?us-ascii?Q?OT26QINOIWtv1IHygiIFK2WzTdjdRY2m3IyX3/UPLhe1eZfMUIVXG2YziGkD?= =?us-ascii?Q?DdRHUB8MVbZn7I2Cpima+YZuQu+CyFYED+pQhwKSVJQVgmV+6HaQ9eMjRKg3?= =?us-ascii?Q?gmBOoBy6O1TP3Hz8LTfQE9CH7GyuVLEy6TeYE6n9dIWk8cMXy+PEOxOiVMNV?= =?us-ascii?Q?kQTidJkcoU1fobkdei4/6Y+PdtvDyIQwyCpouf/UBNo1hwAzixftlCb+p2PP?= =?us-ascii?Q?HFDEY4uZC4g2XNGI4w6++/fCjIH0o6GIVvD3JpUq7tEiD7nvxELDLxKGe8mo?= =?us-ascii?Q?RI8H+vbJh+WMXmpr8zYbe86ymdqDkY9aM4C38+KC5WZKL4mqwBSozETCmBFT?= =?us-ascii?Q?WBlHeXL9qf8fJ5yiN0jaGhmRJiB/WkiAxzFvDa96feSkoK42t4W/KXs8n580?= =?us-ascii?Q?SZHi6di9a7yjpk8Pm8QpSTrD89LgyDbldTmmD3eLDR0Kvv6/hyzaUbbmXA1g?= =?us-ascii?Q?dFlz5et35+9SzakFF4ADqn08Ndwgd6Gk0BeCFoTSz90wBogbrz+Ph3IoU4c+?= =?us-ascii?Q?ct0F4hMr37PvTTpwDqrtEtlM9jZ2/r+JpSdF8XBIzMrsTDsrzg2zWbEC9GfL?= =?us-ascii?Q?mMG+9GWARA75dc+7VepFX7FitaVeoFeAfxhsrgDGtmCOk955DotCvDHxanTe?= =?us-ascii?Q?fNUKnCqSEGcmvBgAQHBJw5yLmi8nUvHlNrVa9xdrFB8cOLF0O2z7cGOYXZ9D?= =?us-ascii?Q?AnA5CVepv/Zo/+he96tIUQP1Hu19XqTW43ub80tXKz1aLUhY38fPz57gei7w?= =?us-ascii?Q?Tun/hLgI0gphfMrfL6eSUflMbLoR7MenPrs+XDg7fv9N5+TZPeSLwK0OSmvk?= =?us-ascii?Q?zFMWeaxwaaMy+32AYF9N/LTVqyCfcLVdScxbNRMKObiRtQ=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+XnkIb0Xbv7v0lwt4WMJFsbAauMDv8ASynpYwbRJ7P77cDiHtEK9AhXbxoBh?= =?us-ascii?Q?l9KLwQAVoy1cYDz1B589H+KONvjWIpx8v2ZQqdZWkvsBx2UcxJ+BcpALnAUx?= =?us-ascii?Q?hjOSA9lukM9ScTo4nX5DvTbxW4azkhIcBkYJoHm3TPVBQ8Cwt1QDGWaDsf3q?= =?us-ascii?Q?sSHsq5+guMrgg4oOknizt6v+OTaD/pB3ZtwHWwskeINFNryUBKxsCNE7/+Oq?= =?us-ascii?Q?F1QgWwx8rhySLDKRV3MTID5YcUxDv7fP9RiVFhSi1fSwFWgvpcFIhQqbaTrp?= =?us-ascii?Q?GI3y98nXi5SHlzzEKDvRQvThG18sn95+4k7+h/auQhXuooeZ4J3bfwdNbkt/?= =?us-ascii?Q?nBT3GWqF5v/osPVTr2nbhcj1odsEtm6p4nHCrxIoxY+2SUlmrMZV/lSunYac?= =?us-ascii?Q?NdMjdb2pYNOpKX/39f+jfacEnkjV+8nWPHfm7d9SWDRLVse6TQC/ZsmYyiaG?= =?us-ascii?Q?xbJitTfCzZvheVebYHlWycSkI/7M84AYAQq7wVwlE7rFbtsKar/Qig/mpBhU?= =?us-ascii?Q?Vhx3Auwpxm+t4nUFjTlHqepRLJOCemaWl8of1rbuHC49krRVRji60+TEks+o?= =?us-ascii?Q?CaDkrTVl56huafYlECevl2IzPY6WM3KPFd+Kwh9kLS6vzN/ntSSUQC0jZj5q?= =?us-ascii?Q?5wVGkfAY8NKY0V+AduyZTQNnf8l0bTt70MuvZfHSypC5lgq7wS4Ftte0E37s?= =?us-ascii?Q?r6pO6tunab18FGWe+xadRLLGf2fWe/g/jNiPLHiYhPG9/6JQv8GIyEhFPEa+?= =?us-ascii?Q?1YDuwB7vvAQ8z5VBkISOe8nluKOAbhiqfzeuyCjDlgXgnK32O6t41e2aw9ZT?= =?us-ascii?Q?QZtF+TTf2GvyZCgK85o6DAnFmdWLf37RPntdkj/E1cFcu0dAyp2vqIrFFHYh?= =?us-ascii?Q?CY/5b/S5jIl6zItkhr4ZSlEzvhlS+xFjTEPYBLcZTk4pKJWCzJxSqm9PNunz?= =?us-ascii?Q?NymVCw+kFUozODC2S8ESMZScJwvHa2hM631jQhZY1Qb2iNlgGG6UIB+xt0Qe?= =?us-ascii?Q?vUxSuktB8nqLnQIcKahn3alR7hhzk3F9b5AEyzV5bezXI73mY6SdmYEPdy/B?= =?us-ascii?Q?zq3xSnjnn8WQJv5VQ/Ix1j7OV77A1kf2bmURaeVyAWJaTNJrFG0b7qDSjBSh?= =?us-ascii?Q?JFk7sY9k/WqytfDSjbaDiaprCQnNF8yX3K6JnfAHc5MzPmxVaVY4FTzvQoVt?= =?us-ascii?Q?DtQ6bOZf0jORNHCWVAAsvv5zNV1sY7dJTYJtBaTLTiQbtwZ0v+jyg+d0mRUz?= =?us-ascii?Q?vzPqXgjChbpVU9N+LiZDQHEYzLQy3qQTY0NSMlPkdGdElrMqzdtfDbDZZq63?= =?us-ascii?Q?Q+EDyvZ16NgiQXS3zgum2HOTI0rwuwPjf0Nm6Y1IDIOqIwr5vwGR+Vbn79Zb?= =?us-ascii?Q?TdFbsndKEF34NvEpdfqyAXn3+3wixUTMpPg59t6W3ITUOoKZU0GZrqE+N3Mu?= =?us-ascii?Q?5+vcN5HvAwEMJmcxBamHSQlWcIbibj1yfWBuE79tDAbtXu8gIVkR/KMjoqjx?= =?us-ascii?Q?yejZFWZ3KsrKYwIFjK7j0V/VRc/TgSKceWaSCcQNi4kUVuI5oVluSPgPDwO6?= =?us-ascii?Q?buJCxRbfh+udGJOMILHPLgfySX8ne84Af5v/TYOS?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdc0ab81-8fcb-42ca-febe-08dc801d761f X-MS-Exchange-CrossTenant-originalarrivaltime: 29 May 2024 20:25:20.3413 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CAHs3zYF8NRJszLiyVGPTAGGStBreF72GeSTPtSFc3E8XuG6oZKVnaObTs17V6Kb/yUu43Sml1fBUr8uU+KsRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5805 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 29 May 2024 13:25:26 -0700 Resent-From: chasel.chiu@intel.com Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: kq7vydGdTJUFpE4MmCywfp08x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=OC9bUhsD; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi Linus, Some comments below inline. Thanks, Chasel > -----Original Message----- > From: Liu, Linus > Sent: Thursday, May 23, 2024 9:14 PM > To: devel@edk2.groups.io > Cc: Lin, Benny ; Guo, Gua ; Chiu, > Chasel ; Lu, James ; Dhaval > Sharma > Subject: [PATCH v3 5/6] UefiPayloadPkg: Add FDT Paser relative LIBs. >=20 > Add FDTParser and CustomFdtNodePaser > to retrive all FDT node and create the relate hobs. >=20 > Cc: Benny Lin > Cc: Gua Guo > Cc: Chasel Chiu > Cc: James Lu > Cc: Dhaval Sharma >=20 > Signed-off-by: Linus Liu > --- > UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.c > | 158 +++++ >=20 > UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserNul > lLib.c | 51 ++ > UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c = | 622 > ++++++++++++++++++++ > UefiPayloadPkg/Library/HobParseLib/HobParseLib.c = | 408 > +++++++++++++ > UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.inf > | 46 ++ >=20 > UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserNul > lLib.inf | 33 ++ > UefiPayloadPkg/Library/FdtParserLib/FdtParseLib.inf = | 63 ++ > UefiPayloadPkg/Library/HobParseLib/HobParseLib.inf = | 40 ++ > 8 files changed, 1421 insertions(+) >=20 > diff --git > a/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.c > b/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.c > new file mode 100644 > index 000000000000..d1376d21c5dd > --- /dev/null > +++ > b/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.c > @@ -0,0 +1,158 @@ > +/** @file >=20 > + Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +**/ >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +/** >=20 > + Add a new HOB to the HOB List. >=20 > + >=20 > + @param HobType Type of the new HOB. >=20 > + @param HobLength Length of the new HOB to allocate. >=20 > + >=20 > + @return NULL if there is no space to create a hob. >=20 > + @return The address point to the new created hob. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +CreateHob ( >=20 > + IN UINT16 HobType, >=20 > + IN UINT16 HobLength >=20 > + ); >=20 > + >=20 > +/** >=20 > + Add HOB into HOB list >=20 > + @param[in] Hob The HOB to be added into the HOB list. >=20 > +**/ >=20 > +VOID >=20 > +AddNewHob ( >=20 > + IN EFI_PEI_HOB_POINTERS *Hob >=20 > + ); >=20 > + >=20 > +/** >=20 > + Check the HOB and decide if it is need inside Payload >=20 > + Payload maintainer may make decision which HOB is need or needn't >=20 > + Then add the check logic in the function. >=20 > + @param[in] Hob The HOB to check >=20 > + @retval TRUE If HOB is need inside Payload >=20 > + @retval FALSE If HOB is needn't inside Payload >=20 > +**/ >=20 > +BOOLEAN >=20 > +EFIAPI >=20 > +FitIsHobNeed ( >=20 > + EFI_PEI_HOB_POINTERS Hob >=20 > + ) >=20 > +{ >=20 > + if (FixedPcdGetBool (PcdHandOffFdtEnable)) { >=20 > + if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_HANDOFF) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_MEMORY_ALLOCATION) { >=20 > + if (CompareGuid (&Hob.MemoryAllocation->AllocDescriptor.Name, > &gUniversalPayloadDeviceTreeGuid)) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (CompareGuid (&Hob.MemoryAllocationModule- > >MemoryAllocationHeader.Name, &gEfiHobMemoryAllocModuleGuid)) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if ((Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiReservedMemoryType) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiBootServicesCode) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiBootServicesData) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiRuntimeServicesCode) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiRuntimeServicesData) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiACPIReclaimMemory) || >=20 > + (Hob.MemoryAllocation->AllocDescriptor.MemoryType =3D=3D > EfiACPIMemoryNVS)) >=20 > + { >=20 > + return FALSE; >=20 > + } >=20 > + } >=20 > + >=20 > + if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_GUID_EXTENSION) { >=20 > + if (CompareGuid (&Hob.Guid->Name, > &gUniversalPayloadSerialPortInfoGuid)) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (CompareGuid (&Hob.Guid->Name, &gUniversalPayloadAcpiTableGuid)= ) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (CompareGuid (&Hob.Guid->Name, > &gUniversalPayloadPciRootBridgeInfoGuid)) { >=20 > + return FALSE; >=20 > + } >=20 > + } >=20 > + } >=20 > + >=20 > + // Arrive here mean the HOB is need >=20 > + return TRUE; >=20 > +} >=20 > + >=20 > +/** >=20 > + It will Parse FDT -custom node based on information from bootloaders. >=20 > + @param[in] FdtBase The starting memory address of FdtBase >=20 > + @param[in] HobList The starting memory address of New Hob list. >=20 > + >=20 > +**/ >=20 > +UINTN >=20 > +EFIAPI >=20 > +CustomFdtNodeParser ( >=20 > + IN VOID *FdtBase, >=20 > + IN VOID *HobList >=20 > + ) >=20 > +{ >=20 > + INT32 Node, CustomNode; >=20 > + INT32 TempLen; >=20 > + UINT64 *Data64; >=20 > + UINTN CHobList; >=20 > + CONST FDT_PROPERTY *PropertyPtr; >=20 > + EFI_PEI_HOB_POINTERS Hob; >=20 > + >=20 > + CHobList =3D (UINTN)HobList; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "%a() #1 \n", __func__)); >=20 > + >=20 > + // >=20 > + // Look for if exists hob list node >=20 > + // >=20 > + Node =3D FdtSubnodeOffsetNameLen (FdtBase, 0, "options", (INT32)AsciiS= trLen > ("options")); >=20 > + if (Node > 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found options node (%08X)", Node)); >=20 > + CustomNode =3D FdtSubnodeOffsetNameLen (FdtBase, Node, "upl-custom", > (INT32)AsciiStrLen ("upl-custom")); >=20 > + if (CustomNode > 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found upl-custom node (%08X)", CustomNode))= ; >=20 > + PropertyPtr =3D FdtGetProperty (FdtBase, CustomNode, "hoblistptr", > &TempLen); >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + CHobList =3D (UINTN)Fdt64ToCpu (*Data64); >=20 > + DEBUG ((DEBUG_INFO, " Found hob list node (%08X)", CustomNode)); >=20 > + DEBUG ((DEBUG_INFO, " -pointer %016lX\n", CHobList)); >=20 > + } >=20 > + } >=20 > + >=20 > + Hob.Raw =3D (UINT8 *)CHobList; >=20 > + >=20 > + // >=20 > + // Since payload created new Hob, move all hobs except PHIT from boot = loader > hob list. >=20 > + // >=20 > + while (!END_OF_HOB_LIST (Hob)) { >=20 > + if (FitIsHobNeed (Hob)) { >=20 > + // Add this hob to payload HOB >=20 > + AddNewHob (&Hob); >=20 > + } >=20 > + >=20 > + Hob.Raw =3D GET_NEXT_HOB (Hob); >=20 > + } >=20 > + >=20 > + return CHobList; >=20 > +} >=20 > diff --git > a/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.c > b/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.c > new file mode 100644 > index 000000000000..0012162fa0d2 > --- /dev/null > +++ > b/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.c > @@ -0,0 +1,51 @@ > +/** @file >=20 > + Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +**/ >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#include >=20 > +#include >=20 > + >=20 > +/** >=20 > + Check the HOB and decide if it is need inside Payload >=20 > + Payload maintainer may make decision which HOB is need or needn't >=20 > + Then add the check logic in the function. >=20 > + @param[in] Hob The HOB to check >=20 > + @retval TRUE If HOB is need inside Payload >=20 > + @retval FALSE If HOB is needn't inside Payload >=20 > +**/ >=20 > +BOOLEAN >=20 > +FitIsHobNeed ( >=20 > + EFI_PEI_HOB_POINTERS Hob >=20 > + ) >=20 > +{ >=20 > + return FALSE; >=20 > +} >=20 > + >=20 > +/** >=20 > + It will Parse FDT -custom node based on information from bootloaders. >=20 > + @param[in] FdtBase The starting memory address of FdtBase. >=20 > + @param[in] HobList The starting memory address of New Hob list. >=20 > + @retval HobList The base address of Hoblist. >=20 > + >=20 > +**/ >=20 > +UINTN >=20 > +CustomFdtNodeParser ( >=20 > + IN VOID *Fdt, >=20 > + IN VOID *HobList >=20 > + ) >=20 > +{ >=20 > + UINTN CHobList; >=20 > + >=20 > + if (HobList !=3D NULL) { >=20 > + CHobList =3D (UINTN)HobList; >=20 > + } >=20 > + >=20 > + return CHobList; >=20 > +} >=20 > diff --git a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c > b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c > new file mode 100644 > index 000000000000..c18e36661438 > --- /dev/null > +++ b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c > @@ -0,0 +1,622 @@ > +/** @file >=20 > + Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#define MEMORY_ATTRIBUTE_DEFAULT > (EFI_RESOURCE_ATTRIBUTE_PRESENT | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_INITIALIZED = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_TESTED = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBIN= EABLE | \ >=20 > + > EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_C= ACHEABLE ) >=20 > + >=20 > +#define ROOT_BRIDGE_SUPPORTS_DEFAULT > (EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_VGA_IO | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_ISA_IO | \ >=20 > + EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO ) >=20 > + >=20 > +extern VOID *mHobList; >=20 > + >=20 > +/** >=20 > + Build ACPI board info HOB using infomation from ACPI table >=20 > + >=20 > + @param AcpiTableBase ACPI table start address in memory >=20 > + >=20 > + @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HO= B > failure. >=20 > +**/ >=20 > +ACPI_BOARD_INFO * >=20 > +BuildHobFromAcpi ( >=20 > + IN UINT64 AcpiTableBase >=20 > + ); >=20 > + >=20 > +/** >=20 > + Build a Handoff Information Table HOB >=20 > + >=20 > + This function initialize a HOB region from EfiMemoryBegin to >=20 > + EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should >=20 > + be inside the HOB region. >=20 > + >=20 > + @param[in] EfiMemoryBottom Total memory start address >=20 > + @param[in] EfiMemoryTop Total memory end address. >=20 > + @param[in] EfiFreeMemoryBottom Free memory start address >=20 > + @param[in] EfiFreeMemoryTop Free memory end address. >=20 > + >=20 > + @return The pointer to the handoff HOB table. >=20 > + >=20 > +**/ >=20 > +EFI_HOB_HANDOFF_INFO_TABLE * >=20 > +EFIAPI >=20 > +HobConstructor ( >=20 > + IN VOID *EfiMemoryBottom, >=20 > + IN VOID *EfiMemoryTop, >=20 > + IN VOID *EfiFreeMemoryBottom, >=20 > + IN VOID *EfiFreeMemoryTop >=20 > + ); >=20 > + >=20 > +/** >=20 > + It will parse FDT based on DTB from bootloaders. >=20 > + >=20 > + @param[in] FdtBase Address of the Fdt data. >=20 > + >=20 > + @return The address to the new hob list >=20 > +**/ >=20 > +UINTN >=20 > +EFIAPI >=20 > +ParseDtb ( >=20 > + IN VOID *FdtBase >=20 > + ) >=20 > +{ >=20 > + VOID *Fdt; >=20 > + INT32 Node; >=20 > + INT32 Property; >=20 > + INT32 Depth; >=20 > + FDT_NODE_HEADER *NodePtr; >=20 > + CONST FDT_PROPERTY *PropertyPtr; >=20 > + CONST CHAR8 *TempStr; >=20 > + INT32 TempLen; >=20 > + UINT32 *Data32; >=20 > + UINT64 *Data64; >=20 > + UINT64 StartAddress; >=20 > + INT32 SubNode; >=20 > + UINT64 NumberOfBytes; >=20 > + UINT32 Attribute; >=20 > + UINT8 ECCAttribute; >=20 > + UINT32 ECCData, ECCData2; >=20 > + UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *Serial; >=20 > + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PciRootBridgeInfo; >=20 > + UNIVERSAL_PAYLOAD_ACPI_TABLE *PlatformAcpiTable; >=20 > + UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable; >=20 > + UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL *DebugPrintErrorLevelInfo; >=20 > + UNIVERSAL_PAYLOAD_BASE *PayloadBase; >=20 > + EFI_PEI_GRAPHICS_INFO_HOB *GraphicsInfo; >=20 > + EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GraphicsDev; >=20 > + UINT8 SizeOfMemorySpace; >=20 > + UINT64 FrameBufferBase; >=20 > + UINT64 FrameBufferSize; >=20 > + UINTN MinimalNeededSize; >=20 > + EFI_PHYSICAL_ADDRESS FreeMemoryBottom; >=20 > + EFI_PHYSICAL_ADDRESS FreeMemoryTop; >=20 > + EFI_PHYSICAL_ADDRESS MemoryBottom; >=20 > + EFI_PHYSICAL_ADDRESS MemoryTop; >=20 > + BOOLEAN IsHobConstructed; >=20 > + UINTN NewHobList; >=20 > + UINT8 RootBridgeCount; >=20 > + UINT8 index; >=20 > + UINTN HobDataSize; >=20 > + >=20 > + Fdt =3D FdtBase; >=20 > + Depth =3D 0; >=20 > + FrameBufferBase =3D 0; >=20 > + FrameBufferSize =3D 0; >=20 > + MinimalNeededSize =3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); >=20 > + IsHobConstructed =3D FALSE; >=20 > + NewHobList =3D 0; >=20 > + PlatformAcpiTable =3D NULL; >=20 > + SmbiosTable =3D NULL; >=20 > + PciRootBridgeInfo =3D NULL; >=20 > + RootBridgeCount =3D 0; >=20 > + index =3D 1; >=20 > + HobDataSize =3D 0; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "FDT =3D 0x%x %x\n", Fdt, Fdt32ToCpu (*((UINT32 > *)Fdt)))); >=20 > + DEBUG ((DEBUG_INFO, "Start parsing DTB data\n")); >=20 > + DEBUG ((DEBUG_INFO, "MinimalNeededSize :%x\n", MinimalNeededSize)); >=20 > + >=20 > + for (Node =3D FdtNextNode (Fdt, 0, &Depth); Node >=3D 0; Node =3D FdtN= extNode > (Fdt, Node, &Depth)) { >=20 > + if (Depth !=3D 1) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + NodePtr =3D (FDT_NODE_HEADER *)((CONST CHAR8 *)Fdt + Node + Fdt32ToC= pu > (((FDT_HEADER *)Fdt)->OffsetDtStruct)); >=20 > + DEBUG ((DEBUG_INFO, "\n Node(%08x) %a Depth %x", Node, NodePtr- > >Name, Depth)); >=20 > + // memory node >=20 > + if (AsciiStrnCmp (NodePtr->Name, "memory@", AsciiStrLen ("memory@"))= =3D=3D > 0) { >=20 > + for (Property =3D FdtFirstPropertyOffset (Fdt, Node); Property >= =3D 0; Property =3D > FdtNextPropertyOffset (Fdt, Property)) { >=20 > + PropertyPtr =3D FdtGetPropertyByOffset (Fdt, Property, &TempLen)= ; >=20 > + TempStr =3D FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->Name= Offset), > NULL); >=20 > + if (AsciiStrCmp (TempStr, "reg") =3D=3D 0) { >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + StartAddress =3D Fdt64ToCpu (*Data64); >=20 > + NumberOfBytes =3D Fdt64ToCpu (*(Data64 + 1)); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property,= TempStr)); >=20 > + DEBUG ((DEBUG_INFO, " %016lX %016lX", StartAddress, > NumberOfBytes)); >=20 > + if (!IsHobConstructed) { >=20 > + if ((NumberOfBytes > MinimalNeededSize) && (StartAddress < > BASE_4GB)) { >=20 > + MemoryBottom =3D StartAddress + NumberOfBytes - > MinimalNeededSize; >=20 > + FreeMemoryBottom =3D MemoryBottom; >=20 > + FreeMemoryTop =3D StartAddress + NumberOfBytes; >=20 > + MemoryTop =3D FreeMemoryTop; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "MemoryBottom :0x%llx\n", MemoryBottom= )); >=20 > + DEBUG ((DEBUG_INFO, "FreeMemoryBottom :0x%llx\n", > FreeMemoryBottom)); >=20 > + DEBUG ((DEBUG_INFO, "FreeMemoryTop :0x%llx\n", FreeMemoryT= op)); >=20 > + DEBUG ((DEBUG_INFO, "MemoryTop :0x%llx\n", MemoryTop)); >=20 > + mHobList =3D HobConstructor ((VOID *)(UINTN)Memor= yBottom, > (VOID *)(UINTN)MemoryTop, (VOID *)(UINTN)FreeMemoryBottom, (VOID > *)(UINTN)FreeMemoryTop); >=20 > + IsHobConstructed =3D TRUE; >=20 > + NewHobList =3D (UINTN)mHobList; >=20 > + break; >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > + } // end of memory node >=20 > + else if (AsciiStrnCmp (NodePtr->Name, "pci-rb", AsciiStrLen ("pci-rb= ")) =3D=3D 0) { >=20 > + RootBridgeCount++; >=20 > + } >=20 > + } >=20 > + >=20 > + Depth =3D 0; >=20 > + for (Node =3D FdtNextNode (Fdt, 0, &Depth); Node >=3D 0; Node =3D FdtN= extNode > (Fdt, Node, &Depth)) { >=20 > + if (Depth !=3D 1) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + NodePtr =3D (FDT_NODE_HEADER *)((CONST CHAR8 *)Fdt + Node + Fdt32ToC= pu > (((FDT_HEADER *)Fdt)->OffsetDtStruct)); >=20 > + DEBUG ((DEBUG_INFO, "\n Node(%08x) %a Depth %x", Node, NodePtr- > >Name, Depth)); >=20 > + >=20 > + // memory node >=20 > + if (AsciiStrnCmp (NodePtr->Name, "memory@", AsciiStrLen ("memory@"))= =3D=3D > 0) { >=20 > + Attribute =3D MEMORY_ATTRIBUTE_DEFAULT; >=20 > + ECCAttribute =3D 0; >=20 > + ECCData =3D ECCData2 =3D 0; >=20 > + for (Property =3D FdtFirstPropertyOffset (Fdt, Node); Property >= =3D 0; Property =3D > FdtNextPropertyOffset (Fdt, Property)) { >=20 > + PropertyPtr =3D FdtGetPropertyByOffset (Fdt, Property, &TempLen)= ; >=20 > + TempStr =3D FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->Name= Offset), > NULL); >=20 > + if (AsciiStrCmp (TempStr, "reg") =3D=3D 0) { >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + StartAddress =3D Fdt64ToCpu (*Data64); >=20 > + NumberOfBytes =3D Fdt64ToCpu (*(Data64 + 1)); >=20 > + } else if (AsciiStrCmp (TempStr, "ecc-detection-bits") =3D=3D 0)= { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + ECCData =3D Fdt32ToCpu (*Data32); >=20 > + } else if (AsciiStrCmp (TempStr, "ecc-correction-bits") =3D=3D 0= ) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + ECCData2 =3D Fdt32ToCpu (*Data32); >=20 > + } >=20 > + } >=20 > + >=20 > + if (ECCData =3D=3D ECCData2) { >=20 > + if (ECCData =3D=3D 1) { >=20 > + ECCAttribute =3D EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC; >=20 > + } else if (ECCData =3D=3D 2) { >=20 > + ECCAttribute =3D EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC; >=20 > + } >=20 > + } >=20 > + >=20 > + if (ECCAttribute !=3D 0) { >=20 > + Attribute |=3D ECCAttribute; >=20 > + } >=20 > + >=20 > + BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, Attribute, > StartAddress, NumberOfBytes); >=20 > + } // end of memory node >=20 > + // reserved-memory >=20 > + else if (AsciiStrCmp (NodePtr->Name, "reserved-memory") =3D=3D 0) { >=20 > + for (SubNode =3D FdtFirstSubnode (Fdt, Node); SubNode >=3D 0; SubN= ode =3D > FdtNextSubnode (Fdt, SubNode)) { >=20 > + NodePtr =3D (FDT_NODE_HEADER *)((CONST CHAR8 *)Fdt + SubNode + > Fdt32ToCpu (((FDT_HEADER *)Fdt)->OffsetDtStruct)); >=20 > + DEBUG ((DEBUG_INFO, "\n SubNode(%08X) %a", SubNode, NodePt= r- > >Name)); >=20 > + >=20 > + PropertyPtr =3D FdtGetProperty (Fdt, SubNode, "reg", &TempLen); >=20 > + ASSERT (TempLen > 0); >=20 > + if (TempLen > 0) { >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + StartAddress =3D Fdt64ToCpu (*Data64); >=20 > + NumberOfBytes =3D Fdt64ToCpu (*(Data64 + 1)); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property,= TempStr)); >=20 > + DEBUG ((DEBUG_INFO, " %016lX %016lX", StartAddress, > NumberOfBytes)); >=20 > + } >=20 > + >=20 > + if (AsciiStrnCmp (NodePtr->Name, "mmio@", AsciiStrLen ("mmio@"))= =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " MemoryMappedIO")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiMemoryMappedIO); >=20 > + } else { >=20 > + PropertyPtr =3D FdtGetProperty (Fdt, SubNode, "compatible", &T= empLen); >=20 > + if (!(TempLen > 0)) { >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiReservedMemoryType); >=20 > + continue; >=20 > + } >=20 > + >=20 > + TempStr =3D (CHAR8 *)(PropertyPtr->Data); >=20 > + >=20 > + if (AsciiStrnCmp (TempStr, "boot-code", AsciiStrLen ("boot-cod= e")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " boot-code")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiBootServicesCode); >=20 > + } else if (AsciiStrnCmp (TempStr, "boot-data", AsciiStrLen ("b= oot-data")) =3D=3D > 0) { >=20 > + DEBUG ((DEBUG_INFO, " boot-data")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiBootServicesData); >=20 > + } else if (AsciiStrnCmp (TempStr, "runtime-code", AsciiStrLen = ("runtime- > code")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " runtime-code")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiRuntimeServicesCode); >=20 > + } else if (AsciiStrnCmp (TempStr, "runtime-data", AsciiStrLen = ("runtime- > data")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " runtime-data")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiRuntimeServicesData); >=20 > + } else if (AsciiStrnCmp (TempStr, "acpi", AsciiStrLen ("acpi")= ) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " acpi, StartAddress:%x, NumberOfBytes:= %x", > StartAddress, NumberOfBytes)); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiBootServicesData); >=20 > + PlatformAcpiTable =3D BuildGuidHob (&gUniversalPayloadAcpiTa= bleGuid, > sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE)); >=20 > + if (PlatformAcpiTable !=3D NULL) { >=20 > + DEBUG ((DEBUG_INFO, " build gUniversalPayloadAcpiTableGuid= , > NumberOfBytes:%x", NumberOfBytes)); >=20 > + PlatformAcpiTable->Rsdp =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)StartAddress; >=20 > + PlatformAcpiTable->Header.Revision =3D > UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION; >=20 > + PlatformAcpiTable->Header.Length =3D sizeof > (UNIVERSAL_PAYLOAD_ACPI_TABLE); >=20 > + } >=20 > + } else if (AsciiStrnCmp (TempStr, "acpi-nvs", AsciiStrLen ("ac= pi-nvs")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " acpi-nvs")); >=20 > + BuildMemoryAllocationHob (StartAddress, NumberOfBytes, > EfiACPIMemoryNVS); >=20 > + } else if (AsciiStrnCmp (TempStr, "smbios", AsciiStrLen ("smbi= os")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " build smbios, NumberOfBytes:%x", > NumberOfBytes)); >=20 > + SmbiosTable =3D BuildGuidHob (&gUniversalPayloadSmbios3Table= Guid, > sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE) + sizeof > (SMBIOS_TABLE_3_0_ENTRY_POINT)); >=20 > + if (SmbiosTable !=3D NULL) { >=20 > + SmbiosTable->Header.Revision =3D > UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION; >=20 > + SmbiosTable->Header.Length =3D sizeof > (UNIVERSAL_PAYLOAD_SMBIOS_TABLE); >=20 > + SmbiosTable->SmBiosEntryPoint =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)(&StartAddress); >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > + } // end of reserved-memory >=20 > + >=20 > + if (AsciiStrnCmp (NodePtr->Name, "serial@", AsciiStrLen ("serial@"))= =3D=3D 0) { >=20 > + // >=20 > + // Create SerialPortInfo HOB. >=20 > + // >=20 > + Serial =3D BuildGuidHob (&gUniversalPayloadSerialPortInfoGuid, siz= eof > (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO)); >=20 > + ASSERT (Serial !=3D NULL); >=20 > + if (Serial =3D=3D NULL) { >=20 > + break; >=20 > + } >=20 > + >=20 > + Serial->Header.Revision =3D > UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION; >=20 > + Serial->Header.Length =3D sizeof > (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO); >=20 > + Serial->RegisterStride =3D 1; >=20 > + >=20 > + for (Property =3D FdtFirstPropertyOffset (Fdt, Node); Property >= =3D 0; Property =3D > FdtNextPropertyOffset (Fdt, Property)) { >=20 > + PropertyPtr =3D FdtGetPropertyByOffset (Fdt, Property, &TempLen)= ; >=20 > + TempStr =3D FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->Name= Offset), > NULL); >=20 > + if (AsciiStrCmp (TempStr, "current-speed") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property,= TempStr)); >=20 > + DEBUG ((DEBUG_INFO, " %X", Fdt32ToCpu (*Data32))); >=20 > + >=20 > + Serial->BaudRate =3D Fdt32ToCpu (*Data32); >=20 > + } else if (AsciiStrCmp (TempStr, "reg") =3D=3D 0) { >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + StartAddress =3D Fdt64ToCpu (*(Data64 + 1)); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property,= TempStr)); >=20 > + DEBUG ((DEBUG_INFO, " %016lX", StartAddress)); >=20 > + >=20 > + Serial->RegisterBase =3D StartAddress; >=20 > + } else if (AsciiStrCmp (TempStr, "reg-io-width") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property,= TempStr)); >=20 > + DEBUG ((DEBUG_INFO, " %X", Fdt32ToCpu (*Data32))); >=20 > + Serial->UseMmio =3D Fdt32ToCpu (*(Data32)) =3D=3D 4 ? TRUE : F= ALSE; reg-io-width is reg data width, not reg base address width, so UPL has to r= ely on address-cells=3D3 to know base address type from the reg property. Please help to correct this and we require address-cells=3D3 for those UPL = consumed nodes which having reg or ranges properties. >=20 > + } >=20 > + } >=20 > + } else if (AsciiStrCmp (NodePtr->Name, "graphic") =3D=3D 0) { >=20 > + // >=20 > + // Create GraphicInfo HOB. >=20 > + // >=20 > + GraphicsInfo =3D BuildGuidHob (&gEfiGraphicsInfoHobGuid, sizeof > (EFI_PEI_GRAPHICS_INFO_HOB)); >=20 > + ASSERT (GraphicsInfo !=3D NULL); >=20 > + if (GraphicsInfo =3D=3D NULL) { >=20 > + break; >=20 > + } >=20 > + >=20 > + GraphicsDev =3D BuildGuidHob (&gEfiGraphicsDeviceInfoHobGuid, size= of > (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB)); >=20 > + ASSERT (GraphicsDev !=3D NULL); >=20 > + if (GraphicsDev =3D=3D NULL) { >=20 > + break; >=20 > + } >=20 > + >=20 > + if (FrameBufferBase !=3D 0) { >=20 > + GraphicsInfo->FrameBufferBase =3D FrameBufferBase; >=20 > + } >=20 > + >=20 > + if (FrameBufferSize !=3D 0) { >=20 > + GraphicsInfo->FrameBufferSize =3D (UINT32)FrameBufferSize; >=20 > + } >=20 > + >=20 > + for (Property =3D FdtFirstPropertyOffset (Fdt, Node); Property >= =3D 0; Property =3D > FdtNextPropertyOffset (Fdt, Property)) { >=20 > + PropertyPtr =3D FdtGetPropertyByOffset (Fdt, Property, &TempLen)= ; >=20 > + TempStr =3D FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->Name= Offset), > NULL); >=20 > + if (AsciiStrCmp (TempStr, "resolution") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)= (PropertyPtr->Data); >=20 > + GraphicsInfo->GraphicsMode.HorizontalResolution =3D Fdt32ToCpu > (*Data32); >=20 > + GraphicsInfo->GraphicsMode.VerticalResolution =3D Fdt32ToCpu= (*(Data32 > + 1)); >=20 > + } else if (AsciiStrCmp (TempStr, "pixel-format") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(Property= Ptr->Data); >=20 > + GraphicsInfo->GraphicsMode.PixelFormat =3D Fdt32ToCpu (*Data32= ); >=20 > + } else if (AsciiStrCmp (TempStr, "pixel-mask") =3D=3D 0) { >=20 > + Data32 =3D (UIN= T32 *)(PropertyPtr->Data); >=20 > + GraphicsInfo->GraphicsMode.PixelInformation.RedMask =3D Fdt3= 2ToCpu > (*Data32); >=20 > + GraphicsInfo->GraphicsMode.PixelInformation.GreenMask =3D Fdt3= 2ToCpu > (*(Data32 + 1)); >=20 > + GraphicsInfo->GraphicsMode.PixelInformation.BlueMask =3D Fdt3= 2ToCpu > (*(Data32 + 2)); >=20 > + } else if (AsciiStrCmp (TempStr, "pixe-scanline") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(Pr= opertyPtr->Data); >=20 > + GraphicsInfo->GraphicsMode.PixelsPerScanLine =3D Fdt32ToCpu (*= Data32); >=20 > + } else if (AsciiStrCmp (TempStr, "id") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + GraphicsDev->VendorId =3D Fdt32ToCpu (*Data32) >> 16; >=20 > + GraphicsDev->DeviceId =3D Fdt32ToCpu (*Data32) & 0xffff; >=20 > + } else if (AsciiStrCmp (TempStr, "subsystem-id") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Dat= a); >=20 > + GraphicsDev->SubsystemVendorId =3D Fdt32ToCpu (*Data32) >> 16; >=20 > + GraphicsDev->SubsystemId =3D Fdt32ToCpu (*Data32) & 0xff= ff; >=20 > + } else if (AsciiStrCmp (TempStr, "revision-id") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + GraphicsDev->RevisionId =3D (UINT8)Fdt32ToCpu (*Data32); >=20 > + } else if (AsciiStrCmp (TempStr, "bar-index") =3D=3D 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + GraphicsDev->BarIndex =3D (UINT8)Fdt32ToCpu (*Data32); >=20 > + } >=20 Per UPL specification, 'graphic' node should be 'framebuffer' node, example= as below: 1. Fill HOB frameBufferBase/Size by FDT framebuffer->reg 2. Fill HOB for X and Y: GraphicsInfo->GraphicsMode.HorizontalResolution =3D framebuffer->width=20 GraphicsInfo->GraphicsMode.VerticalResolution =3D framebuffer->height 3. use framebuffer->format property to fill PixelFormat: GraphicsInfo->GraphicsMode.PixelFormat : framebuffer->format: PixelRedGreenBlueReserved8BitPerColor : 'a8r8g8b8' PixelBlueGreenRedReserved8BitPerColor : 'a8b8g8r8' PixelFormatMax (Unsupported by current UefiPayload) : 'a16b16g16r16' 4. HOB PixelInformation (BitMask) currently is not used by UPL, you may kee= p them as 0. 5. Fill HOB PixelsPerScanLine GraphicsInfo->GraphicsMode.PixelsPerScanLine =3D framebuffer->stride 6. GraphicsDev HOB is for PCI GFX device only and all fields should be fill= ed by "PCI GFX device node", which will be pointed by framebuffer->display.= Below is example of PCI GFX node rb@E0000000 { compatible =3D "pci-host-ecam-generic"; reg =3D <...> ranges =3D <...>; gma@E0010000 { /* gfx device 00:02:00 */ vendor-id =3D <0x8086> device-id =3D <0x4680> revision-id =3D <0x4> subsystem-vendor-id =3D <0x8086> subsystem-id =3D <0x2212> }; }; }; framebuffer@b0000000 { compatible =3D "simple-framebuffer"; reg =3D <0x82000000, 0x0, 0xb0000000, 0x400, 0x500000>; //base 0xB00000= 00, size=3D0x4000500000 width =3D <3840>; height =3D <2160>; format =3D "a8r8g8b8"; display =3D <&gma>; }; Note1: GraphicsDev HOB default is all 0xFF, please SetMem() of this buffer = to 0xFF before parsing FDT nodes. Note2: GraphicsDev->BarIndex is not part of standard DT PCI binding, so lea= ve it as default 0xFF. > + } >=20 > + } else if (AsciiStrCmp (NodePtr->Name, "options") =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found options node (%08X)", Node)); >=20 > + >=20 > + for (SubNode =3D FdtFirstSubnode (Fdt, Node); SubNode >=3D 0; SubN= ode =3D > FdtNextSubnode (Fdt, SubNode)) { >=20 > + NodePtr =3D (FDT_NODE_HEADER *)((CONST CHAR8 *)Fdt + SubNode + > Fdt32ToCpu (((FDT_HEADER *)Fdt)->OffsetDtStruct)); >=20 > + DEBUG ((DEBUG_INFO, "\n SubNode(%08X) %a", SubNode, NodePt= r- > >Name)); >=20 > + >=20 > + if (AsciiStrnCmp (NodePtr->Name, "upl-images@", AsciiStrLen ("up= l- > images@")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found image@ node \n")); >=20 > + // >=20 > + // Build PayloadBase HOB . >=20 > + // >=20 > + PayloadBase =3D BuildGuidHob (&gUniversalPayloadBaseGuid, size= of > (UNIVERSAL_PAYLOAD_BASE)); >=20 > + ASSERT (PayloadBase !=3D NULL); >=20 > + if (PayloadBase =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + PayloadBase->Header.Revision =3D UNIVERSAL_PAYLOAD_BASE_REVISI= ON; >=20 > + PayloadBase->Header.Length =3D sizeof (UNIVERSAL_PAYLOAD_BAS= E); >=20 > + >=20 > + PropertyPtr =3D FdtGetProperty (Fdt, SubNode, "addr", &TempLen= ); >=20 > + >=20 > + ASSERT (TempLen > 0); >=20 > + if (TempLen > 0) { >=20 > + Data64 =3D (UINT64 *)(PropertyPtr->Data); >=20 > + StartAddress =3D Fdt64ToCpu (*Data64); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(00000000) entry"))= ; >=20 > + DEBUG ((DEBUG_INFO, " %016lX\n", StartAddress)); >=20 > + >=20 > + PayloadBase->Entry =3D (EFI_PHYSICAL_ADDRESS)StartAddress; >=20 > + } >=20 > + } >=20 > + >=20 > + if (AsciiStrnCmp (NodePtr->Name, "upl-params", AsciiStrLen ("upl= -params")) > =3D=3D 0) { >=20 > + PropertyPtr =3D FdtGetProperty (Fdt, SubNode, "address_width",= &TempLen); >=20 > + if (TempLen > 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(00000000) address_= width")); >=20 > + DEBUG ((DEBUG_INFO, " %X", Fdt32ToCpu (*Data32))); >=20 > + SizeOfMemorySpace =3D (UINT8)Fdt32ToCpu (*Data32); >=20 > + #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) >=20 > + BuildCpuHob (SizeOfMemorySpace, 16); >=20 > + #else >=20 > + BuildCpuHob (SizeOfMemorySpace, 0); >=20 > + #endif >=20 > + } >=20 1. We also need to fill BootMode from FDT upl-params->BootMode: convert upl-params->boot-mode string to bootmode_enum (EFI_HOB_HANDOFF_INFO_TABLE) (UINTN) mHobList->BootMode =3D bootmode_enum= ; 2. UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES->ResourceAssigned HOB data should be = filled by upl-params->pci-enum-done (when present, set to 1) > + } >=20 > + } >=20 > + } >=20 > + // Optional >=20 > + else if (AsciiStrnCmp (NodePtr->Name, "pci-rb", AsciiStrLen ("pci-rb= ")) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found pci-rb node (%08X)", Node)); >=20 > + >=20 > + HobDataSize =3D sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES) + > RootBridgeCount *sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE); >=20 > + // >=20 > + // Create PCI Root Bridge Info Hob. >=20 > + // >=20 > + if (PciRootBridgeInfo =3D=3D NULL) { >=20 > + PciRootBridgeInfo =3D BuildGuidHob > (&gUniversalPayloadPciRootBridgeInfoGuid, HobDataSize); >=20 > + ASSERT (PciRootBridgeInfo !=3D NULL); >=20 > + if (PciRootBridgeInfo =3D=3D NULL) { >=20 > + break; >=20 > + } >=20 > + >=20 > + ZeroMem (PciRootBridgeInfo, HobDataSize); >=20 > + PciRootBridgeInfo->Header.Length =3D sizeof > (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES); >=20 > + PciRootBridgeInfo->Header.Revision =3D > UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_REVISION; >=20 > + PciRootBridgeInfo->Count =3D RootBridgeCount; >=20 > + PciRootBridgeInfo->ResourceAssigned =3D FALSE; >=20 > + } >=20 > + >=20 > + for (Property =3D FdtFirstPropertyOffset (Fdt, Node); Property >= =3D 0; Property =3D > FdtNextPropertyOffset (Fdt, Property)) { >=20 > + PropertyPtr =3D FdtGetPropertyByOffset (Fdt, Property, &TempLen)= ; >=20 > + TempStr =3D FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->Name= Offset), > NULL); >=20 > + >=20 > + if (AsciiStrCmp (TempStr, "ranges") =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, " Found ranges Property TempLen (%08X)\n"= , > TempLen)); >=20 > + >=20 > + PciRootBridgeInfo->RootBridge[index].AllocationAttributes =3D > EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | > EFI_PCI_HOST_BRIDGE_MEM64_DECODE; >=20 > + PciRootBridgeInfo->RootBridge[index].Supports =3D > ROOT_BRIDGE_SUPPORTS_DEFAULT; >=20 > + PciRootBridgeInfo->RootBridge[index].PMemAbove4G.Base =3D = PcdGet64 > (PcdPciReservedPMemAbove4GBBase); >=20 > + PciRootBridgeInfo->RootBridge[index].PMemAbove4G.Limit =3D = PcdGet64 > (PcdPciReservedPMemAbove4GBLimit); >=20 > + PciRootBridgeInfo->RootBridge[index].PMem.Base =3D = PcdGet32 > (PcdPciReservedPMemBase); >=20 > + PciRootBridgeInfo->RootBridge[index].PMem.Limit =3D = PcdGet32 > (PcdPciReservedPMemLimit); >=20 > + PciRootBridgeInfo->RootBridge[index].UID =3D = index; >=20 > + PciRootBridgeInfo->RootBridge[index].HID =3D = EISA_PNP_ID > (0x0A03); >=20 > + >=20 > + Data32 =3D (UIN= T32 *)(PropertyPtr->Data); >=20 > + PciRootBridgeInfo->RootBridge[index].Mem.Base =3D Fdt3= 2ToCpu > (*(Data32 + 2)); >=20 > + PciRootBridgeInfo->RootBridge[index].Mem.Limit =3D Fdt3= 2ToCpu > (*(Data32 + 6)) + Fdt32ToCpu (*(Data32 + 2)) -1; >=20 > + PciRootBridgeInfo->RootBridge[index].MemAbove4G.Base =3D Fdt3= 2ToCpu > (*(Data32 + 9)) + LShiftU64 (Fdt32ToCpu (*(Data32 + 8)), 32); >=20 > + PciRootBridgeInfo->RootBridge[index].MemAbove4G.Limit =3D > PciRootBridgeInfo->RootBridge[index].MemAbove4G.Base + LShiftU64 > (Fdt32ToCpu (*(Data32 + 12)), 32) + Fdt32ToCpu (*(Data32 + 13)) -1; >=20 > + PciRootBridgeInfo->RootBridge[index].Io.Base =3D Fdt3= 2ToCpu > (*(Data32 + 16)); >=20 > + PciRootBridgeInfo->RootBridge[index].Io.Limit =3D PciR= ootBridgeInfo- > >RootBridge[index].Io.Base + Fdt32ToCpu (*(Data32 + 20)) -1; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "RootBridgeCount %x, index :%x\n", > RootBridgeCount, index)); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Mem.Base %x, \n", > PciRootBridgeInfo->RootBridge[index].Mem.Base)); >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Mem.limit %x, \n", > PciRootBridgeInfo->RootBridge[index].Mem.Limit)); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->MemAbove4G.Base %llx, \n", > PciRootBridgeInfo->RootBridge[index].MemAbove4G.Base)); >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->MemAbove4G.limit %llx, \n"= , > PciRootBridgeInfo->RootBridge[index].MemAbove4G.Limit)); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Io.Base %llx, \n", > PciRootBridgeInfo->RootBridge[index].Io.Base)); >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Io.limit %llx, \n", > PciRootBridgeInfo->RootBridge[index].Io.Limit)); >=20 > + if (index > 0) { >=20 > + index--; >=20 > + } >=20 > + } >=20 > + >=20 > + if (AsciiStrCmp (TempStr, "bus-range") =3D=3D 0) { >=20 > + UINT16 *Data16; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, " Found bus-range Property TempLen (%08X)= \n", > TempLen)); >=20 > + >=20 > + if (RootBridgeCount =3D=3D 1) { >=20 > + index =3D 0; >=20 > + } >=20 > + >=20 > + Data16 =3D (UINT= 16 *)(PropertyPtr->Data); >=20 > + PciRootBridgeInfo->RootBridge[index].Bus.Base =3D Fdt16= ToCpu > (*Data16) & 0xFF; >=20 > + PciRootBridgeInfo->RootBridge[index].Bus.Limit =3D Fdt16= ToCpu > (*(Data16 + 1)) & 0xFF; >=20 > + PciRootBridgeInfo->RootBridge[index].Bus.Translation =3D 0; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Bus.Base %x, \n", > PciRootBridgeInfo->RootBridge[index].Bus.Base)); >=20 > + DEBUG ((DEBUG_INFO, "PciRootBridge->Bus.limit %x, \n", > PciRootBridgeInfo->RootBridge[index].Bus.Limit)); >=20 > + } >=20 > + } >=20 > + } else if (AsciiStrCmp (NodePtr->Name, "DebugPrintErrorLevel") =3D= =3D 0) { >=20 > + // >=20 > + // Create DebugPrintErrorLevel Hob. >=20 > + // >=20 > + DebugPrintErrorLevelInfo =3D BuildGuidHob (&gEdkiiDebugPrintErrorL= evelGuid, > sizeof (UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL)); >=20 > + ASSERT (DebugPrintErrorLevelInfo !=3D NULL); >=20 > + if (DebugPrintErrorLevelInfo =3D=3D NULL) { >=20 > + break; >=20 > + } >=20 DebugPrintErrorLevel node is not defined in UPL spec, please remove relevan= t code here. If required gEdkiiDebugPrintErrorLevelGuid hob can be passed by CustomFdtNo= de as it is EDK2 specific implementation. > + >=20 > + DebugPrintErrorLevelInfo->Header.Revision =3D > UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL_REVISION; >=20 > + DebugPrintErrorLevelInfo->Header.Length =3D sizeof > (UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL); >=20 > + >=20 > + PropertyPtr =3D FdtGetProperty (Fdt, Node, "errorlevel", &TempLen)= ; >=20 > + ASSERT (TempLen > 0); >=20 > + if (TempLen > 0) { >=20 > + Data32 =3D (UINT32 *)(PropertyPtr->Data); >=20 > + DEBUG ((DEBUG_INFO, "\n Property(00000000) errorlevel")= ); >=20 > + DEBUG ((DEBUG_INFO, " %X", Fdt32ToCpu (*Data32))); >=20 > + DebugPrintErrorLevelInfo->ErrorLevel =3D Fdt32ToCpu (*Data32); >=20 > + } >=20 > + } >=20 > + } >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "\n")); >=20 > + >=20 > + return NewHobList; >=20 > +} >=20 > + >=20 > +/** >=20 > + It will Parse FDT -node based on information from bootloaders. >=20 > + @param[in] FdtBase The starting memory address of FdtBase >=20 > + @retval HobList The base address of Hoblist. >=20 > + >=20 > +**/ >=20 > +UINTN >=20 > +EFIAPI >=20 > +FdtNodeParser ( >=20 > + IN VOID *FdtBase >=20 > + ) >=20 > +{ >=20 > + return ParseDtb (FdtBase); >=20 > +} >=20 > + >=20 > +/** >=20 > + It will build a graphic device hob. >=20 > + >=20 > + @retval EFI_SUCCESS If it completed successfully. >=20 > + @retval Others If it failed to parse DTB. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +BuildGraphicDevHob ( >=20 > + VOID >=20 > + ); >=20 > + >=20 > +/** >=20 > + It will initialize HOBs for UPL. >=20 > + >=20 > + @param[in] FdtBase Address of the Fdt data. >=20 > + >=20 > + @retval EFI_SUCCESS If it completed successfully. >=20 > + @retval Others If it failed to initialize HOBs. >=20 > +**/ >=20 > +UINTN >=20 > +EFIAPI >=20 > +UplInitHob ( >=20 > + IN VOID *FdtBase >=20 > + ) >=20 > +{ >=20 > + UINTN NHobAddress; >=20 > + >=20 > + NHobAddress =3D 0; >=20 > + // >=20 > + // Check parameter type( >=20 > + // >=20 > + if (FdtCheckHeader (FdtBase) =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, "%a() FDT blob\n", __func__)); >=20 > + NHobAddress =3D FdtNodeParser ((VOID *)FdtBase); >=20 > + } else { >=20 > + DEBUG ((DEBUG_INFO, "%a() HOb list\n", __func__)); >=20 > + mHobList =3D FdtBase; >=20 > + >=20 > + return (UINTN)(mHobList); >=20 > + } >=20 > + >=20 > + return NHobAddress; >=20 > +} >=20 > diff --git a/UefiPayloadPkg/Library/HobParseLib/HobParseLib.c > b/UefiPayloadPkg/Library/HobParseLib/HobParseLib.c > new file mode 100644 > index 000000000000..72da4fcaf74f > --- /dev/null > +++ b/UefiPayloadPkg/Library/HobParseLib/HobParseLib.c > @@ -0,0 +1,408 @@ > +/** @file >=20 > + Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT > | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_INITIALIZE= D | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_TESTED = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_READ_PROTE= CTED | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_WRITE_PROT= ECTED | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_EXECUTION_= PROTECTED | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_READ_ONLY_= PROTECTED | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_16_BIT_IO = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_32_BIT_IO = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_64_BIT_IO = | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_PERSISTENT= ) >=20 > + >=20 > +#define TESTED_MEMORY_ATTRIBUTES > (EFI_RESOURCE_ATTRIBUTE_PRESENT | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_INITIALIZE= D | \ >=20 > + EFI_RESOURCE_ATTRIBUTE_TESTED = ) >=20 > + >=20 > +extern VOID *mHobList; >=20 > + >=20 > +/** >=20 > + Add a new HOB to the HOB List. >=20 > + >=20 > + @param HobType Type of the new HOB. >=20 > + @param HobLength Length of the new HOB to allocate. >=20 > + >=20 > + @return NULL if there is no space to create a hob. >=20 > + @return The address point to the new created hob. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +CreateHob ( >=20 > + IN UINT16 HobType, >=20 > + IN UINT16 HobLength >=20 > + ); >=20 > + >=20 > +/** >=20 > + Build a Handoff Information Table HOB >=20 > + >=20 > + This function initialize a HOB region from EfiMemoryBegin to >=20 > + EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should >=20 > + be inside the HOB region. >=20 > + >=20 > + @param[in] EfiMemoryBottom Total memory start address >=20 > + @param[in] EfiMemoryTop Total memory end address. >=20 > + @param[in] EfiFreeMemoryBottom Free memory start address >=20 > + @param[in] EfiFreeMemoryTop Free memory end address. >=20 > + >=20 > + @return The pointer to the handoff HOB table. >=20 > + >=20 > +**/ >=20 > +EFI_HOB_HANDOFF_INFO_TABLE * >=20 > +EFIAPI >=20 > +HobConstructor ( >=20 > + IN VOID *EfiMemoryBottom, >=20 > + IN VOID *EfiMemoryTop, >=20 > + IN VOID *EfiFreeMemoryBottom, >=20 > + IN VOID *EfiFreeMemoryTop >=20 > + ); >=20 > + >=20 > +/** >=20 > + Build ACPI board info HOB using infomation from ACPI table >=20 > + >=20 > + @param AcpiTableBase ACPI table start address in memory >=20 > + >=20 > + @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HO= B > failure. >=20 > +**/ >=20 > +ACPI_BOARD_INFO * >=20 > +BuildHobFromAcpi ( >=20 > + IN UINT64 AcpiTableBase >=20 > + ); >=20 > + >=20 > +/** >=20 > + * >=20 > + Add HOB into HOB list >=20 > + >=20 > + @param[in] Hob The HOB to be added into the HOB list. >=20 > +**/ >=20 > +VOID >=20 > +AddNewHob ( >=20 > + IN EFI_PEI_HOB_POINTERS *Hob >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS NewHob; >=20 > + >=20 > + if (Hob->Raw =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 > + >=20 > + NewHob.Header =3D CreateHob (Hob->Header->HobType, Hob->Header- > >HobLength); >=20 > + >=20 > + if (NewHob.Header !=3D NULL) { >=20 > + CopyMem (NewHob.Header + 1, Hob->Header + 1, Hob->Header->HobLength > - sizeof (EFI_HOB_GENERIC_HEADER)); >=20 > + } >=20 > +} >=20 > + >=20 > +/** >=20 > + Found the Resource Descriptor HOB that contains a range (Base, Top) >=20 > + >=20 > + @param[in] HobList Hob start address >=20 > + @param[in] Base Memory start address >=20 > + @param[in] Top Memory end address. >=20 > + >=20 > + @retval The pointer to the Resource Descriptor HOB. >=20 > +**/ >=20 > +EFI_HOB_RESOURCE_DESCRIPTOR * >=20 > +FindResourceDescriptorByRange ( >=20 > + IN VOID *HobList, >=20 > + IN EFI_PHYSICAL_ADDRESS Base, >=20 > + IN EFI_PHYSICAL_ADDRESS Top >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS Hob; >=20 > + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; >=20 > + >=20 > + for (Hob.Raw =3D (UINT8 *)HobList; !END_OF_HOB_LIST (Hob); Hob.Raw =3D > GET_NEXT_HOB (Hob)) { >=20 > + // >=20 > + // Skip all HOBs except Resource Descriptor HOBs >=20 > + // >=20 > + if (GET_HOB_TYPE (Hob) !=3D EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip Resource Descriptor HOBs that do not describe tested system = memory >=20 > + // >=20 > + ResourceHob =3D Hob.ResourceDescriptor; >=20 > + if (ResourceHob->ResourceType !=3D EFI_RESOURCE_SYSTEM_MEMORY) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) !=3D > TESTED_MEMORY_ATTRIBUTES) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip Resource Descriptor HOBs that do not contain the PHIT range > EfiFreeMemoryBottom..EfiFreeMemoryTop >=20 > + // >=20 > + if (Base < ResourceHob->PhysicalStart) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + if (Top > (ResourceHob->PhysicalStart + ResourceHob->ResourceLength)= ) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + return ResourceHob; >=20 > + } >=20 > + >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Find the highest below 4G memory resource descriptor, except the input > Resource Descriptor. >=20 > + >=20 > + @param[in] HobList Hob start address >=20 > + @param[in] MinimalNeededSize Minimal needed size. >=20 > + @param[in] ExceptResourceHob Ignore this Resource Descriptor. >=20 > + >=20 > + @retval The pointer to the Resource Descriptor HOB. >=20 > +**/ >=20 > +EFI_HOB_RESOURCE_DESCRIPTOR * >=20 > +FindAnotherHighestBelow4GResourceDescriptor ( >=20 > + IN VOID *HobList, >=20 > + IN UINTN MinimalNeededSize, >=20 > + IN EFI_HOB_RESOURCE_DESCRIPTOR *ExceptResourceHob >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS Hob; >=20 > + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; >=20 > + EFI_HOB_RESOURCE_DESCRIPTOR *ReturnResourceHob; >=20 > + >=20 > + ReturnResourceHob =3D NULL; >=20 > + >=20 > + for (Hob.Raw =3D (UINT8 *)HobList; !END_OF_HOB_LIST (Hob); Hob.Raw =3D > GET_NEXT_HOB (Hob)) { >=20 > + // >=20 > + // Skip all HOBs except Resource Descriptor HOBs >=20 > + // >=20 > + if (GET_HOB_TYPE (Hob) !=3D EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip Resource Descriptor HOBs that do not describe tested system = memory >=20 > + // >=20 > + ResourceHob =3D Hob.ResourceDescriptor; >=20 > + if (ResourceHob->ResourceType !=3D EFI_RESOURCE_SYSTEM_MEMORY) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) !=3D > TESTED_MEMORY_ATTRIBUTES) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip if the Resource Descriptor HOB equals to ExceptResourceHob >=20 > + // >=20 > + if (ResourceHob =3D=3D ExceptResourceHob) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip Resource Descriptor HOBs that are beyond 4G >=20 > + // >=20 > + if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > > BASE_4GB) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Skip Resource Descriptor HOBs that are too small >=20 > + // >=20 > + if (ResourceHob->ResourceLength < MinimalNeededSize) { >=20 > + continue; >=20 > + } >=20 > + >=20 > + // >=20 > + // Return the topest Resource Descriptor >=20 > + // >=20 > + if (ReturnResourceHob =3D=3D NULL) { >=20 > + ReturnResourceHob =3D ResourceHob; >=20 > + } else { >=20 > + if (ReturnResourceHob->PhysicalStart < ResourceHob->PhysicalStart)= { >=20 > + ReturnResourceHob =3D ResourceHob; >=20 > + } >=20 > + } >=20 > + } >=20 > + >=20 > + return ReturnResourceHob; >=20 > +} >=20 > + >=20 > +/** >=20 > + Check the HOB and decide if it is need inside Payload >=20 > + >=20 > + Payload maintainer may make decision which HOB is need or needn't >=20 > + Then add the check logic in the function. >=20 > + >=20 > + @param[in] Hob The HOB to check >=20 > + >=20 > + @retval TRUE If HOB is need inside Payload >=20 > + @retval FALSE If HOB is needn't inside Payload >=20 > +**/ >=20 > +BOOLEAN >=20 > +IsHobNeed ( >=20 > + EFI_PEI_HOB_POINTERS Hob >=20 > + ) >=20 > +{ >=20 > + if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_HANDOFF) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_MEMORY_ALLOCATION) { >=20 > + if (CompareGuid (&Hob.MemoryAllocationModule- > >MemoryAllocationHeader.Name, &gEfiHobMemoryAllocModuleGuid)) { >=20 > + return FALSE; >=20 > + } >=20 > + } >=20 > + >=20 > + // Arrive here mean the HOB is need >=20 > + return TRUE; >=20 > +} >=20 > + >=20 > +/** >=20 > + It will build HOBs based on information from bootloaders. >=20 > + >=20 > + @param[in] BootloaderParameter The starting memory address of > bootloader parameter block. >=20 > + >=20 > + @retval EFI_SUCCESS If it completed successfully. >=20 > + @retval Others If it failed to build required HOBs. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +BuildHobs ( >=20 > + IN UINTN BootloaderParameter >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS Hob; >=20 > + UINTN MinimalNeededSize; >=20 > + EFI_PHYSICAL_ADDRESS FreeMemoryBottom; >=20 > + EFI_PHYSICAL_ADDRESS FreeMemoryTop; >=20 > + EFI_PHYSICAL_ADDRESS MemoryBottom; >=20 > + EFI_PHYSICAL_ADDRESS MemoryTop; >=20 > + EFI_HOB_RESOURCE_DESCRIPTOR *PhitResourceHob; >=20 > + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; >=20 > + >=20 > + #if (!FixedPcdGetBool (PcdHandOffFdtEnable)) >=20 > + UINT8 *GuidHob; >=20 > + UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTable; >=20 > + ACPI_BOARD_INFO *AcpiBoardInfo; >=20 > + #endif >=20 > + EFI_HOB_HANDOFF_INFO_TABLE *HobInfo; >=20 > + >=20 > + Hob.Raw =3D (UINT8 *)BootloaderParameter; >=20 > + MinimalNeededSize =3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); >=20 > + >=20 > + ASSERT (Hob.Raw !=3D NULL); >=20 > + ASSERT ((UINTN)Hob.HandoffInformationTable->EfiFreeMemoryTop =3D=3D > Hob.HandoffInformationTable->EfiFreeMemoryTop); >=20 > + ASSERT ((UINTN)Hob.HandoffInformationTable->EfiMemoryTop =3D=3D > Hob.HandoffInformationTable->EfiMemoryTop); >=20 > + ASSERT ((UINTN)Hob.HandoffInformationTable->EfiFreeMemoryBottom =3D=3D > Hob.HandoffInformationTable->EfiFreeMemoryBottom); >=20 > + ASSERT ((UINTN)Hob.HandoffInformationTable->EfiMemoryBottom =3D=3D > Hob.HandoffInformationTable->EfiMemoryBottom); >=20 > + >=20 > + // >=20 > + // Try to find Resource Descriptor HOB that contains Hob range > EfiMemoryBottom..EfiMemoryTop >=20 > + // >=20 > + PhitResourceHob =3D FindResourceDescriptorByRange (Hob.Raw, > Hob.HandoffInformationTable->EfiMemoryBottom, > Hob.HandoffInformationTable->EfiMemoryTop); >=20 > + if (PhitResourceHob =3D=3D NULL) { >=20 > + // >=20 > + // Boot loader's Phit Hob is not in an available Resource Descriptor= , find > another Resource Descriptor for new Phit Hob >=20 > + // >=20 > + ResourceHob =3D FindAnotherHighestBelow4GResourceDescriptor (Hob.Raw= , > MinimalNeededSize, NULL); >=20 > + if (ResourceHob =3D=3D NULL) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + MemoryBottom =3D ResourceHob->PhysicalStart + ResourceHob- > >ResourceLength - MinimalNeededSize; >=20 > + FreeMemoryBottom =3D MemoryBottom; >=20 > + FreeMemoryTop =3D ResourceHob->PhysicalStart + ResourceHob- > >ResourceLength; >=20 > + MemoryTop =3D FreeMemoryTop; >=20 > + } else if (PhitResourceHob->PhysicalStart + PhitResourceHob->ResourceL= ength - > Hob.HandoffInformationTable->EfiMemoryTop >=3D MinimalNeededSize) { >=20 > + // >=20 > + // New availiable Memory range in new hob is right above memory top = in old > hob. >=20 > + // >=20 > + MemoryBottom =3D Hob.HandoffInformationTable->EfiFreeMemoryTop; >=20 > + FreeMemoryBottom =3D Hob.HandoffInformationTable->EfiMemoryTop; >=20 > + FreeMemoryTop =3D FreeMemoryBottom + MinimalNeededSize; >=20 > + MemoryTop =3D FreeMemoryTop; >=20 > + } else if (Hob.HandoffInformationTable->EfiMemoryBottom - PhitResource= Hob- > >PhysicalStart >=3D MinimalNeededSize) { >=20 > + // >=20 > + // New availiable Memory range in new hob is right below memory bott= om in > old hob. >=20 > + // >=20 > + MemoryBottom =3D Hob.HandoffInformationTable->EfiMemoryBottom - > MinimalNeededSize; >=20 > + FreeMemoryBottom =3D MemoryBottom; >=20 > + FreeMemoryTop =3D Hob.HandoffInformationTable->EfiMemoryBottom; >=20 > + MemoryTop =3D Hob.HandoffInformationTable->EfiMemoryTop; >=20 > + } else { >=20 > + // >=20 > + // In the Resource Descriptor HOB contains boot loader Hob, there is= no > enough free memory size for payload hob >=20 > + // Find another Resource Descriptor Hob >=20 > + // >=20 > + ResourceHob =3D FindAnotherHighestBelow4GResourceDescriptor (Hob.Raw= , > MinimalNeededSize, PhitResourceHob); >=20 > + if (ResourceHob =3D=3D NULL) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + MemoryBottom =3D ResourceHob->PhysicalStart + ResourceHob- > >ResourceLength - MinimalNeededSize; >=20 > + FreeMemoryBottom =3D MemoryBottom; >=20 > + FreeMemoryTop =3D ResourceHob->PhysicalStart + ResourceHob- > >ResourceLength; >=20 > + MemoryTop =3D FreeMemoryTop; >=20 > + } >=20 > + >=20 > + HobInfo =3D HobConstructor ((VOID *)(UINTN)MemoryBottom, (VO= ID > *)(UINTN)MemoryTop, (VOID *)(UINTN)FreeMemoryBottom, (VOID > *)(UINTN)FreeMemoryTop); >=20 > + HobInfo->BootMode =3D Hob.HandoffInformationTable->BootMode; >=20 > + // >=20 > + // From now on, mHobList will point to the new Hob range. >=20 > + // >=20 > + >=20 > + // >=20 > + // Create an empty FvHob for the DXE FV that contains DXE core. >=20 > + // >=20 > + BuildFvHob ((EFI_PHYSICAL_ADDRESS)0, 0); >=20 > + // >=20 > + // Since payload created new Hob, move all hobs except PHIT from boot = loader > hob list. >=20 > + // >=20 > + Hob.Raw =3D (UINT8 *)BootloaderParameter; >=20 > + while (!END_OF_HOB_LIST (Hob)) { >=20 > + if (IsHobNeed (Hob)) { >=20 > + // Add this hob to payload HOB >=20 > + AddNewHob (&Hob); >=20 > + } >=20 > + >=20 > + Hob.Raw =3D GET_NEXT_HOB (Hob); >=20 > + } >=20 > + >=20 > + #if (!FixedPcdGetBool (PcdHandOffFdtEnable)) >=20 > + // >=20 > + // Create guid hob for acpi board information >=20 > + // >=20 > + DEBUG ((DEBUG_INFO, "Create guid hob for acpi board information \n")); >=20 > + >=20 > + GuidHob =3D GetFirstGuidHob (&gUniversalPayloadAcpiTableGuid); >=20 > + if (GuidHob !=3D NULL) { >=20 > + AcpiTable =3D (UNIVERSAL_PAYLOAD_ACPI_TABLE *)GET_GUID_HOB_DATA > (GuidHob); >=20 > + AcpiBoardInfo =3D BuildHobFromAcpi ((UINT64)AcpiTable->Rsdp); >=20 > + ASSERT (AcpiBoardInfo !=3D NULL); >=20 > + } >=20 > + >=20 > + #endif >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.in > f > b/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.in > f > new file mode 100644 > index 000000000000..036ed4315dd0 > --- /dev/null > +++ > b/UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.in > f > @@ -0,0 +1,46 @@ > +## @file >=20 > +# Custom FDT Node Parse Library. >=20 > +# >=20 > +# Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D CustomFdtNodeParserLib >=20 > + FILE_GUID =3D 732B2B8F-65AD-4BF8-A98F-6E0D330F7A6= 0 >=20 > + MODULE_TYPE =3D BASE >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D CustomFdtNodeParserLib >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e build > tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + CustomFdtNodeParserLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + BaseMemoryLib >=20 > + DebugLib >=20 > + FdtLib >=20 > + HobLib >=20 > + PcdLib >=20 > + >=20 > +[Guids] >=20 > + gUniversalPayloadPciRootBridgeInfoGuid >=20 > + gUniversalPayloadSerialPortInfoGuid >=20 > + gUniversalPayloadDeviceTreeGuid >=20 > + gUniversalPayloadAcpiTableGuid >=20 > + gEfiHobMemoryAllocModuleGuid >=20 > + >=20 > +[Pcd] >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdHandOffFdtEnable >=20 > diff --git > a/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.inf > b/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.inf > new file mode 100644 > index 000000000000..62916dd00848 > --- /dev/null > +++ > b/UefiPayloadPkg/Library/CustomFdtNodeParserNullLib/CustomFdtNodeParserN > ullLib.inf > @@ -0,0 +1,33 @@ > +## @file >=20 > +# Custom FDT Node Parse Library. >=20 > +# >=20 > +# Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D CustomFdtNodeParserLibNull >=20 > + FILE_GUID =3D 386496E4-37DB-4531-BA0C-16D126E63C5= 5 >=20 > + MODULE_TYPE =3D BASE >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D CustomFdtNodeParserLib >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e build > tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + CustomFdtNodeParserNullLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + DebugLib >=20 > + FdtLib >=20 > diff --git a/UefiPayloadPkg/Library/FdtParserLib/FdtParseLib.inf > b/UefiPayloadPkg/Library/FdtParserLib/FdtParseLib.inf > new file mode 100644 > index 000000000000..91be56758db5 > --- /dev/null > +++ b/UefiPayloadPkg/Library/FdtParserLib/FdtParseLib.inf > @@ -0,0 +1,63 @@ > +## @file >=20 > +# Coreboot Table Parse Library. >=20 > +# >=20 > +# Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D FdtParseLib >=20 > + FILE_GUID =3D 8956F72D-9626-4959-98B7-1BD4A3EA687= E >=20 > + MODULE_TYPE =3D BASE >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D FdtParseLib >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e build > tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + FdtParserLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + DebugLib >=20 > + PcdLib >=20 > + HobLib >=20 > + FdtLib >=20 > + CustomFdtNodeParserLib >=20 > + >=20 > +[Guids] >=20 > + gUniversalPayloadDeviceTreeGuid >=20 > + gEfiGraphicsInfoHobGuid >=20 > + gEfiGraphicsDeviceInfoHobGuid >=20 > + gUniversalPayloadAcpiTableGuid >=20 > + gUniversalPayloadSerialPortInfoGuid >=20 > + >=20 > +[Pcd.IA32,Pcd.X64] >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdHandOffFdtEnable >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPciReservedPMemBase >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPciReservedPMemLimit >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBBase >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBLimit >=20 > + >=20 > + >=20 > +[BuildOptions] >=20 > + MSFT:*_*_*_CC_FLAGS =3D /wd4305 >=20 > + GCC:*_*_IA32_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno-err= or=3Dint- > to-pointer-cast >=20 > + GCC:*_*_X64_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno-err= or=3Dint- > to-pointer-cast >=20 > + GCC:*_*_ARM_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno-err= or=3Dint- > to-pointer-cast >=20 > + GCC:*_*_AARCH64_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno- > error=3Dint-to-pointer-cast >=20 > + GCC:*_*_RISCV64_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno- > error=3Dint-to-pointer-cast >=20 > + GCC:*_*_LOONGARCH64_CC_FLAGS =3D -Wno-error=3Dpointer-to-int-cast -Wno= - > error=3Dint-to-pointer-cast >=20 > diff --git a/UefiPayloadPkg/Library/HobParseLib/HobParseLib.inf > b/UefiPayloadPkg/Library/HobParseLib/HobParseLib.inf > new file mode 100644 > index 000000000000..634c7ff56746 > --- /dev/null > +++ b/UefiPayloadPkg/Library/HobParseLib/HobParseLib.inf > @@ -0,0 +1,40 @@ > +## @file >=20 > +# UPL Hob Parse Library. >=20 > +# >=20 > +# Copyright (c) 2024, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D HobParseLib >=20 > + FILE_GUID =3D EFB05FE7-604B-40DA-9A59-E2F99852875= 4 >=20 > + MODULE_TYPE =3D DXE_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D HobParseLib|DXE_DRIVER DXE_RUNTIME_= DRIVER > SMM_CORE DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e build > tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + HobParseLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + BaseLib >=20 > + BaseMemoryLib >=20 > + IoLib >=20 > + DebugLib >=20 > + PcdLib >=20 > + HobLib >=20 > + >=20 > +[Pcd.IA32,Pcd.X64] >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize >=20 > + gUefiPayloadPkgTokenSpaceGuid.PcdHandOffFdtEnable >=20 > -- > 2.39.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119366): https://edk2.groups.io/g/devel/message/119366 Mute This Topic: https://groups.io/mt/106275995/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-