From nobody Sat Feb 7 08:27:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+82281+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+82281+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=hpe.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634615456447563.6850190729006; Mon, 18 Oct 2021 20:50:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id P7R1YY1788612xupFv5Fcban; Mon, 18 Oct 2021 20:50:56 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web10.5138.1634615443378764322 for ; Mon, 18 Oct 2021 20:50:55 -0700 X-Received: from pps.filterd (m0150245.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J3VwAR009195; Tue, 19 Oct 2021 03:50:42 GMT X-Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsb1x4qt9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:42 +0000 X-Received: from G4W9119.americas.hpqcorp.net (g4w9119.houston.hp.com [16.210.20.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3425.houston.hpe.com (Postfix) with ESMTPS id C3AD892; Tue, 19 Oct 2021 03:50:41 +0000 (UTC) X-Received: from G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) by G4W9119.americas.hpqcorp.net (2002:10d2:14d6::10d2:14d6) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:41 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.11) by G1W8108.americas.hpqcorp.net (16.193.72.60) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lfx2AWE9rviHxR9oOFtVWfIXQ+XXLgpI97JZzJHgUBgQXL4fnF9npE1TWB/60Xq/S10AYTFU2k3qR15ovBp/wCjNRQOrd++n3pL1lXl78ina4UbEEXqgQr333j3UYhne1hrhUWwGUWY5sF9tMpq+lvIlsQnN5PKSlLWKgi1yELy/qTdjv8kj7St7HMSG3k6fAuElPZi3ZePbg0eZ2wiD/lYAJBYIMmwfi1FN6KeYaEso7HDaIqXUzlR919fnVhn8oJCiXsX6kRvScZHNqVTtbLs+XQ182+XdUPA4U4qOMrC8ZRWByrNrghovJdpKtaDsEegadMRMvLogF4hyBDni4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ei3ZA82hS9g1PRvVk5WpopvcRogm8TzvwjSTTfSR6+0=; b=Ju54c4H2+ZYtvj7Q9REj4wTHpyYI9hMHOLNidCt8VCHdOi//krQra5SOosFdEfbkmk5Ss4iIYwdVNac+2DgQ9kuRG4q9JmlOC98aD3X2kdTr5NACYFsKOaTms3+joQkq0WwWiOEUxN3kalSw7TxtjYVa0DDLWClwSop2XpUwwQM66hq79Ez4SxHP91Nbc+NWnhaHAVKWUzRCcCYRKHO0Qa2S800+uwO8yjAlfFfgt3ojEI0sjmzaJOYFTuEBwG/i5ZWYEV5nA5bqooqEqpHKS1RcrnM6oxWWynxGSOe7hUrCF9N3OrrBZfVI2Vbv0u4aPWrwuOXbYjSRIxwf1/MCCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none X-Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) by DF4PR8401MB0921.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 03:50:40 +0000 X-Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM ([fe80::597f:4786:f1d6:8469]) by DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM ([fe80::597f:4786:f1d6:8469%3]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 03:50:40 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 10/14] RISC-V/PlatformPkg: Fixup FDT from HOB and install into config table Date: Tue, 19 Oct 2021 11:48:45 +0800 Message-ID: <20211019034849.16847-11-daniel.schaefer@hpe.com> In-Reply-To: <20211019034849.16847-1-daniel.schaefer@hpe.com> References: <20211019034849.16847-1-daniel.schaefer@hpe.com> X-ClientProxiedBy: SG2PR03CA0134.apcprd03.prod.outlook.com (2603:1096:4:c8::7) To DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) MIME-Version: 1.0 X-Received: from zbook-nix.wireless.hpe.com (15.211.146.34) by SG2PR03CA0134.apcprd03.prod.outlook.com (2603:1096:4:c8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.11 via Frontend Transport; Tue, 19 Oct 2021 03:50:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffe1273d-a2e5-4293-70f9-08d992b39de7 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:422; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: JbzWCJB1+baSdWdsoX42rFcNFJ3faRkpbnRZObSfnnI2wefPhRsAkCHvGsE7d5KxYTE6/27ObJNv/oJSgg/fCYyznCoWK7OD7SnMpTL5zAnqYrt/MjZc87f8WKwCkZoihABDcHdkg5RixJfY0ZwcWWGBCOHOG9PsFlwve6chbTMtAm2+q0iWynZVvycsl1rdxzIIPjO/9YCYhlcLZEkB7x2bL+TknI1iqqCXUu5X0RwMkZgU0EcxNu+y174KTQHxZqAuyWXpEtxWz3GEzQM0W4ymLULyIrtAwsQGjunC1YlgMN9SwrYeM40ji+3BYx2HTPi6Cx/csLwjBCYWt5+J+pd51Kmv+uZ57c1sTi8ap0+kueAi4+ZPcqEwNWiDPq6Dt90eG2Np+DH0uMviTHC/3Q7KodyndMIp+bHxmHA+lwUK3Bvr1BvfmHnc5cIteNI589OaEUy9Fw/spJjbXdI9Hazd5loEIMKfOMPvgLR2jJWgN8Nd45vwhAiyJ3eMeapI8uC21TR+t1Ree+lzB62iYuUmBTUxXE99vtLY7220DY31C7+AquODSqjEsD0NNpkYp5kE17YE95BioTq1VbEb0q/KIXgox7TBV1Uwq6Vvtb3f226NRQzmiA6Mjq1+tfl0AxvMWoSFvqj2VnyRMEhJ9CIrjEp9w98eWZtxVvnD4M2CfWK7WOAXCfe6LeWr7G2Gj7tQmLeeP9rtTjfHsGkjBA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7NEcqUirvfdcs7uaw7hhGHFzmYK0byybsPq12bJQIGvsKpiDMXdvfAL/slkC?= =?us-ascii?Q?IccXu/lO08PPNXEetQFKw6acUeMQhlWbfNvh9yBKovASxeC6izIagibbs8Fx?= =?us-ascii?Q?LP6cj5KbtOvdfgp0ptncYvJANnuJybcwf2ESZGbw1ncneY+EVLxf0acW0OmJ?= =?us-ascii?Q?LuAbK6U+tDE14HHjnqtEBlo2bX1zvtWCqKosTg4AZqI/AJFZy4hvOCgK85Lc?= =?us-ascii?Q?q5KpxSzFiPMIi7FzhJCcGEqRGyWVyYZYRDTZC8t7CJraCAixorKq5zyWFutD?= =?us-ascii?Q?BVc3az9r/Y1+RwnVoS6sDx8WDbgx96fKCKZelKra9yQ/j30VhSYnpjVHT/Fd?= =?us-ascii?Q?kMoP3hWDsYM8hR7s8vxGfjboyp6awACkJRFqRG1HEjjM8M3JxUDRBp6kNilD?= =?us-ascii?Q?nnMpvpQZFdT9f/oDc25eG0eHh5WSBqIXj0mFFiEoYiEWCs1UzbDBvTCTUdp2?= =?us-ascii?Q?Mvo7GCVvrkU9JBypQOYQdp0yqugis6xLT24KuuJHJ4vyUDYLL0ljxbHr/DSZ?= =?us-ascii?Q?wQou2gJfc0KaZ4fyEHGsU9KkEc+Uy0KPFiGzgTFesRfA9CGdEPN9/HPe1OVw?= =?us-ascii?Q?mpJKzS6IOVCuj7deF4Vu10UjMaaSYxba0YL3QvCDQe946/258fs7VhRiAc4T?= =?us-ascii?Q?mtG9hFiotIPdAiBVrdesg0wbPLCDV0AyWdbDIVzaZCIFH7bodehVJdoJ179H?= =?us-ascii?Q?oXLyaOfvswSjowfnBecS2V2MV7mkp4sSDK8Ymj+KXvHALTEeCmYrpjR3H3ea?= =?us-ascii?Q?vu28uob8f0YC0SkEPN3aTCbzASi+8T2e37UOKxt+ANhqqQ8yi/omJFCCLYtC?= =?us-ascii?Q?qexinfdJ8s4+Q4JD7DZiKtmsFiXO9h29ATuSa5VRww3eFjDHC4amrIalEKUd?= =?us-ascii?Q?WhZ1DUQ5l/R12N7JErC27zXVsU+wfL9sywe5Vj1xnuOoCsHzlcLio/331EGE?= =?us-ascii?Q?AcsSzth+nPMog61RQOrfZOkz5Kei0Q8Gm5BTNp6fTSWuZjH7DRx3Om5ec0U7?= =?us-ascii?Q?QaSVTyxjZ5TTHiEdxQQ5TQnjrkCDE3jCrrDkITHux66hCMDBRYOWYai3xZrz?= =?us-ascii?Q?efgdo534VQy/pqXzqWNxJ20Ljz0Cfb8r2A82XxD3GVxbE6igotLeAqBOOPdr?= =?us-ascii?Q?GeLWxohOE3CwRVBAi1zPXuzmneb4wlU5C4G/GbNKmFXwI00PU9lVghn7PWZc?= =?us-ascii?Q?m6ILHJewSZYAx8/Sjpa/lEOTw3ng9oWPprFOFfmwHPdeqf75a/YqZVitk+kJ?= =?us-ascii?Q?hB6JtSx4TvlUdpl0sWfxu5OxwM1UZdLS6zu+36r7iLi8/ou5IUpSJ4nE141O?= =?us-ascii?Q?4POzMyLSwTuQ/ehx0J9VmtuO?= X-MS-Exchange-CrossTenant-Network-Message-Id: ffe1273d-a2e5-4293-70f9-08d992b39de7 X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 03:50:39.9356 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YtJ86UdqOFtGIbE+CdKCrOsRP0qi33fTlUCRHBbRned3SAV61fNPyOv6Q6RukZ0XH4auDTQXLbxt60BrvYuuJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: OYjmu7s3DqNfjQPnwPBs9FpHX9K3DI-u X-Proofpoint-ORIG-GUID: OYjmu7s3DqNfjQPnwPBs9FpHX9K3DI-u X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,daniel.schaefer@hpe.com X-Gm-Message-State: GTfDuOZA66ny9TtIZSqAwjxxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615456; bh=XOFKIaCEtOWncLXyr//hsT/58WQrGLVCANq5wu8L4QM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Qk7scOPN7Y1ejpm9lECaf4/OqvvwuKn5+68NtAf4pAzU4TFTgAF+lJyIM9//diEOkII LaywnfNGQzmIPJdjS0fBXAwMlZiKbqIPuiWgW+HN6R+mXDeYzed4zrA0pCmNOlRt/X6gT gHUjYjQXqYzUkcJkl8Is5ypn/oWhu/1j/2c= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615457773100003 Content-Type: text/plain; charset="utf-8" The Linux EFISTUB reads the FDT from the EFI system configuration table. Before installing the FDT needs to be patched with the booting hartid, because the kernel in S-Mode cannot determine it. Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 2= + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc | 3= +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf | 1= + Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf | 53= +++++++++ Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c | 116= ++++++++++++++++++++ 5 files changed, 174 insertions(+), 1 deletion(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 4fab3c4bdcbb..cc62ad05212a 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -516,6 +516,8 @@ MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 + Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf + # # FAT filesystem + GPT/MBR partitioning + UDF filesystem # diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc b/Silicon/RI= SC-V/ProcessorPkg/RiscVProcessorPkg.dsc index 1292ba1beab7..531319322c62 100644 --- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc +++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc @@ -1,7 +1,7 @@ #/** @file # RISC-V processor package. # -# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All right= s reserved.
+# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -102,3 +102,4 @@ =20 Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf + Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.f= df index f0bd65fad648..c58fa6357451 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf @@ -182,6 +182,7 @@ INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEng= ineDxe.inf INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe= .inf INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf +INF Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf =20 !ifndef $(SOURCE_DEBUG_ENABLE) INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf diff --git a/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf b/Sili= con/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf new file mode 100644 index 000000000000..ae6468f9f55f --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf @@ -0,0 +1,53 @@ +## @file +# RISC-V Flattened Device Tree DXE module. +# +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001b + BASE_NAME =3D FdtDxe + FILE_GUID =3D a7d8f3f7-d8a7-47df-b3ec-9E5A693C380C + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InstallFdt + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D RISCV64 +# + + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + FdtLib + HobLib + MemoryAllocationLib + RiscVCpuLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Sources] + FdtDxe.c + +[Guids] + gFdtHobGuid + gFdtTableGuid + +[Pcd] + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId ## CONSUMES + +[Depex] + TRUE diff --git a/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c b/Silico= n/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c new file mode 100644 index 000000000000..22b12027d334 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c @@ -0,0 +1,116 @@ +/** @file + RISC-V Flattened Device Tree DXE module + + The Linux booting protocol on RISC-V requires the id of the booting hart= to + be passed as a0. Therefore the EFISTUB needs to get this information. Be= cause + it runs in S-Mode, it cannot get this information from mhartid. Instead = we + insert the id into the device tree, that the EFIFSTUB can read from the = config table. + + Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include + +/** + Fix up the device tree with booting hartid for the kernel + + @param DtbBlob The device tree. Is extended to fit the hart id. + + @retval EFI_SUCCESS The device tree was success fixed up with = the hart id. + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to co= mplete the operation. +**/ +EFI_STATUS +EFIAPI +FixDtb ( + IN OUT VOID *DtbBlob, + IN UINTN BootingHartId + ) +{ + fdt32_t Size; + UINT32 ChosenOffset, Err; + + DEBUG ((DEBUG_INFO, "Fixing up device tree with boot hart id: %d\n", + BootingHartId)); + + Size =3D fdt_totalsize(DtbBlob); + Err =3D fdt_open_into(DtbBlob, DtbBlob, Size + 32); + if (Err < 0) { + DEBUG ((DEBUG_ERROR, + "Device Tree can't be expanded to accommodate new node\n", __FUNCTIO= N__)); + return EFI_OUT_OF_RESOURCES; + } + ChosenOffset =3D fdt_path_offset(DtbBlob, "/chosen"); + fdt_setprop_u32(DtbBlob, ChosenOffset, "boot-hartid", BootingHartId); + + return EFI_SUCCESS; +} + +/** + Install the FDT passed in HOB into EFI system configuration table. + + @retval EFI_SUCCESS Successfully installed fixed up FDT in conf= ig table. + @retval EFI_NOT_FOUND Did not find FDT HOB. + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to com= plete the operation. +**/ +EFI_STATUS +EFIAPI +InstallFdtFromHob (VOID) +{ + EFI_STATUS Status; + EFI_HOB_GUID_TYPE *GuidHob; + VOID *DataInHob; + UINTN DataSize; + + GuidHob =3D GetFirstGuidHob (&gFdtHobGuid); + if (GuidHob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Failed to find RISC-V DTB Hob\n", + __FUNCTION__)); + return EFI_NOT_FOUND; + } + DataInHob =3D (VOID *) *((UINTN *) GET_GUID_HOB_DATA (GuidHob)); + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); + + Status =3D FixDtb (DataInHob, PcdGet32(PcdBootHartId)); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D gBS->InstallConfigurationTable (&gFdtTableGuid, DataInHob); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to install FDT configuration table\n", + __FUNCTION__)); + } + return Status; +} + +/** + Install the FDT from the HOB into the EFI system configuration table. + + @param ImageHandle Image handle of this driver. + @param SystemTable Pointer to the System Table. + + @retval EFI_SUCCESS FDT successfully installed into config table. + @retval EFI_NOT_FOUND Did not find FDT HOB. + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to com= plete the operation. + +**/ +EFI_STATUS +EFIAPI +InstallFdt ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D InstallFdtFromHob (); + + return Status; +} --=20 2.31.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 (#82281): https://edk2.groups.io/g/devel/message/82281 Mute This Topic: https://groups.io/mt/86432335/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-