From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web09.10770.1633521575310564548 for ; Wed, 06 Oct 2021 04:59:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=jxHQMKQa; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0913d10296=daniel.schaefer@hpe.com) Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 196B2FUW001068; Wed, 6 Oct 2021 11:59:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=pps0720; bh=fr4tFPWdnA2oIVia70fuZX3KlxsWozI8DzCZCBJRHrM=; b=jxHQMKQaDCCSdF6UHRn4ud263p4JlXN4P4kuSPUTrBplDn05fsi53jWCey6MM5SDi6SO +vYgIEGq46sfRps2Z0ISW3pks7nrvL54noRpoQZ/p+5Iz1rTzQQ0JtY7XTv206vdCuJL dHpWjpP9iYCZf60Xz1ZKm32ljwFuiC+OZ4gSsv2ehQh2Mi9TIckDpiDS0O+6KIHj/xqo 1rk0wx+0QvtRg6+dVZOO4b3z766/yagNbSRYdzUp1kM5fn71a01g9z/z9X6nA/ajkve3 cbqcXJdcV3GlG5JKo5f8zKERecTW98s2ZtwHDGLmZe8bm1JS7iUk8pj9suL/+fZPHlIV 1A== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 3bgwqgx9gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Oct 2021 11:59:34 +0000 Received: from G4W10204.americas.hpqcorp.net (g4w10204.houston.hpecorp.net [16.207.82.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id 87A1A5B; Wed, 6 Oct 2021 11:59:33 +0000 (UTC) Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G4W10204.americas.hpqcorp.net (16.207.82.16) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 6 Oct 2021 11:59:24 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (15.241.52.11) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Wed, 6 Oct 2021 11:59:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bN8riglO6qH6GZL6/YPHiWgeJnQUj5Neyd8WnfDTGRoBlpxsBPYJrOPRzy1lxLs0dktrEP5IMzjMDsG2qvDZH7fMtrw/YbK1soffkjl/Q5EBE77Kf7oh/4QeZsdM/n1IpOIBubFG01LuqmBVrWIIZsqAZMC0DbGYHv92pQjqIs3CJJ6Rx/HIM35fudKtVxSVFbkZAQZG0FiWirvOiMk4DplFnB/TMJBDZQerrOHK1//Vz6zTfnfZT9I3FZKneqVnvaiclKR5zWqiYb2Qnx5ufOXYfa8FAaxC5NdOsT5gcfOBcmEOayuLniqEKjOV6e3u/BJLmTqTzSSzR43tdI+DAw== 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=fr4tFPWdnA2oIVia70fuZX3KlxsWozI8DzCZCBJRHrM=; b=Thf9VCIxprPom87zp8ArcuDKcsOnN4kSf8AhK5+efdPz7NODtEJlMdPb2uxKTAUosq4Jk9EVY8rRScbOULMUARh0dI2FjlfU1xCl1zrluHBeVz+a68ZtMn5TG+kEzkE612YbWcmVSgBLD0c8kCJ2JwkeJUjK1DDgDHYy4IyXUsWS69rdwu87vZjcxvfCnkvnr/auleHBql/UOnz1iuWkGrYBQUb3eU2a0l/FMT7N6VMsUOX30XUjMDYmlzNsfTrcLTiL31d8m1bseYB3Cbmhw0liTcfgBN2YhvW/k0OUVUplhAR5SM66zc+z1Ma66PceKRQKy6OJ1EkylTQTIgWtOA== 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 Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) by DF4PR8401MB1034.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 6 Oct 2021 11:59:23 +0000 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.4566.023; Wed, 6 Oct 2021 11:59:23 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , Sunil V L Subject: [edk2-platforms][PATCH v2 10/14] RISC-V/PlatformPkg: Fixup FDT from HOB and install into config table Date: Wed, 6 Oct 2021 19:58:32 +0800 Message-ID: <20211006115836.3641776-3-daniel.schaefer@hpe.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211006115836.3641776-1-daniel.schaefer@hpe.com> References: <20211006115836.3641776-1-daniel.schaefer@hpe.com> X-ClientProxiedBy: HK2PR02CA0159.apcprd02.prod.outlook.com (2603:1096:201:1f::19) To DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) MIME-Version: 1.0 Received: from localhost.localdomain (123.193.59.220) by HK2PR02CA0159.apcprd02.prod.outlook.com (2603:1096:201:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Wed, 6 Oct 2021 11:59:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14300179-bb79-4a9c-fca3-08d988c0bc85 X-MS-TrafficTypeDiagnostic: DF4PR8401MB1034: 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: BCL:0; X-Microsoft-Antispam-Message-Info: bFm5Z3thyTIze/aqRuJFtEqsMCpbNCweqtPHInqw86pgT5aWHUsDvfbUdCMwto7LB07n7WPd8IsVAKflRl3rTbOJ8wAVa65UApwB+1RBRiNmJXrsR2mL7lyt1v1bP/eoCPZLIIjw9Zqud+HbEgzrEwh28QE8nIax9WBmFRYGrRf1tzCW+6IzvAdJFxhe+Bi1yJHxNURI3tF/xrvzxBC081QfaqdjtspoDtZhUA4hZ7FXib82kvc26A5DCKJ9iYGqkE5ZtYCcTKYBLzvflqgQl57yohqX632nnMq3T/5J5FqgBSLm/6vkqMB8KTG6R7NwepjBpaH4dy4kXKjMLvUN2R0+ii0z/y55oWb8bnJBn13st7Tca/RgQShK+vIPnNuAKfm0DKtqrXCbYLwbIRu6QFmlOSEu8rHJuaULzT/nxr44A1PijFpfkHWxa0hVpRar/b5t+lYjdaoPS/KCL9SeAYIIgRncJw6BTJtSywPuVZbkil0ZQ1wbBrRUT/HAsOnkmGFZ5Z/+mg/UlTX49JyW/kUbqnxRrKfoHOQq/WnPbYak0Uri/rQr6FBTZZnx6OHTIP8O4wgnfw/COaXXc8rKU/jpi8MNsFeHie5ZvDFcxqAG7qZpAKQyGplTqtsTG2YNo+mTe28azXIZVVO42MMk2rWxRtpttZY0Fb8JR5HfUbRcEdu/CEznlC9JZejdEF/hrwKAdYPJY78xq7dOltjTtw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(186003)(6506007)(956004)(316002)(26005)(52116002)(6916009)(8676002)(8936002)(5660300002)(6486002)(508600001)(83380400001)(6666004)(66556008)(66476007)(38350700002)(6512007)(38100700002)(86362001)(36756003)(4326008)(2906002)(54906003)(2616005)(1076003)(66946007)(44832011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?p2Mq8AVI1A0u0eKsUDMeN65GNtPHAmol2fTayvN6dN8JT/V+T8y6oXRfgRFB?= =?us-ascii?Q?zc1wkh/fbyCkosi/No2yDEKhfsGDtCmLLTnJLwMh264TdHZ5Oi7WNqJKPK4Q?= =?us-ascii?Q?U2w3EdNcawV4ksJvegBLGn9g/A8Uju69paXTqOFK6GEInopkFUY8SuG2e2/Z?= =?us-ascii?Q?WN7xvHCiEOaO7nHFOJid063Om2aZAxqImxgtE9kMaGjtn9FU5mGB6/Bn0oNO?= =?us-ascii?Q?fZoi3ARceHwXEj0oUIIGAilgDjrCQDdQ3QPsrIQEueOO8kAixTqe4csMGYzK?= =?us-ascii?Q?YPRyc/Zpqhp2roew8RtcusH1MKGmJ/KrZKvHJWV3665kwxMWbkAVDlkVsvcK?= =?us-ascii?Q?2QPlHveN3ZlGscXrmCkETDcuAwMsQEd0uyFgWQJJghtEJZzdpC1kqG5aIf3J?= =?us-ascii?Q?ZFyParQoWxnxCXQtY4l2XoGqkakjIRSo45Pf0cetgiTguAv1T3s7Xt+l1SZy?= =?us-ascii?Q?GpSDAVPGprVHXrkSvjqKetBUYojWKi1lxlE+xYuuoMm7cNJYmsX+pbzjCda8?= =?us-ascii?Q?MhrwhcA8oV+uuJOe1knQnLzkK3gr290Bcl6YpMIMWtp3aXTxihmDxSByGrOP?= =?us-ascii?Q?XV3pSdbInGtxskAkl44DcTbuv5maiES9lmIB3FYrdIiqUuSbDsEELKwUWfhE?= =?us-ascii?Q?UceL8d4Y0VTBIm8TJZCxfZdSlTQe8xhuB+MXuyiyoPB2dGOVaIsa8d1auxh4?= =?us-ascii?Q?0ufD++R+uAR1WOdgbm88Jkm74N05wZnP6FXhUO/OS98kZyZFDoBj3ZNnfD6W?= =?us-ascii?Q?3mevimur+B7+Aea8Zo+jxINe1Zuico+jUKq1eOnuulGd67miZYZT/ub2VRuu?= =?us-ascii?Q?u1fLNrSeYqAMFeXEqZ4Wm0/cHQMWpHezbB3ETZnmPHPnO8yvNOaNXXAiHp+g?= =?us-ascii?Q?XC4HPvOmcpb7G+sx2zhATIlY+Ba/7xzmjrj9b1zBwNv3+DH+zkvznqTCUU+q?= =?us-ascii?Q?gzaWrE33D6KTyjsd0UJsoJi+uMJwa3zLxNecOW/Qs5U0qtLIKt5pGfZwJTmy?= =?us-ascii?Q?dxi+k1y1NVhXOMmTEybPSGRoYDzymazgpgB1yCn43UpV21dyTxBGEM7xF7zi?= =?us-ascii?Q?XcqnMakv4oQHfkKwBa0VzOcdxqy4kUvFP8s92DnSdriZEC7nQZvPFRk7a0JB?= =?us-ascii?Q?soSrnn4mC7+6I/lWS1NAlXFGgP/PR77taPiMamTiWzyfOduYU87zOquEIm0B?= =?us-ascii?Q?t207/zzGhs/+B0Gkg51EXlFD1jZnVLHl4tl2ExeEwNPpzf5hcKxFZrV4qIdR?= =?us-ascii?Q?n8qlv6FQD14WfzAUClYWpJUfvkCrXnDTbnbxEHzsVwF4z2mTVXe7Stm4dTL3?= =?us-ascii?Q?nds637mOLmpprw1Lye6a4JPj?= X-MS-Exchange-CrossTenant-Network-Message-Id: 14300179-bb79-4a9c-fca3-08d988c0bc85 X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 11:59:22.9111 (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: XGMEk5MZmR3YicEjeiu7QxS4JODk74Q0JHzkSgtI7juVhQLkwt6hYctwCkoRHeJtXSOtVqc0G2D2SxRMfxf8+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1034 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: SHS-Gkg7HcmTHzaMzNfYPct-qNftdH1M X-Proofpoint-ORIG-GUID: SHS-Gkg7HcmTHzaMzNfYPct-qNftdH1M X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-06_02,2021-10-06_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110060075 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 2= + Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf | 1= + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc | 3= +- Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c | 116= ++++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf | 53= +++++++++ 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 4fab3c4bdc..cc62ad0521 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=0D MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf=0D =0D + Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf=0D +=0D #=0D # FAT filesystem + GPT/MBR partitioning + UDF filesystem=0D #=0D diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.f= df index f0bd65fad6..c58fa63574 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=0D INF FatPkg/EnhancedFatDxe/Fat.inf=0D INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf=0D +INF Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf=0D =0D !ifndef $(SOURCE_DEBUG_ENABLE)=0D INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf=0D diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc b/Silicon/RI= SC-V/ProcessorPkg/RiscVProcessorPkg.dsc index 1292ba1bea..531319322c 100644 --- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc +++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc @@ -1,7 +1,7 @@ #/** @file=0D # RISC-V processor package.=0D #=0D -# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All right= s reserved.
=0D +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -102,3 +102,4 @@ =0D Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf=0D Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf=0D + Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf=0D 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 0000000000..22b12027d3 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.c @@ -0,0 +1,116 @@ +/** @file=0D + RISC-V Flattened Device Tree DXE module=0D +=0D + The Linux booting protocol on RISC-V requires the id of the booting hart= to=0D + be passed as a0. Therefore the EFISTUB needs to get this information. Be= cause=0D + it runs in S-Mode, it cannot get this information from mhartid. Instead = we=0D + insert the id into the device tree, that the EFIFSTUB can read from the = config table.=0D +=0D + Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + Fix up the device tree with booting hartid for the kernel=0D +=0D + @param DtbBlob The device tree. Is extended to fit the hart id.=0D +=0D + @retval EFI_SUCCESS The device tree was success fixed up with = the hart id.=0D + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to co= mplete the operation.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +FixDtb (=0D + IN OUT VOID *DtbBlob,=0D + IN UINTN BootingHartId=0D + )=0D +{=0D + fdt32_t Size;=0D + UINT32 ChosenOffset, Err;=0D +=0D + DEBUG ((DEBUG_INFO, "Fixing up device tree with boot hart id: %d\n",=0D + BootingHartId));=0D +=0D + Size =3D fdt_totalsize(DtbBlob);=0D + Err =3D fdt_open_into(DtbBlob, DtbBlob, Size + 32);=0D + if (Err < 0) {=0D + DEBUG ((DEBUG_ERROR,=0D + "Device Tree can't be expanded to accommodate new node\n", __FUNCTIO= N__));=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D + ChosenOffset =3D fdt_path_offset(DtbBlob, "/chosen");=0D + fdt_setprop_u32(DtbBlob, ChosenOffset, "boot-hartid", BootingHartId);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Install the FDT passed in HOB into EFI system configuration table.=0D +=0D + @retval EFI_SUCCESS Successfully installed fixed up FDT in conf= ig table.=0D + @retval EFI_NOT_FOUND Did not find FDT HOB.=0D + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to com= plete the operation.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +InstallFdtFromHob (VOID)=0D +{=0D + EFI_STATUS Status;=0D + EFI_HOB_GUID_TYPE *GuidHob;=0D + VOID *DataInHob;=0D + UINTN DataSize;=0D +=0D + GuidHob =3D GetFirstGuidHob (&gFdtHobGuid);=0D + if (GuidHob =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "Failed to find RISC-V DTB Hob\n",=0D + __FUNCTION__));=0D + return EFI_NOT_FOUND;=0D + }=0D + DataInHob =3D (VOID *) *((UINTN *) GET_GUID_HOB_DATA (GuidHob));=0D + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob);=0D +=0D + Status =3D FixDtb (DataInHob, PcdGet32(PcdBootHartId));=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + Status =3D gBS->InstallConfigurationTable (&gFdtTableGuid, DataInHob);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a: failed to install FDT configuration table\n"= ,=0D + __FUNCTION__));=0D + }=0D + return Status;=0D +}=0D +=0D +/**=0D + Install the FDT from the HOB into the EFI system configuration table.=0D +=0D + @param ImageHandle Image handle of this driver.=0D + @param SystemTable Pointer to the System Table.=0D +=0D + @retval EFI_SUCCESS FDT successfully installed into config table.=0D + @retval EFI_NOT_FOUND Did not find FDT HOB.=0D + @retval EFI_OUT_OF_RESOURCES There is not enough memory available to com= plete the operation.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +InstallFdt (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D InstallFdtFromHob ();=0D +=0D + return Status;=0D +}=0D 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 0000000000..ae6468f9f5 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Universal/FdtDxe/FdtDxe.inf @@ -0,0 +1,53 @@ +## @file=0D +# RISC-V Flattened Device Tree DXE module.=0D +#=0D +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x0001001b=0D + BASE_NAME =3D FdtDxe=0D + FILE_GUID =3D a7d8f3f7-d8a7-47df-b3ec-9E5A693C380C=0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + ENTRY_POINT =3D InstallFdt=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D RISCV64=0D +#=0D +=0D +=0D +[Packages]=0D + EmbeddedPkg/EmbeddedPkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + MdePkg/MdePkg.dec=0D + Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec=0D + EmbeddedPkg/EmbeddedPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + BaseMemoryLib=0D + DebugLib=0D + FdtLib=0D + HobLib=0D + MemoryAllocationLib=0D + RiscVCpuLib=0D + UefiBootServicesTableLib=0D + UefiDriverEntryPoint=0D +=0D +[Sources]=0D + FdtDxe.c=0D +=0D +[Guids]=0D + gFdtHobGuid=0D + gFdtTableGuid=0D +=0D +[Pcd]=0D + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId ## CONSUMES=0D +=0D +[Depex]=0D + TRUE=0D --=20 2.33.0