From nobody Tue May 7 05:34:20 2024 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+82271+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+82271+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 1634615365657403.7192679427134; Mon, 18 Oct 2021 20:49:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7JhLYY1788612xwNkwiiJwIN; Mon, 18 Oct 2021 20:49:25 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web09.5139.1634615356043245064 for ; Mon, 18 Oct 2021 20:49:24 -0700 X-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 19IN21B3009268; Tue, 19 Oct 2021 03:49:14 GMT X-Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 3bs9u4wcqr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:14 +0000 X-Received: from G9W9210.americas.hpqcorp.net (g9w9210.houston.hpecorp.net [16.220.66.155]) (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 5E6B751; Tue, 19 Oct 2021 03:49:13 +0000 (UTC) X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W9210.americas.hpqcorp.net (16.220.66.155) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:13 +0000 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (15.241.52.10) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:49:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRx4Jp55MEndhaurQ4VXqUGipIuthxGACqE4vjZ4X5+Yw/CqyrLINXeoY47hKBWL3ai+utIVDRixzxNdqdQ9FpbYZhekvDv+DxKmTu5FPuJK/bhtHEok95WFRHv6ZdT8xdOtIZhb4y/scPQvd6DUkZpqMivuapXo/N/OLinCRwudxXaS+YZasmch7wALTbHrMmTMcSlUg34m4ZSxrXdlG6g7to1KuCuPx9KyWt/4udbMsNOxDh+BYDoDtYPaDE5xCoPAu+on6buZ2axZNwxrn6r4jN/od89eE65mw+MQ2ncHnY5Y1QLKLhp9gqMhGaPGm8IhD6F1E/aqbDY5EzbtJg== 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=QTqi3tWtsrq3+K+KMDDA6QottFj2nDsd20Tm5VUU4sY=; b=XC0tAlbtASzeOCr6bLvO+D+3+cc22pGt2Fxzza6szPs/K2dMYZ9wRTQUonym89O/auB5BZZGk4x7mYtV8f3JYn+lQ/AmFEjl7R2vGi9Aeif3BwLH7OUvNV0E0z3Iql9zOV8FIf9RhrSryirqX5LedG4r+XniCF/eymCfHa7Gl0BOtL6jKn3zAUmBV85paAkSXHWxWTrDc0kiNnX2NN8LKrXyJr0nrXMigyb+MmvKb+TmzWN3frmMtvrrn26anZt210VNxHIEiIIYsENI8De1fAHgsXIODuTrmiTxaVMMmfWHrMq57DGHTAfyVvhor6TmyWb1XXKAu9wJUmSzVVTrAQ== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:11 +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:49:11 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 01/14] U5SeriesPkg: Deduplicate PlatformPei Date: Tue, 19 Oct 2021 11:48:36 +0800 Message-ID: <20211019034849.16847-2-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:49:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f6715a2-1aa0-4e3c-c41e-08d992b3690c X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1002; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: mG1g58DZsOuniEc9AhNJF8KIjn+EYJ4+bM2+Y5lSyDpfXsMh0mdKuj81siFyx+dTEGFSwF5/bQu13x6T33jExnjsOUOqYOqetRaJ2ddlH4kD0z5sDNU19JKpE9x9L8k7lMUIXZb8PKY7OIW/DJyf1wMh0oI2JrtAw9VVQhdrNcLzLp/PO6R6FjtUoSjZzr2R2gXw2CTeAbC4L0hZpEeLqHTj3KdUamz/5SMGf07+HJ9VtUamjq/p6fLa8FHdWxicmwn2V5pkcttJlB2xTd5ANhYPtdMAIS4d/gopPKJNtsCp/jCR8iiNjivtMT/tgePXl+D40HuL3Et0H2nXNsB3Ce42UCdlZt9JJ2yEUd7avTtFwzsvlqmTsqnLHi/Ae82pAR6Tpv40nZhCk0YSysTXwDWGM/lne0VwxmylgvERc3rQhaoHBFM6hnLd6B1JaqPN48FZmvrHHkDotSw9HYHNis56qPmDk2SPdx9yxvLvUFj6qQplK4O2oGvTFb0et35N/BbRxna031xgquRRL2dCqEO+ULqtgIp8cJ84SjaXDtrWcCzv08VM/KBzfUXk5kpD147+lGWiMiTcL0FKp1kBzTZv/POdtpfp7DfMMaSTiVTuF6UKSoSnI0E2uoyZsLVT4CibEtWa7m+8yrLAjAVPl/NKZizow73DJVf/8ieNbB+/LCJXwgsb8w2+wEWWXMs2zds86qPv98os3lpiGcXV2Q== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Wk26OGSC+X84CwBJj1nCrH7as/X1niO9DiXfNiqwqzWMbEn2Bvab1wtGqomv?= =?us-ascii?Q?WzI5XmNXzP8SpshfE+E5g/P+X0WYfaDDWdH8yw9ZRbYcOEiJvnR8O+gJtt7p?= =?us-ascii?Q?tQv4RXI2VtGiPX5urOeG7sjaAoGb922jDFkhw9sATy1JKpNVt9NiimgmhZy5?= =?us-ascii?Q?3w9eIW/3LEIJoj5W8UXyE8adVoiQYb0FUCAZiijmMpqkAVqksSamEmcI2tSe?= =?us-ascii?Q?iitIR5vpFkKsBwe4Df6YLH7Gi0AR36LymFEwbwiWfzkVrYtzBPuoXHeKUoJk?= =?us-ascii?Q?F1upuLPLvxOGVedqA6Sr/PAD+YXVnLlf1bpvMJHLbvM4ULMLrQv6kN3Q8AKK?= =?us-ascii?Q?ej+ITinSQWM30gRxl76QXROFGOqFCYdg/Q4mK1oWczoZ/hrZTwszFP35trch?= =?us-ascii?Q?xqQVz9h1L3ML/aT7wOrNRHO1/WoPK2RXRU4CE2ClGBlBYncRi8Gz6EatOM7+?= =?us-ascii?Q?ADnrJE4iBk2at65lPZrMw5uhdFHe6nDF9RKw7KBSnS2uFZsmsIK/X9G+JMUM?= =?us-ascii?Q?5Sf+DQbKg8HVSA1ZDYcgRBfuwm7JOMk07Rfw62c6bXkPpBb+fy0VuX6sbf+M?= =?us-ascii?Q?KPU+jqHIQ0VXrdVUG7a4P/nlIUrK/nmP1lpAka1zGLlKIfksuf7Auga/QvLK?= =?us-ascii?Q?0zm7Nbg1Px5yO2OOILtwmAJjQLrR7+nXoaB/fIjQZf0b70iOl5G7Juuc9eSD?= =?us-ascii?Q?yLfMApFeSOvnd0w5KMGkCohpaHy2LQ9O/wjiOZefUteUozBShz1Fvo4ict4n?= =?us-ascii?Q?7kQV9/X8Kn2EnvrabHk/ByEYc5OJ1DpDBn220v6fdci+dOWZQxpQB0L+THn/?= =?us-ascii?Q?ye7LTTFle8vrQ5P8+wmAvvYX+OSDm72U0soYQ2kCYxVL65kZj//soeu5y6c2?= =?us-ascii?Q?4Pah2BjEsoYWbQz1E5qVjZf9jIqrC03vDhFIlict9wLvG3fx8XBsyC/97bZk?= =?us-ascii?Q?KwhnL1Frq2cMU63Hr9yALp/Jb9AY2YJlWmIsTWLg1poLKA23F598pSr6FA9e?= =?us-ascii?Q?2jw8yMjLTPQrxPAIo+c/cK7wdG1VtsPgAzG04CplKvb3YODBhyeOiTHbU8QD?= =?us-ascii?Q?wQzUhP759xYenG+bccBYLtu2JzulHl7roCXUUeoe0nTUTdlxWLt2ZXy4rgCN?= =?us-ascii?Q?C97Wk9Bz3fJUHmG/keOQM720DobISQLAHS3xlc7sVGTw8UiS5QH6iefcgXKc?= =?us-ascii?Q?4hLlkcRSSZpCtNYsxgKbPyGCdWGKgLS9wy/rg4sAIRt2X37Dln1jMKtPVRuY?= =?us-ascii?Q?fUD4HUk/MQFCp1aJGxsj+5ERp0/eCp9NoDhW+DlqxWwMXbtncF+/NSZtQzUS?= =?us-ascii?Q?tO78T9enABB34ZpxB6xxOP0e?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6f6715a2-1aa0-4e3c-c41e-08d992b3690c 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:49:11.2649 (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: Wplt7EASDkrnAhIesVJ4+RLbnaxvxPZR6M244XkeFq7IUVJAohyF9gIx0ruC8t3dHATCmsiATAWTXEoriOpuyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: HsJKZk64fQP0x9SHzAHh5lt3qNldMUfu X-Proofpoint-GUID: HsJKZk64fQP0x9SHzAHh5lt3qNldMUfu 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: gzfhymxts9RPCGIcmBOVUCtsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615365; bh=ZCHysvImIsBYsYKJ9hzHtI2fDIfFqk3V8a44za92164=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=T5wj7e/zohDcclT8HaYbizrjD4JP9Feuz1NXv7KEFC3WUp6CsQia+rzeOEq1TAH9Szn 9G/lJhhWvcS2NJ1VD78YRsNDsvE9Eyo0/AOitLAfXPBXjzHf8RgoEqnY6xRVPgL6zBxhP 5r2UsBKvh8S5mEFNdaaKnxLO+cvIboYPTGM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634616267786100002 Content-Type: text/plain; charset="utf-8" The current (and future) RISC-V platforms share a lot of PlatformPei code that does not need to be duplicated. If we see that they need to have different behavior in the future, we can add platform specific libraires for that specific code. The upcoming RiscvVirt is only 1205 lines with this patch. Still way too much. Hopefully MinPlatform will help. 26 ./RiscvVirt.dec 13 ./RiscvVirt.uni 12 ./RiscvVirtPkgExtra.uni 78 ./VarStore.fdf.inc 66 ./RiscvVirt.fdf.inc 654 ./RiscvVirt.dsc 356 ./RiscvVirt.fdf 1205 total Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc = | 2 +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc = | 2 +- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf = | 2 +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf = | 2 +- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Universal/Pei/PlatformPei/PlatformPei.inf | 4 +- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/PlatformPe= i/PlatformPei.inf | 73 ----- Platform/{SiFive/U5SeriesPkg/FreedomU500VC707Board =3D> RISC-V/PlatformPkg= }/Universal/Pei/PlatformPei/Platform.h | 0 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal/Pei/= PlatformPei/Platform.h | 86 ------ Platform/{SiFive/U5SeriesPkg/FreedomU500VC707Board =3D> RISC-V/PlatformPkg= }/Universal/Pei/PlatformPei/Fv.c | 0 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Universal/Pei/PlatformPei/MemDetect.c | 11 +- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Universal/Pei/PlatformPei/Platform.c | 6 +- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/PlatformPe= i/MemDetect.c | 74 ----- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/PlatformPe= i/Platform.c | 310 -----------------= --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal/Pei/= PlatformPei/Fv.c | 51 ---- 14 files changed, 21 insertions(+), 602 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc b/P= latform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc index 9f0a25f8a6af..fce1c5057879 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc @@ -395,7 +395,7 @@ NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompress= Lib.inf } =20 - Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/Platform= Pei/PlatformPei.inf { + Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf { PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf } diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index afe63c80ba28..14d83fb25a9f 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -394,7 +394,7 @@ NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompress= Lib.inf } =20 - Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal/Pe= i/PlatformPei/PlatformPei.inf { + Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf { PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf } diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf b/P= latform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf index 5f3ac8e0b70f..7db3a02bcb8e 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf @@ -99,7 +99,7 @@ INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusC= odeHandlerPei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 # RISC-V Platform PEI Driver -INF Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/Platf= ormPei/PlatformPei.inf +INF Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf =20 ##########################################################################= ###### =20 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.f= df index a1a4b342e329..74717377287b 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf @@ -99,7 +99,7 @@ INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusC= odeHandlerPei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 # RISC-V Platform PEI Driver -INF Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/PlatformPei.inf +INF Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf =20 ##########################################################################= ###### =20 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Un= iversal/Pei/PlatformPei/PlatformPei.inf b/Platform/RISC-V/PlatformPkg/Unive= rsal/Pei/PlatformPei/PlatformPei.inf similarity index 88% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Uni= versal/Pei/PlatformPei/PlatformPei.inf rename to Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei= .inf index 59ada9305694..e7f5eef6300f 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/PlatformPei.inf +++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf @@ -3,7 +3,7 @@ # # This module provides platform specific function to detect boot mode. # -# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -62,6 +62,8 @@ gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvBase gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvSize + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported =20 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pe= i/PlatformPei/PlatformPei.inf b/Platform/SiFive/U5SeriesPkg/FreedomU500VC70= 7Board/Universal/Pei/PlatformPei/PlatformPei.inf deleted file mode 100644 index 0e96c33e8fff..000000000000 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/Platf= ormPei/PlatformPei.inf +++ /dev/null @@ -1,73 +0,0 @@ -## @file -# Platform PEI driver -# -# This module provides platform specific function to detect boot mode. -# -# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x0001001b - BASE_NAME =3D PlatformPei - FILE_GUID =3D 222c386d-5abc-4fb4-b124-fbb82488acf4 - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D InitializePlatform - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D RISCV64 -# - -[Sources] - Fv.c - MemDetect.c - Platform.c - -[Packages] - MdeModulePkg/MdeModulePkg.dec - MdePkg/MdePkg.dec - Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec - Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec - Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec - Silicon/SiFive/SiFive.dec - UefiCpuPkg/UefiCpuPkg.dec - -[Guids] - gEfiMemoryTypeInformationGuid - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid - -[LibraryClasses] - DebugLib - HobLib - IoLib - PciLib - PeiResourcePublicationLib - PeiServicesLib - PeiServicesTablePointerLib - PeimEntryPoint - PcdLib - SiliconSiFiveU5MCCoreplexInfoLib - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize - gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration - gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize - gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress - gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvBase - gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvSize - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported - - -[Ppis] - gEfiPeiMasterBootModePpiGuid - -[Depex] - TRUE diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pe= i/PlatformPei/Platform.h b/Platform/RISC-V/PlatformPkg/Universal/Pei/Platfo= rmPei/Platform.h similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei= /PlatformPei/Platform.h rename to Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.h diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Un= iversal/Pei/PlatformPei/Platform.h b/Platform/SiFive/U5SeriesPkg/FreedomU54= 0HiFiveUnleashedBoard/Universal/Pei/PlatformPei/Platform.h deleted file mode 100644 index c2cdd6d75b14..000000000000 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/Platform.h +++ /dev/null @@ -1,86 +0,0 @@ -/** @file - Platform PEI module include file. - - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef PLATFORM_PEI_H_INCLUDED_ -#define PLATFORM_PEI_H_INCLUDED_ - -VOID -AddIoMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ); - -VOID -AddIoMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ); - -VOID -AddMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ); - -VOID -AddMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ); - -VOID -AddUntestedMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ); - -VOID -AddReservedMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ); - -VOID -AddUntestedMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ); - -VOID -AddressWidthInitialization ( - VOID - ); - -EFI_STATUS -PublishPeiMemory ( - VOID - ); - -UINT32 -GetSystemMemorySizeBelow4gb ( - VOID - ); - -VOID -InitializeRamRegions ( - VOID - ); - -EFI_STATUS -PeiFvInitialization ( - VOID - ); - -EFI_STATUS -InitializeXen ( - VOID - ); - -#endif // _PLATFORM_PEI_H_INCLUDED_ diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pe= i/PlatformPei/Fv.c b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/= Fv.c similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei= /PlatformPei/Fv.c rename to Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Fv.c diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Un= iversal/Pei/PlatformPei/MemDetect.c b/Platform/RISC-V/PlatformPkg/Universal= /Pei/PlatformPei/MemDetect.c similarity index 79% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Uni= versal/Pei/PlatformPei/MemDetect.c rename to Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetect.c index 755eae931844..c15d6bb5d425 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/MemDetect.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetect.c @@ -1,7 +1,7 @@ /**@file Memory Detection for Virtual Machines. =20 - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,6 +46,10 @@ PublishPeiMemory ( EFI_PHYSICAL_ADDRESS MemoryBase; UINT64 MemorySize; =20 + // + // TODO: This value should come from platform + // configuration or the memory sizing code. + // MemoryBase =3D 0x80000000UL + 0x1000000UL; MemorySize =3D 0x40000000UL - 0x1000000UL; //1GB - 16MB =20 @@ -69,6 +73,9 @@ InitializeRamRegions ( VOID ) { + // + // TODO: This value should come from platform + // configuration or the memory sizing code. + // AddMemoryRangeHob(0x81000000UL, 0x81000000UL + 0x3F000000UL); - } diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Un= iversal/Pei/PlatformPei/Platform.c b/Platform/RISC-V/PlatformPkg/Universal/= Pei/PlatformPei/Platform.c similarity index 93% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Uni= versal/Pei/PlatformPei/Platform.c rename to Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c index 9a2cb9413caf..24192c692ba7 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c @@ -199,11 +199,14 @@ MiscInitialization ( // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed dur= ing // S3 resume as well, so we build it unconditionally.) // + // TODO: Determine this dynamically from the platform + // setting or the HART configuration. + // BuildCpuHob (48, 32); } =20 /** - Check if system retunrs from S3. + Check if system returns from S3. =20 @return BOOLEAN TRUE, system returned from S3 FALSE, system is not returned from S3 @@ -254,6 +257,7 @@ BuildCoreInformationHob ( EFI_STATUS Status; RISC_V_PROCESSOR_SMBIOS_HOB_DATA *SmbiosHobPtr; =20 + // TODO: Create SMBIOS libs for non-U540 platforms Status =3D CreateU5MCCoreplexProcessorSpecificDataHob (0); if (EFI_ERROR (Status)) { ASSERT(FALSE); diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pe= i/PlatformPei/MemDetect.c b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Boa= rd/Universal/Pei/PlatformPei/MemDetect.c deleted file mode 100644 index 755eae931844..000000000000 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/Platf= ormPei/MemDetect.c +++ /dev/null @@ -1,74 +0,0 @@ -/**@file - Memory Detection for Virtual Machines. - - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -Module Name: - - MemDetect.c - -**/ - -// -// The package level header files this module uses -// -#include - -// -// The Library classes this module consumes -// -#include -#include -#include -#include -#include -#include -#include - -#include "Platform.h" - - -/** - Publish PEI core memory - - @return EFI_SUCCESS The PEIM initialized successfully. - -**/ -EFI_STATUS -PublishPeiMemory ( - VOID - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS MemoryBase; - UINT64 MemorySize; - - MemoryBase =3D 0x80000000UL + 0x1000000UL; - MemorySize =3D 0x40000000UL - 0x1000000UL; //1GB - 16MB - - DEBUG((DEBUG_INFO, "%a: MemoryBase:0x%x MemorySize:%x\n", __FUNCTION__, = MemoryBase, MemorySize)); - - // - // Publish this memory to the PEI Core - // - Status =3D PublishSystemMemory(MemoryBase, MemorySize); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Publish system RAM and reserve memory regions - -**/ -VOID -InitializeRamRegions ( - VOID - ) -{ - AddMemoryRangeHob(0x81000000UL, 0x81000000UL + 0x3F000000UL); - -} diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pe= i/PlatformPei/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Boar= d/Universal/Pei/PlatformPei/Platform.c deleted file mode 100644 index 6641e10f2ec3..000000000000 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Universal/Pei/Platf= ormPei/Platform.c +++ /dev/null @@ -1,310 +0,0 @@ -/**@file - Platform PEI driver - - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
- Copyright (c) 2011, Andrei Warkentin - - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -// -// The package level header files this module uses -// -#include - -// -// The Library classes this module consumes -// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "Platform.h" - -EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D { - { EfiACPIMemoryNVS, 0x004 }, - { EfiACPIReclaimMemory, 0x008 }, - { EfiReservedMemoryType, 0x004 }, - { EfiRuntimeServicesData, 0x024 }, - { EfiRuntimeServicesCode, 0x030 }, - { EfiBootServicesCode, 0x180 }, - { EfiBootServicesData, 0xF00 }, - { EfiMaxMemoryType, 0x000 } -}; - - -EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D { - { - EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, - &gEfiPeiMasterBootModePpiGuid, - NULL - } -}; - -STATIC EFI_BOOT_MODE mBootMode =3D BOOT_WITH_FULL_CONFIGURATION; - -VOID -AddIoMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ) -{ - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_MAPPED_IO, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - MemoryBase, - MemorySize - ); -} - -VOID -AddReservedMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ) -{ - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_RESERVED, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - MemoryBase, - MemorySize - ); -} - -VOID -AddIoMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ) -{ - AddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase)); -} - - -VOID -AddMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ) -{ - BuildResourceDescriptorHob ( - EFI_RESOURCE_SYSTEM_MEMORY, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - MemoryBase, - MemorySize - ); -} - - -VOID -AddMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ) -{ - AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase)); -} - - -VOID -AddUntestedMemoryBaseSizeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - UINT64 MemorySize - ) -{ - BuildResourceDescriptorHob ( - EFI_RESOURCE_SYSTEM_MEMORY, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, - MemoryBase, - MemorySize - ); -} - -VOID -AddUntestedMemoryRangeHob ( - EFI_PHYSICAL_ADDRESS MemoryBase, - EFI_PHYSICAL_ADDRESS MemoryLimit - ) -{ - AddUntestedMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryB= ase)); -} - -VOID -AddPciResource ( - VOID - ) -{ - // - // Platform-specific - // -} - -VOID -MemMapInitialization ( - VOID - ) -{ - // - // Create Memory Type Information HOB - // - BuildGuidDataHob ( - &gEfiMemoryTypeInformationGuid, - mDefaultMemoryTypeInformation, - sizeof(mDefaultMemoryTypeInformation) - ); - - // - // Add PCI IO Port space available for PCI resource allocations. - // - AddPciResource (); -} - -VOID -MiscInitialization ( - VOID - ) -{ - // - // Build the CPU HOB with guest RAM size dependent address width and 16-= bits - // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed dur= ing - // S3 resume as well, so we build it unconditionally.) - // - BuildCpuHob (32, 32); -} - -/** - Check if system retunrs from S3. - - @return BOOLEAN TRUE, system returned from S3 - FALSE, system is not returned from S3 - -**/ -BOOLEAN -CheckResumeFromS3 ( - VOID - ) -{ - // - //Platform implementation-specific - // - return FALSE; -} - - -VOID -BootModeInitialization ( - VOID - ) -{ - EFI_STATUS Status; - - if (CheckResumeFromS3 () =3D=3D TRUE) { - DEBUG ((DEBUG_INFO, "This is wake from S3\n")); - } else { - DEBUG ((DEBUG_INFO, "This is normal boot\n")); - } - Status =3D PeiServicesSetBootMode (mBootMode); - ASSERT_EFI_ERROR (Status); - - Status =3D PeiServicesInstallPpi (mPpiBootMode); - ASSERT_EFI_ERROR (Status); -} - -/** - Build processor information for U54 Coreplex processor. - - @return EFI_SUCCESS Status. - -**/ -EFI_STATUS -BuildCoreInformationHob ( - VOID -) -{ - EFI_STATUS Status; - RISC_V_PROCESSOR_SMBIOS_HOB_DATA *SmbiosHobPtr; - - Status =3D CreateU5MCCoreplexProcessorSpecificDataHob (0); - if (EFI_ERROR (Status)) { - ASSERT(FALSE); - } - Status =3D CreateU5MCProcessorSmbiosDataHob (0, &SmbiosHobPtr); - if (EFI_ERROR (Status)) { - ASSERT(FALSE); - } - - DEBUG ((DEBUG_INFO, "U5 MC Coreplex SMBIOS DATA HOB at address 0x%x\n", = SmbiosHobPtr)); - - return EFI_SUCCESS; -} - -/** - Perform Platform PEI initialization. - - @param FileHandle Handle of the file being invoked. - @param PeiServices Describes the list of possible PEI Services. - - @return EFI_SUCCESS The PEIM initialized successfully. - -**/ -EFI_STATUS -EFIAPI -InitializePlatform ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - EFI_STATUS Status; - - DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n")); - - BootModeInitialization (); - DEBUG ((DEBUG_INFO, "Platform BOOT mode initiated.\n")); - PublishPeiMemory (); - DEBUG ((DEBUG_INFO, "PEI memory published.\n")); - InitializeRamRegions (); - DEBUG ((DEBUG_INFO, "Platform RAM regions initiated.\n")); - - if (mBootMode !=3D BOOT_ON_S3_RESUME) { - PeiFvInitialization (); - MemMapInitialization (); - } - - MiscInitialization (); - Status =3D BuildCoreInformationHob (); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Fail to build processor informstion HOB.\n")); - ASSERT(FALSE); - } - return EFI_SUCCESS; -} diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Un= iversal/Pei/PlatformPei/Fv.c b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiv= eUnleashedBoard/Universal/Pei/PlatformPei/Fv.c deleted file mode 100644 index 060d66238dff..000000000000 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal= /Pei/PlatformPei/Fv.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - Build FV related hobs for platform. - - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
- Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "PiPei.h" -#include "Platform.h" -#include -#include -#include -#include - -/** - Publish PEI & DXE (Decompressed) Memory based FVs to let PEI - and DXE know about them. - - @retval EFI_SUCCESS Platform PEI FVs were initialized successfully. - -**/ -EFI_STATUS -PeiFvInitialization ( - VOID - ) -{ - DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n")); - // - // Let DXE know about the DXE FV - // - BuildFvHob (PcdGet32 (PcdRiscVDxeFvBase), PcdGet32 (PcdRiscVDxeFvSize)); - DEBUG ((DEBUG_INFO, "Platform builds DXE FV at %x, size %x.\n", - PcdGet32 (PcdRiscVDxeFvBase), - PcdGet32 (PcdRiscVDxeFvSize))); - - // - // Let PEI know about the DXE FV so it can find the DXE Core - // - PeiServicesInstallFvInfoPpi ( - NULL, - (VOID *)(UINTN) PcdGet32 (PcdRiscVDxeFvBase), - PcdGet32 (PcdRiscVDxeFvSize), - NULL, - NULL - ); - - return EFI_SUCCESS; -} --=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 (#82271): https://edk2.groups.io/g/devel/message/82271 Mute This Topic: https://groups.io/mt/86432313/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- From nobody Tue May 7 05:34:20 2024 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+82270+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+82270+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 1634615365077696.6761077743707; Mon, 18 Oct 2021 20:49:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 69MdYY1788612xYX7mbgfXuC; Mon, 18 Oct 2021 20:49:24 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web09.5140.1634615357131233158 for ; Mon, 18 Oct 2021 20:49:24 -0700 X-Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ILhQZa003763; Tue, 19 Oct 2021 03:49:16 GMT X-Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsbpkccus-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:16 +0000 X-Received: from G9W9210.americas.hpqcorp.net (g9w9210.houston.hpecorp.net [16.220.66.155]) (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 6115B51; Tue, 19 Oct 2021 03:49:15 +0000 (UTC) X-Received: from G4W10204.americas.hpqcorp.net (2002:10cf:5210::10cf:5210) by G9W9210.americas.hpqcorp.net (2002:10dc:429b::10dc:429b) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:15 +0000 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (15.241.52.10) by G4W10204.americas.hpqcorp.net (16.207.82.16) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:49:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cbDXhy9+/exEXpezI2dbTyiAH7/rG9jBk7eZEiCO1kb3hwxTL7+tb0fKBge1JsLopOBKvMttelCOBmTVC4gb978NH0F5/0s84AaFsPCNYkXwrIt3GA2jEPIOYl6yvNDeKYYo+OZXUTiZ1w7Sut7oRNqDObWYloCa2+dkWan1RBOwWZap+wORSsLyRxLFQPZjn1XAVpzBH4rIM+Un6hGg9SvoN+rGphRHZj2bOnR+uSLlqTjrpF0CloBqLIzWgE64SvL0c0HDrl7Kev3ms8+/BO4918R/K8noY0iCKdc4WG3XQymqCCmKUfWnDlESzqVt4SJKVLFpvV05VBv8tEaSGQ== 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=dnVn8GP/AIYGok/7XOyV5Dcg/hrzOdCjibwtkNwdejY=; b=CbgPpdfZgxZQ97wi76eHvJZIEZr5GFRGLLG2JL+JhhoJLuBmKuh4rSyJDSbSNfnm/W75N4nNf+RsPoXB4a4fva7q4+0X53KFtw3okrpeJUnzI7cfe061jaFIRsG8RKPskHCsBcaR+jee7kKo1Z1j1H6Hyxki7r1c7xPzIELcq5I1A+4k970VuYIf5/bl+WdpRhshWCZ6JcuJsaQfTpLa9bFpf9LYtKrCBfvgTpp2mZTGdR10+LlO/V5l6MhXIOq6Wmd/2RwB9cqOiAX4qw+fnsFowysooHNpf+tHL09gVZ0kagirMSvAUHfDz0MHu5xjq+mBfH84ViHf51ROLKnyOA== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:14 +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:49:14 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 02/14] RISC-V: Split SMBIOS out of PlatformPei Date: Tue, 19 Oct 2021 11:48:37 +0800 Message-ID: <20211019034849.16847-3-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:49:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5f84c22-98b5-4060-4785-08d992b36ac1 X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: +D4IjheZSyW3SiBOE/lw+JXJdGumbP3eVge896WR4TQTX+U3QPA3zcDC/Ua89K1+MNqxZ2UbC3DDN3wpAEwh82g3TzyEjiwBVZxVc9RfDYe4kZD4tDZVwZH9ChrVYFHXaARaeViZgAnZllqq8ypNelsZJHAtsDotlLfcYXfdfczqFuXOSZgeAMefyXm67Ri1mDeVLnznEszu/HZOey1YVCOixKsQfKKOBdnY0R0ZbFfeFH7zLF27jNebE0HLdh8TKdpGJIkfne+avpGjHt/Z85SKMWIMeYvMtB6ue2S9k4evgWPCX4yRlyosm+jWlnlL3Dy9DKGbShVq2y1HoDBriYXquOQR7FbIgju552p8ADUbYG+ofEikBZogLgkIlIuaXz9npPpgFPoPhThfdw1AFk8r2jxANGh3yzEIT1xKk/xXobd5jx+YhO73CCNYv2Iw5QWyAlzIloAWmbDsxzjXlt3FHAzzRjAUJhYCkkw9jwZzt35BBASMJ2Im3zmJmx7PhxDEA7gkN82qTqVxm1EB3uOxYM1Bp2OIgApZ9ygPzHoh3YY+LF8XojdJI1Kh3KDntkufnqOnS9adS38ExoFwCTCoCfFEZWNzX6Olkgq8ujZZAfI0t7KM5ZoBkVbE6L9l/CvZ6m/rt9cURs1JIQTQODz23Gc+nUyFJxifj/HgIte0Qnwdjaajos1/xIyr8jvkTKmr3x73y7VqsW1901LPPw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zr5/yQUhDzwOriIzdEyZszieqOs/jRNhFcd8aUQ3Xk5S2SHdkyEIZU1fcYDs?= =?us-ascii?Q?zxhm4o0B3034O6dAvZDfyRYwtfMGJl+BTxbVYnA+NOdPmK3pEnQlGHa6gpzG?= =?us-ascii?Q?MW0hXAT9+c2Q27U3HOHg0TzZFAMLwkoXI1EfgI0o3EcF8KrdRFvZDm1sa3qb?= =?us-ascii?Q?iGzF91C/X+QN+jeFj99jSmjK2xVO7f4cBEgEpNDLYCNJ/KejS03N7KOPCIqh?= =?us-ascii?Q?uqwVUEMQEkEnmF8jvI1hHZdbV8pBwLANG8xWD+ddVg08qHiU0MTAHDrXOCxm?= =?us-ascii?Q?waCUXrdIfSDIaTlUi2UtwPMgnbXPKMuzehWJJn2uBVZNwDS45Y/FeBEYycqc?= =?us-ascii?Q?JHxcX96Q/QkGlAMzhnve23Vf58DVoXbjjLwnWSDIkypaDy1eLCIX3uy8g5dl?= =?us-ascii?Q?Lp0t/Fdnjb2SqHJ3wxPVfdw6SA7Z6xC6sTnLmd53N4Ol54b9yoNyCjlNRFKi?= =?us-ascii?Q?nnZcUTB/67B646bG4WTEnigTaPbxf1ry90C+x3UxxWo249ujLk2i7L1PYx/Q?= =?us-ascii?Q?5qMAm689n8eEmD4BK4AcUIOmltrAc+lohwOJsmmmygxbcC5X155h75yGJsuk?= =?us-ascii?Q?IAAD0WjjO095/CofJ1oI/g3AbW1pvJdUF3qimepAUYKTZu9tZc/Zgazpi3/w?= =?us-ascii?Q?IJfNtKEhKht/hZrbW4MWbVW30Zaq3E6Y0Hns9/2d8RpHPhtwzl7oPw9gOfLB?= =?us-ascii?Q?a5OitIr19oF+sIxdcXhd8RngG+qsqyfd9oTdIxxfMQy0oiUOe8fcDQE51eLg?= =?us-ascii?Q?KnDEdEQTsxkMcgIPjhvKbwcfrxFwbKN0eGl4VBHArH/ofTD896KoiyFaXje+?= =?us-ascii?Q?OnAShxuh0KNcb67YdWLxwwVl2C6oxQOVpLeo5bPndJcAT3VVD5AOPrGZ7scZ?= =?us-ascii?Q?82x1ed+fdXymx/ZBgDHBJS7ao9fiEp77Ql6jIr8AG310DU0Tkd7y7tBKgmko?= =?us-ascii?Q?Cm40M1CLprZLtd9BR7d0tw9UEfp+FxRzTWG6vlb9YRjRXuDJF50vNKVcVu0H?= =?us-ascii?Q?0343/inIu4XSYTFZTeTqcRvMxc7KtvoQp/lBmNj9EBYjhDezsh9ibpaqLpuO?= =?us-ascii?Q?11eD6byDB9HG0vwtfXN1fk8O5aRtbj0HYQK3kGeUaPPa5UpjSfK8Va8JbZ7e?= =?us-ascii?Q?Kla9iONUjnTWFqJWKuGCTqR5Z4nww8SfgAjexwDtmhJRTVXV0RUMdUqZAZ6C?= =?us-ascii?Q?BAmkclyeabTCMeT+sW1La7brZceEhR60dEPsz4zspYm556894C9wQHyQeGmQ?= =?us-ascii?Q?gTcMEDnM043l4xdRD2N+t8pJbb7DONZw4xkspMIBXjRue7RxjwNCTkxIFGwU?= =?us-ascii?Q?urTGuE7a93bGc59aBNjpF4Gm?= X-MS-Exchange-CrossTenant-Network-Message-Id: b5f84c22-98b5-4060-4785-08d992b36ac1 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:49:14.0987 (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: mxKxK7QO/2hM3gaFoPs0kM5m1I8ffPlRTN7NTpPFwBjbbH3AQ9+2UejDxd5BfT+pPamygpHqb2uq+Vhh9R+r8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: V_OyNEh46LUVwQviUmCMeYfE9y5aFcBc X-Proofpoint-ORIG-GUID: V_OyNEh46LUVwQviUmCMeYfE9y5aFcBc 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: 7ceFw2sg4q3pKvOVk1KaD0lIx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615364; bh=oSNU0u8qBQZbmgmXHU0GkjH0jcAGWrzdJRGlhU70XDE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=eFW6O3W+UjDt6rJsS9A/4v884LcZNK3blt8P89oaeM1oJavsChHPgIm2/pByZXxBWQ8 4wZE/1Z6h6c0vUwvTiDtIW58Qf4MzAIEl2skw8snhbHoNeVZdaIjQXwashA1ACTngcpJM +2scKzuv2qOtUMgSOI9b372ocO1MJjQdbuU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615366501100006 Content-Type: text/plain; charset="utf-8" Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/Include/SiFiveU5MCCoreplex.h | 33 += +++---------------- Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c | 17 += --------- Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/CoreInfoHob.c | 32 += +++++++++++++++++- 3 files changed, 38 insertions(+), 44 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/Include/SiFiveU5MCCoreplex.h b/Pla= tform/SiFive/U5SeriesPkg/Include/SiFiveU5MCCoreplex.h index 5d70e26f8359..363b34a8f1ac 100644 --- a/Platform/SiFive/U5SeriesPkg/Include/SiFiveU5MCCoreplex.h +++ b/Platform/SiFive/U5SeriesPkg/Include/SiFiveU5MCCoreplex.h @@ -1,7 +1,7 @@ /** @file SiFive U54 Coreplex library definitions. =20 - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -17,35 +17,14 @@ #define SIFIVE_U5MC_COREPLEX_MC_HART_ID 0 =20 /** - Build up U5MC coreplex processor core-specific information. + Build processor and platform information for the U5 platform =20 - @param UniqueId U5MC unique ID. - - @return EFI_STATUS + @return EFI_SUCCESS Status. =20 **/ EFI_STATUS -EFIAPI -CreateU5MCCoreplexProcessorSpecificDataHob ( - IN UINTN UniqueId - ); - -/** - Function to build processor related SMBIOS information. RISC-V SMBIOS DX= E driver collect - this information and build SMBIOS Type4 and Type7 record. - - @param ProcessorUid Unique ID of pysical processor which owns th= is core. - @param SmbiosDataHobPtr Pointer to receive RISC_V_PROCESSOR_SMBIOS_D= ATA_HOB. The pointers - maintained in this structure is only valid b= efore memory is discovered. - Access to those pointers after memory is ins= talled will cause unexpected issues. +BuildRiscVSmbiosHobs ( + VOID +); =20 - @return EFI_SUCCESS The PEIM initialized successfully. - -**/ -EFI_STATUS -EFIAPI -CreateU5MCProcessorSmbiosDataHob ( - IN UINTN ProcessorUid, - OUT RISC_V_PROCESSOR_SMBIOS_HOB_DATA **SmbiosDataHobPtr - ); #endif diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform= .c b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c index 24192c692ba7..8586a94b6285 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c @@ -254,22 +254,7 @@ BuildCoreInformationHob ( VOID ) { - EFI_STATUS Status; - RISC_V_PROCESSOR_SMBIOS_HOB_DATA *SmbiosHobPtr; - - // TODO: Create SMBIOS libs for non-U540 platforms - Status =3D CreateU5MCCoreplexProcessorSpecificDataHob (0); - if (EFI_ERROR (Status)) { - ASSERT(FALSE); - } - Status =3D CreateU5MCProcessorSmbiosDataHob (0, &SmbiosHobPtr); - if (EFI_ERROR (Status)) { - ASSERT(FALSE); - } - - DEBUG ((DEBUG_INFO, "U5 MC Coreplex SMBIOS DATA HOB at address 0x%x\n", = SmbiosHobPtr)); - - return EFI_SUCCESS; + return BuildRiscVSmbiosHobs (); } =20 /** diff --git a/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/CoreInfo= Hob.c b/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/CoreInfoHob.c index b2f74c2a743b..bc1b252946d9 100644 --- a/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/CoreInfoHob.c +++ b/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/CoreInfoHob.c @@ -1,7 +1,7 @@ /**@file Build up platform processor information. =20 - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -32,6 +32,7 @@ @return EFI_SUCCESS The PEIM initialized successfully. =20 **/ +STATIC EFI_STATUS EFIAPI CreateU5MCCoreplexProcessorSpecificDataHob ( @@ -96,6 +97,7 @@ CreateU5MCCoreplexProcessorSpecificDataHob ( @return EFI_SUCCESS The SMBIOS Hobs were created successfully. =20 **/ +STATIC EFI_STATUS EFIAPI CreateU5MCProcessorSmbiosDataHob ( @@ -163,3 +165,31 @@ CreateU5MCProcessorSmbiosDataHob ( =20 return EFI_SUCCESS; } + +/** + Build processor and platform information for the U5 platform + + @return EFI_SUCCESS Status. + +**/ +EFI_STATUS +BuildRiscVSmbiosHobs ( + VOID +) +{ + EFI_STATUS Status; + RISC_V_PROCESSOR_SMBIOS_HOB_DATA *SmbiosHobPtr; + + Status =3D CreateU5MCCoreplexProcessorSpecificDataHob (0); + if (EFI_ERROR (Status)) { + ASSERT(FALSE); + } + Status =3D CreateU5MCProcessorSmbiosDataHob (0, &SmbiosHobPtr); + if (EFI_ERROR (Status)) { + ASSERT(FALSE); + } + + DEBUG ((DEBUG_INFO, "U5 MC Coreplex SMBIOS DATA HOB at address 0x%x\n", = SmbiosHobPtr)); + + return EFI_SUCCESS; +} --=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 (#82270): https://edk2.groups.io/g/devel/message/82270 Mute This Topic: https://groups.io/mt/86432312/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- From nobody Tue May 7 05:34:20 2024 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+82272+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+82272+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 1634615369154752.8703050590833; Mon, 18 Oct 2021 20:49:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SNAPYY1788612xcseftFwW0g; Mon, 18 Oct 2021 20:49:28 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.5142.1634615362147075784 for ; Mon, 18 Oct 2021 20:49:28 -0700 X-Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19INVsBR004180; Tue, 19 Oct 2021 03:49:21 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 3bseymjhyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:21 +0000 X-Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id B9D915C; Tue, 19 Oct 2021 03:49:20 +0000 (UTC) X-Received: from G4W9332.americas.hpqcorp.net (16.208.32.118) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:18 +0000 X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G4W9332.americas.hpqcorp.net (16.208.32.118) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:17 +0000 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (15.241.52.13) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:49:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0EnU01YOnABWJ84NN+eO2/Ry3pf18lZ8yqEJ0W/Eqx/OpjAt58kOxnD5UPUCk2RjwKFnabZizCsTnPya+aEB4SfhsPODAOHb9jUYXIfuOWDCf5YA5cnhb56sF47v7Yt4ilCAag0cJzrUv54UaSsVS7dIP2K/29CqCzJKQ6NxrE9+rg8LElV0uOfyTk1K2v7HkCqbRQTY1comNd4cNBF/Tk/ygFKRnaDB3Xqzs8NVwlEIcoJRjJFvmuokvH1z64jajqHxLFkDEJCMTUk3kHavaIQapFj779L0GIhz+wZV0y3yZtNYMBFmo6QfV6DGBA/QVioYgJqyoRN/EKYutg58w== 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=k0pQyS5yO2fRfgkbNdKpnlRSZQuwgeHzDOvicoNGjro=; b=axG0qcRkKu+sBja23rc9vPrlQaARVO6UKWo42BVc7+qLFuChfC+y09fMtZMKuL/8LorNUtei7vt7Y2IRrP27y+qCv1HUkq1d1HO8ljShGRkvpDqn/7mfO7hvM2W9OGUnR8xnJXp4PgHs7RY5JAuR2oykL8WV3AHKG7nOFbonP+70VE4axV+46qJ58YwLcWnCFh+SgAsBDvpgz3EUdnS3ON9eIebNZOpmjcmEfkyodBSlQZAOSsPtFS+WPyS6BIOTSlSX72qARIm0mhBl/oXMXJUotoJX2evESl1gqbB4xMSQr4kF/72S+YQZJxwb6gO5kCCHzrOnESViY4ShGNH0xQ== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:16 +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:49:16 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 03/14] RISC-V: Use U5 SMBIOS library only for those platforms Date: Tue, 19 Oct 2021 11:48:38 +0800 Message-ID: <20211019034849.16847-4-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:49:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0092a5ac-d9e5-468f-1181-08d992b36c56 X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: BZSfgem7Jsb55ymQvlsYtj2PiZ+KC6J2l7GMb2bQbVzdP8nnJreubl/iu4JVbM78qBlAw+3Ur9CRACW4umAyVGWZBSPcdwvfQ+ljJYhG3LxrDdF6zFFq/NK6QLBb2YKQY8iHqt+RL7DzqzusyBuBSRHAlWMFsr0VGVR97mXV4Mmom1w41aDZ6xnh5Fq422MVMDJQZ5bQAb0mUr5rWDl4U53nXKZGy5UPLwHyrCDDsiVParYRheeBXQ8aGOLUvaL8+jBmd1Up1zdxwU3OltIEB6RwHL96OhoMIVynEsSp00i2Xlc2/uXonOcbE8jegaNHe3G7hCajnhR6DhhQK75yxjTTMdjpRjyuDaBu1EjT0m7kCPXGa5KFawXalqoZG9Jn/TUJKW+sPmF51v5eR6chIkg1Arih/uAQcbx1cusD7elDCcSQQ3eRtSkn8Y+VE+P0c8GLVHaIWyTz1ByIa9RrBT6OKFH8EbGuc4FL9A/mKtnMJ9OcrJ5PgVPIuQ+4PI8tIDX8jEIguX3YcAxMbwaoZ9D8oD6hjp3b6NZV1iHn9dZA0EPaHK6Q8wFceBQ4OJ1Tma5/298Nq3GDt0FTN7uc5wgNeTyn2oUHKL5jev9qNwVptpFt+I7hECxOlRccXO7chWTX3sCcYU7rOFDqIFVgFIt48UAIwjTJjW2soN0gZj0WQvSE8wj0RWTd1fU6UjhlYYK8UPzuarra3TizztFD+g== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6LgfB1qA3KZ1ZLr4kxSy0xv1mASTUTiuETA9LMzVNQSlJpKBBkEoH+mPuy0B?= =?us-ascii?Q?/XRC3qeoeLfYianyiywYMmECyRkVpFBT0Id3CdzL71yRhT+Rs2o14t1peIOG?= =?us-ascii?Q?B+DXU6SMg8I+vuVko71Jn6UWBoL1gefDAhEmNHfFLopRuGq3R4nstvbFC9aa?= =?us-ascii?Q?M7EnvSkuVNfCsEWVuxWdeCekUEzk3ZQrqRra3ZzQnBpksw7oUtpXRaU7u1ko?= =?us-ascii?Q?OSaEiRmPVIxEBVZFQTzSgBCyS3fmsj2/9o3YKOE7gcbWOREr0dcIuIwUbZZ+?= =?us-ascii?Q?spJqYoiC59MyyVTGuIM0+UaFDT7r9Qp7Of1wLQC5oYw4hPOrJ1k70KU4Kolo?= =?us-ascii?Q?f3h5SvzO8s45ZgWAUzpHxqFRmjl/LkBNcV3oaMTG3hPe4y/pIIisO3vLfvpX?= =?us-ascii?Q?ktI2cHhRmF7wHe9q3tkQ3nUDviQ8JQXxkg09s6IZrFGCbHx/fiKjkR6Ri7Tj?= =?us-ascii?Q?Wupnjb1atqxYYdXxTGcokJ9gY61D36taCMA5gcBWZfbwBYhVo8b7H80P/g1o?= =?us-ascii?Q?4FVBor6Azt8ytiLRXkB/vQc0EaPv7c7EtYeN9GdPJt8GQKcf8Ow3BFTAegJ+?= =?us-ascii?Q?3Nqnr4u+lLwzuWHC+4Yw2EKGW5DwVENT6WfZB7dNtPHNt/Dats2vE1XEHF6u?= =?us-ascii?Q?3/JSHoxd4bYTOFGi38CatMvWUHok379jhAeJHXHXo5aaggmxuYi1wXIVejTT?= =?us-ascii?Q?qaOtm0W9u3iiDL3KK79HzkHumtyHL338n507RfMej7YSbwfYLv716FfcmKny?= =?us-ascii?Q?I/jboyVl9hNmLb/z3Rva7sJhoY/n7tXPFjvgwrENotHRvilY9mmXDcKxdzM5?= =?us-ascii?Q?UITGt9qa+hnE/JuCX3RAaXXUws9EFZ7Fs6v5wFxBCOvtU5NRkV+OzUHaulv3?= =?us-ascii?Q?xRie3POvyvhPjQZirnoDPPA+lxZna55SPLsMsezdB4K+utNEmnzOBB9Clp9B?= =?us-ascii?Q?kAKIe3mDihVQcVeSev1a9ZXXjU9iW1+jVBH1+stTyF5VsHTICqhV/I+Qv3TB?= =?us-ascii?Q?CTUXThyLlxDlyo5lWYW8wcFsTx/NwQjZFtD0Wy7y7kc0UC25s7SMPF2WYXsY?= =?us-ascii?Q?pohyFfEyjw4OtuFUx2QBjLZrbIPKnYFXWi0rEC1NkZyMaifj4cMyQhCl8aG0?= =?us-ascii?Q?pkiccKW5FNe7IVCnGaKKK3voZ1Z5PQMLRl/1vrMDXKqjwnfRd+OyS0UzkwR6?= =?us-ascii?Q?Qt9Kw6sQF074ZEn3Gb1B8szU/LUPsCEzDNWfpcKZuWU8ndRpBRUaUv+ayTbJ?= =?us-ascii?Q?oGqBEXR6WvBQAoPu3YSKCIu/2FW0hTX+v9KWj0lYqJolriXDPGz4UbIXbBws?= =?us-ascii?Q?X0SRoh33KMwQ8YFg6ROlfaEj?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0092a5ac-d9e5-468f-1181-08d992b36c56 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:49:16.7595 (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: li0CI0rm+w9HBlZ3E+kToACqCYBeOhrxb+x5i5qLah+mfvQQrydNXtqn7ON3WxPV97xoTp0e7KW5hkAvGCKTkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: izbMn5cc4fcmUxqOprIFN_eEmDIQWW30 X-Proofpoint-GUID: izbMn5cc4fcmUxqOprIFN_eEmDIQWW30 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: yrEgaV95mmDBvX8n7vnVza0Dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615368; bh=TjYuDph8pjKV9y7O4BekDLnK7jfIZ8/PJkBg6aNMORo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=HUPdtDsV38TraZyKbQmWQOs8kQ+YwO4ANVjSGMQ8xHsRd+m3i0INiZ8AhRlVEyldD/x GSEjJWFvXB1K3PJogfrruhCVvJyd/79P4rhQ/7R2PHo4jx0SXwXn4KxmHotOg3tyrs+T1 bTkyBl4IeIcGMOP1DTLnYeuSNwYj7OuZVOs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615370703100002 Content-Type: text/plain; charset="utf-8" Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc = | 2 +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc = | 2 +- Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/PeiCoreInfoHobLi= b.inf | 43 ++++++++++++++++++++ Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf = | 2 +- Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/PeiCoreInfoHobLib.in= f | 4 +- Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/CoreInfoHob.c = | 37 +++++++++++++++++ 6 files changed, 85 insertions(+), 5 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc b/P= latform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc index fce1c5057879..1dc6405a20f0 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc @@ -212,7 +212,7 @@ # RISC-V core libraries # SiliconSiFiveU54CoreInfoLib|Silicon/SiFive/U54/Library/PeiCoreInfoHobLib= /PeiCoreInfoHobLib.inf - SiliconSiFiveU5MCCoreplexInfoLib|Platform/SiFive/U5SeriesPkg/Library/Pei= CoreInfoHobLib/PeiCoreInfoHobLib.inf + RiscVCoreplexInfoLib|Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobL= ib/PeiCoreInfoHobLib.inf =20 [LibraryClasses.common.DXE_CORE] TimerLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVTimerLib/BaseRiscVTime= rLib.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 14d83fb25a9f..18a99b86d849 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -213,7 +213,7 @@ # RISC-V core libraries # SiliconSiFiveU54CoreInfoLib|Silicon/SiFive/U54/Library/PeiCoreInfoHobLib= /PeiCoreInfoHobLib.inf - SiliconSiFiveU5MCCoreplexInfoLib|Platform/SiFive/U5SeriesPkg/Library/Pei= CoreInfoHobLib/PeiCoreInfoHobLib.inf + RiscVCoreplexInfoLib|Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobL= ib/PeiCoreInfoHobLib.inf =20 [LibraryClasses.common.DXE_CORE] TimerLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVTimerLib/BaseRiscVTime= rLib.inf diff --git a/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/PeiC= oreInfoHobLib.inf b/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNu= ll/PeiCoreInfoHobLib.inf new file mode 100644 index 000000000000..5a8db5071f40 --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/PeiCoreInfo= HobLib.inf @@ -0,0 +1,43 @@ +## @file +# Library instance to create core information HOB +# +# 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 RiscVCoreplexInfoLibNull + FILE_GUID =3D E5783AF0-B7C5-4FAA-BAB4-D52C06B98BBE + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RiscVCoreplexInfoLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D RISCV64 +# + +[Sources] + CoreInfoHob.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + BaseLib + PcdLib + MemoryAllocationLib + PrintLib + +[Guids] + +[Ppis] + +[FixedPcd] diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform= Pei.inf b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei= .inf index e7f5eef6300f..0db88abba420 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf +++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf @@ -51,7 +51,7 @@ PeiServicesTablePointerLib PeimEntryPoint PcdLib - SiliconSiFiveU5MCCoreplexInfoLib + RiscVCoreplexInfoLib =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved diff --git a/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/PeiCoreI= nfoHobLib.inf b/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/PeiCo= reInfoHobLib.inf index b3124a6daf77..d741f0474769 100644 --- a/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/PeiCoreInfoHobL= ib.inf +++ b/Platform/SiFive/U5SeriesPkg/Library/PeiCoreInfoHobLib/PeiCoreInfoHobL= ib.inf @@ -1,7 +1,7 @@ ## @file # Library instance to create core information HOB # -# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -13,7 +13,7 @@ FILE_GUID =3D 4E397A71-5164-4E69-9884-70CBE2740AAB MODULE_TYPE =3D PEIM VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D SiliconSiFiveU5MCCoreplexInfoLib + LIBRARY_CLASS =3D RiscVCoreplexInfoLib =20 # # The following information is for reference only and not required by the = build tools. diff --git a/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/Core= InfoHob.c b/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/CoreI= nfoHob.c new file mode 100644 index 000000000000..9aad7991bc77 --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Library/PeiCoreInfoHobLibNull/CoreInfoHob= .c @@ -0,0 +1,37 @@ +/**@file + Build up platform processor information. + + Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +// +// The package level header files this module uses +// +#include + +// +// The Library classes this module consumes +// +#include +#include +#include + +#include + + +/** + Build processor and platform information for a generic RISC-V + + @return EFI_SUCCESS Status. + +**/ +EFI_STATUS +BuildRiscVSmbiosHobs ( + VOID +) +{ + return EFI_SUCCESS; +} --=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 (#82272): https://edk2.groups.io/g/devel/message/82272 Mute This Topic: https://groups.io/mt/86432315/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- From nobody Tue May 7 05:34:20 2024 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+82275+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+82275+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 1634615376246126.35978155433054; Mon, 18 Oct 2021 20:49:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id otWVYY1788612xWhEBpYSqrQ; Mon, 18 Oct 2021 20:49:35 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web08.5092.1634615371202279647 for ; Mon, 18 Oct 2021 20:49:35 -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 19ILhPjW009083; Tue, 19 Oct 2021 03:49:30 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsb1x4qm9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:30 +0000 X-Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 88BFD61; Tue, 19 Oct 2021 03:49:29 +0000 (UTC) X-Received: from G4W9335.americas.hpqcorp.net (16.208.33.85) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:29 +0000 X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G4W9335.americas.hpqcorp.net (16.208.33.85) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:21 +0000 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (15.241.52.12) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:49:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TaQiw1mZZDy3GDOCGDxKPoQnBgXsgXCLckRfrHZanotZ/sLko2aqYq9CwwuukEf7boM6UwIYNVUxkxznzamtF7sKsnXrvOibbIwkzrHl+4N/BbCoQG4B7+Oapa3GiMWwyrD68lGICQBQmHh5BCfzi2TI4qtKOG/sKl4UmkCn+R1Or0Wqc7++tZoIvDlyvsefwydFQ8vz4nSytlvYcAW3DduestGSg0lznjwiXRwHhFK5mmaiqhkq7pQgjMC4wSF8aVVqmjZ42jtlMgxkoBbTTUF2IFxTuk0mtjB2t4ms0lpDOiOFREQwCRV7OS0IyWwrPg2/CbfKchPM99XFaUt0eg== 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=3IQJB6fGjeRHcLKiBeawxOWB0dP+70sHsNVFEJyb2gg=; b=BaeesuOmfUO8TxjaUijd9wKZIfvYLIQa5dSlKKnkmoBuuAIiGZ6q9i2aUxU+SG2qf9Dax+e7XdoGKsEZtNwKvhNkzZXW8mHqzRJMAnkIR2Ncb/w/uxahZYOHukZ6A9oZ8AFYhfQs+nRq1U5fsqKDpfiNbV+/tbQuBQiXKLzBwJYNMPji1gWsPMV+i8DxzhOWFQi66yekuNVvxOJE26ZYVD6s49TOTkCmFjhgYvFyd9pNy1PITzcNs4LGLSLhu1ohR7M64wAufXZGNxJtr42zZrzXUkrvyy1H6dtgqoav4XmB87bZ7NmibSLiWYKilnOMRw6snxsnA/bL6PQ1cIpdQw== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:19 +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:49:19 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , Sunil V L , Daniel Schaefer Subject: [edk2-devel] [edk2-platforms] [PATCH v3 04/14] Silicon/RISC-V: Introduce FirmwareContext library Date: Tue, 19 Oct 2021 11:48:39 +0800 Message-ID: <20211019034849.16847-5-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:49:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 858e30df-2186-4705-ceea-08d992b36dde X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: UG7hnR2Wv/PDj5Ld9XLlXtgK3ThsrOmPwOKdkaAyfHD7lNBhff/ie62cm0BROZxQMNo+OJzXl8o/BqbvCFjtZdloXRS25XFJvxxynefyYLm4hU7xStBxdLhAcp+zoNtys5MghCzMLs8EU9Uet4APzKjlfDx+fgeRlzYGHhJm9egH5o7LEJPQTRTvJ5kEVoaJ+EHPLpoDVixYNM1bU1gDvkdF7vVqYldqFamzZB5Nm4DGYW0n0Dp/2eXQyy8QH8mEpHvXsZpOtSurEy0sNbAm4OVdcjH60JZL2C8Zn6rkbbn81j6yjPPm22wBFNiazwpVKv9N08iKWcK3QGirl4vgNjEtbDEukALpiH1RkvtGZnocnV/QpnBt8MbVWmVNrz53aSNXLgX3JSiiA6psuaqgAt08ybh4ANXkFeWzPE53JBRLuQ44qyB+nijsujSG00j4ieioSKIy0IfaYeLgzpe8aIDCjftfic1REPXKl/fqk0MGhowk8KLWSiOC07jtHMo3XphpFhhObBlq+nwFh5m2E0bp9UBV+BwctSA7iAq6mdgzwCDDmeknmG15CM2g8EMewqhMCKY0/Kt+B7X+cmEg0/YvNRZSANDRY4+m6Nvl7eWptEbFyyS+ebraXrrH27vRF2OodFd5oEBrjimb2R8/M/7mVu6ulJJJOo5zJIvxk230+3bZJKG/wdoy5uDMqKPS0kYvK1anfJd/0e/yeOYSMQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rXv3cdKSijmu2OCWZLVDQw0Tooe+a1WtUHqhP2e6OkfR5Y+3225wjDDKSWbM?= =?us-ascii?Q?5A7sXjd2SeNRtP+FXOVb/qo3nh6WRlb80Cm+MfHUyon+Ppjg2qUFQ2xIyrB4?= =?us-ascii?Q?wnr/9UAHKAt2xUUjPRFxd9QpllG6aHv6Ib16u4dqNZqBCcrmP2lDzT81k0pk?= =?us-ascii?Q?OpJQTImGBiA3dKoId3Jx8kPU8rHCrxCe8qjCQa+msgREAzJF+7/uCykm0+fw?= =?us-ascii?Q?5JpW2riFTHD4BvEK3oYY+xoIIV6CnbKdrEmL3N9MLJnAcjx59RlmZ+bZyHcf?= =?us-ascii?Q?2o09kbv+GEt+LUoMaoiLuMQ4htXdkIf1qNwpak5Hq+sQ6bEnf3VFh0QMR4T3?= =?us-ascii?Q?joFd9nDco+A3KwPgwQntWMNHmNLbLS9CAnSxAr5d3px91oEiIUVJckfhiiFh?= =?us-ascii?Q?dJFmvCWoTiTwozdB1XkFGSYsOaGDckUpX0hSbDK1p04zmv4C5wAsvRsPxMPh?= =?us-ascii?Q?8ZWOPnEfj8ZzNvkpnz6sENpFuAkZ9T8fI+VY27NHWCUGhvkZ8pcxZFJhumA9?= =?us-ascii?Q?pV07h7bZtOeU7Tit0Z9Hm6m48BXNkA1C4G/kRZG6C8EC4zObnCo7oeNp6Gb7?= =?us-ascii?Q?Os+0ZmJA/QcwRliDfSF/2J672sPwzOZxrxuePVAmOf/Oee4dry8NrUHVTUvD?= =?us-ascii?Q?PPiofIsa8tVdh5PVa+BUEN5J/Z6gHuZx5K2L9RdxxOiofAa/q9WymqSQ8nqz?= =?us-ascii?Q?lYl2EdU3nlpDmVaDRL27hSxHmMxGmdK/xFZBRSCUp1FvH5CBYrEfufWoQsGs?= =?us-ascii?Q?l7QijVMA1TmEPK990yJwAAbbxSLL5QLIvABoSLY3uYASt1v10V5OOcMbk0xa?= =?us-ascii?Q?Pci/r0Tn5feIVxrK7elKFVsYqMiWQ6lsEd6bRD+SIJJI+UaIY0cK1ohryUwD?= =?us-ascii?Q?yd3jErbTwe9XfCStCuM5FM+3wt8ocQNVMXn8X0XK817n/gjcdsM+dV/UaQ13?= =?us-ascii?Q?uXEfmAirfeYvjh1IY+V3D+K/YgXGIEjRoqmpMSoPSHQKeWnfVdjzftPFtPDe?= =?us-ascii?Q?UdNintRxESZt7zoQpo6HuoXJYQNYNSC7bwy0TaFZhdR3+abS3qQraUYgKe7L?= =?us-ascii?Q?uij3Cj7iWsmxAtT3oefJSlQA0aEj2MtTDTCWQlLQMOvXwrhxBLv0BK71Ne53?= =?us-ascii?Q?79ubfncMS2PaebN/xxqM8qnXAqB67lBwP/HW0pOR2eSUQ83dViBNumgbiyGn?= =?us-ascii?Q?XCT1R8yuG6Ej44gncyzR7QrajcV9eQxzGAZZ9g0kAa1hYUlaxQ6oZYEZ6PrA?= =?us-ascii?Q?m5T6LG7QHxylUHGxHdp2+7qf+E17M+VGJUWMoKBFXqxmlfd4/9wWiB6ikcTr?= =?us-ascii?Q?yuWMj6zCIAHnwuPlRl5GXhux?= X-MS-Exchange-CrossTenant-Network-Message-Id: 858e30df-2186-4705-ceea-08d992b36dde 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:49:19.2214 (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: ogkG6uEqU8jXj30GqWABs4PJZZFX5YtkYiQL5Ydey0hFAiqsbMOmBPPpYjbqISM0G4iA7BUBTMHP9/z2kkji2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: zMcOn6fXZdWmfa9u7yjwlJrONbM85Ecf X-Proofpoint-ORIG-GUID: zMcOn6fXZdWmfa9u7yjwlJrONbM85Ecf 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: X6bVODeUvx7UqYCQRJ6hDZDXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615375; bh=5kg/mzOMnN2k1203BykPzkTbrDMLaV0XWbW6sR2mRpo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Gn0htX7485xYAKNfUy2n/KAqoFGhMbpQvZliMaEr/NCjIXi6gwG78UH58gmEYOZeRyF zbqM8VOeXRu3wf1F0r7WHdtnhbRIu4SxDyI//ZwpBKYT2xa6y/e+UCuI9tYYE4gQ5TBoB ijDnXx6T2ngusZFRwu+D9zXpWqHXWHL7xdA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615377032100009 Content-Type: text/plain; charset="utf-8" From: Abner Chang Add RISC-V FirmwareContext library for different FirmwareContext implementations. This instance uses SBI firmware extension to get the pointer to FirmwareContext. Cc: Sunil V L Cc: Daniel Schaefer Reviewed-by: Abner Chang Reviewed-by: Daniel Schaefer Signed-off-by: Abner Chang --- Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec = | 1 + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc = | 4 +- Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib/RiscVFirmwa= reContextSbiLib.inf | 34 +++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscratchLib/RiscVF= irmwareContextSscratchLib.inf | 33 +++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecLib/RiscVFirm= wareContextStvecLib.inf | 34 +++++++++++++ Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscV.h = | 3 +- Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVCpuLib.h = | 14 +++++- Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVFirmwareContextLib.h = | 43 ++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib/RiscVFirmwa= reContextSbiLib.c | 52 ++++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscratchLib/RiscVF= irmwareContextSscratchLib.c | 48 ++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecLib/RiscVFirm= wareContextStvecLib.c | 48 ++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVCpuLib/Cpu.S = | 34 ++++++++++++- 12 files changed, 344 insertions(+), 4 deletions(-) diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec b/Silicon/RI= SC-V/ProcessorPkg/RiscVProcessorPkg.dec index 0b64b33f0fba..08279a97b1c5 100644 --- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec +++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec @@ -24,6 +24,7 @@ RiscVPlatformDxeIplLib|Include/Library/RiscVPlatformDxeIpl.h RiscVCpuLib|Include/Library/RiscVCpuLib.h RiscVEdk2SbiLib|Include/Library/RiscVEdk2SbiLib.h + RiscVFirmwareContextLib|Include/Library/RiscVFirmwareContextLib.h =20 [Guids] gUefiRiscVPkgTokenSpaceGuid =3D { 0x4261e9c8, 0x52c0, 0x4b34, { 0x85, 0= x3d, 0x48, 0x46, 0xea, 0xd3, 0xb7, 0x2c}} diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc b/Silicon/RI= SC-V/ProcessorPkg/RiscVProcessorPkg.dsc index 5c5cfcb525ca..1292ba1beab7 100644 --- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc +++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc @@ -65,13 +65,14 @@ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDev= icePathLibDevicePathProtocol.inf RiscVPlatformTimerLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVPlatformT= imerLibNull/RiscVPlatformTimerLib.inf - PeiServicesTablePointerLib|Silicon/RISC-V/ProcessorPkg/Library/PeiServic= esTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSbi.inf =20 [LibraryClasses.common.PEI_CORE] PeiServicesTablePointerLib|Silicon/RISC-V/ProcessorPkg/Library/PeiServic= esTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSbi.inf + RiscVFirmwareContextLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwar= eContextSbiLib/RiscVFirmwareContextSbiLib.inf =20 [LibraryClasses.common.PEIM] PeiServicesTablePointerLib|Silicon/RISC-V/ProcessorPkg/Library/PeiServic= esTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSbi.inf + RiscVFirmwareContextLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwar= eContextSbiLib/RiscVFirmwareContextSbiLib.inf HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf @@ -92,6 +93,7 @@ [Components] Silicon/RISC-V/ProcessorPkg/Library/RiscVTimerLib/BaseRiscVTimerLib.inf Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandle= rDxeLib.inf + Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib/RiscVFirm= wareContextSbiLib.inf Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi/Pe= iServicesTablePointerLibOpenSbi.inf Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf Silicon/RISC-V/ProcessorPkg/Library/RiscVPlatformTimerLibNull/RiscVPlatf= ormTimerLib.inf diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib= /RiscVFirmwareContextSbiLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/RiscV= FirmwareContextSbiLib/RiscVFirmwareContextSbiLib.inf new file mode 100644 index 000000000000..168b70545390 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib/RiscVF= irmwareContextSbiLib.inf @@ -0,0 +1,34 @@ +## @file +# Instance of OpebSBI Firmware Conext Library +# +# This iinstance uses RISC-V OpenSBI Firmware Extension SBI. +# +# 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 RiscVFirmwareContextSbiLib + FILE_GUID =3D 3709E048-6794-427A-B728-BFE3FFD6D461 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RiscVFirmwareContextLib|PEIM PEI_CORE + +# +# VALID_ARCHITECTURES =3D RISCV64 +# +[Sources] + RiscVFirmwareContextSbiLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + DebugLib + RiscVCpuLib + RiscVEdk2SbiLib + diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscrat= chLib/RiscVFirmwareContextSscratchLib.inf b/Silicon/RISC-V/ProcessorPkg/Lib= rary/RiscVFirmwareContextSscratchLib/RiscVFirmwareContextSscratchLib.inf new file mode 100644 index 000000000000..750c1cf51ffa --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscratchLib/R= iscVFirmwareContextSscratchLib.inf @@ -0,0 +1,33 @@ +## @file +# Instance of OpebSBI Firmware Conext Library +# +# This instance uses RISC-V Supervisor mode SCRATCH CSR +# +# 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 RiscVFirmwareContextSscratchLib + FILE_GUID =3D 3709E048-6794-427A-B728-BFE3FFD6D461 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RiscVFirmwareContextLib|PEIM PEI_CORE + +# +# VALID_ARCHITECTURES =3D RISCV64 +# +[Sources] + RiscVFirmwareContextSscratchLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + DebugLib + RiscVCpuLib + diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecL= ib/RiscVFirmwareContextStvecLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/R= iscVFirmwareContextStvecLib/RiscVFirmwareContextStvecLib.inf new file mode 100644 index 000000000000..fa894cda9164 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecLib/Risc= VFirmwareContextStvecLib.inf @@ -0,0 +1,34 @@ +## @file +# Instance of OpebSBI Firmware Conext Library +# +# This iinstance Supervisor mode STVEC CSR +# +# 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 RiscVFirmwareContextStvecLib + FILE_GUID =3D 42DCFFAC-1DBD-4264-80A3-85CC7167AC82 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RiscVFirmwareContextLib|PEIM PEI_CORE + +# +# VALID_ARCHITECTURES =3D RISCV64 +# +[Sources] + RiscVFirmwareContextStvecLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + DebugLib + RiscVCpuLib + + diff --git a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscV.h b= /Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscV.h index 2a992394edbb..f6726bda240b 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscV.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscV.h @@ -1,7 +1,7 @@ /** @file RISC-V package definitions. =20 - Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -96,6 +96,7 @@ #define SSTATUS_SIE_BIT_POSITION 1 #define SSTATUS_SPP_BIT_POSITION 8 #define RISCV_CSR_SUPERVISOR_SIE 0x104 +#define RISCV_CSR_SUPERVISOR_STVEC 0x105 #define RISCV_CSR_SUPERVISOR_SSCRATCH 0x140 #define RISCV_CSR_SUPERVISOR_SEPC 0x141 #define RISCV_CSR_SUPERVISOR_SCAUSE 0x142 diff --git a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVCpuLib.h b/Si= licon/RISC-V/ProcessorPkg/Include/Library/RiscVCpuLib.h index f37d4c20d068..f70723567e22 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVCpuLib.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVCpuLib.h @@ -1,7 +1,7 @@ /** @file RISC-V CPU library definitions. =20 - Copyright (c) 2016 - 2019, Hewlett Packard Enterprise Development LP. Al= l rights reserved.
+ Copyright (c) 2016 - 2021, Hewlett Packard Enterprise Development LP. Al= l rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -68,4 +68,16 @@ RiscVReadMachineImplementId (VOID); VOID RiscVSetSupervisorAddressTranslationRegister(UINT64); =20 +VOID +RiscVSetSupervisorScratch (UINT64); + +UINT64 +RiscVGetSupervisorScratch (VOID); + +VOID +RiscVSetSupervisorStvec (UINT64); + +UINT64 +RiscVGetSupervisorStvec (VOID); + #endif diff --git a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVFirmwareConte= xtLib.h b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVFirmwareContextL= ib.h new file mode 100644 index 000000000000..f35c4e0c5123 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVFirmwareContextLib.h @@ -0,0 +1,43 @@ +/** @file + Library to get/set Firmware Context. + + Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef RISCV_FIRMWARE_CONTEXT_LIB_H_ +#define RISCV_FIRMWARE_CONTEXT_LIB_H_ + +#include +#include + +/** + Get pointer to OpenSBI Firmware Context + + Get the pointer of firmware context. + + @param FirmwareContextPtr Pointer to retrieve pointer to the + Firmware Context. +**/ +VOID +EFIAPI +GetFirmwareContextPointer ( + IN OUT EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT **FirmwareContextPtr + ); + +/** + Set pointer to OpenSBI Firmware Context + + Set the pointer of firmware context. + + @param FirmwareContextPtr Pointer to Firmware Context. +**/ +VOID +EFIAPI +SetFirmwareContextPointer ( + IN EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContextPtr + ); + +#endif diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib= /RiscVFirmwareContextSbiLib.c b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFi= rmwareContextSbiLib/RiscVFirmwareContextSbiLib.c new file mode 100644 index 000000000000..6125618eaf4d --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSbiLib/RiscVF= irmwareContextSbiLib.c @@ -0,0 +1,52 @@ +/** @file + This iinstance uses RISC-V OpenSBI Firmware Extension SBI to + get the pointer of firmware context. + + Copyright (c) 2021 Hewlett Packard Enterprise Development LP. All rights= reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include + +/** + Get pointer to OpenSBI Firmware Context + + Get the pointer of firmware context through OpenSBI FW Extension SBI. + + @param FirmwareContextPtr Pointer to retrieve pointer to the + Firmware Context. +**/ +VOID +EFIAPI +GetFirmwareContextPointer ( + IN OUT EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT **FirmwareContextPtr + ) +{ + SbiGetFirmwareContext (FirmwareContextPtr); +} + +/** + Set the pointer to OpenSBI Firmware Context + + Set the pointer of firmware context through OpenSBI FW Extension SBI. + + @param FirmwareContextPtr Pointer to Firmware Context. +**/ +VOID +EFIAPI +SetFirmwareContextPointer ( + IN EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContextPtr + ) +{ + // + // We don't have to set firmware context pointer using + // OpenSBI FW Extension SBI. + // +} + diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscrat= chLib/RiscVFirmwareContextSscratchLib.c b/Silicon/RISC-V/ProcessorPkg/Libra= ry/RiscVFirmwareContextSscratchLib/RiscVFirmwareContextSscratchLib.c new file mode 100644 index 000000000000..2504e17132c4 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextSscratchLib/R= iscVFirmwareContextSscratchLib.c @@ -0,0 +1,48 @@ +/** @file + This instance uses Supervisor mode SCRATCH CSR to get/set the + pointer of firmware context. + + Copyright (c) 2021 Hewlett Packard Enterprise Development LP. All rights= reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +#include + +#include +#include + +/** + Get pointer to OpenSBI Firmware Context + + Get the pointer of firmware context through Supervisor mode SCRATCH CSR. + + @param FirmwareContextPtr Pointer to retrieve pointer to the + Firmware Context. +**/ +VOID +EFIAPI +GetFirmwareContextPointer ( + IN OUT EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT **FirmwareContextPtr + ) +{ + *FirmwareContextPtr =3D (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *)RiscVGetSu= pervisorScratch (); +} + +/** + Set the pointer to OpenSBI Firmware Context + + Set the pointer of firmware context through Supervisor mode SCRATCH CSR. + + @param FirmwareContextPtr Pointer to Firmware Context. +**/ +VOID +EFIAPI +SetFirmwareContextPointer ( + IN EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContextPtr + ) +{ + RiscVSetSupervisorScratch ((UINT64)FirmwareContextPtr); +} diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecL= ib/RiscVFirmwareContextStvecLib.c b/Silicon/RISC-V/ProcessorPkg/Library/Ris= cVFirmwareContextStvecLib/RiscVFirmwareContextStvecLib.c new file mode 100644 index 000000000000..7d1675355a50 --- /dev/null +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwareContextStvecLib/Risc= VFirmwareContextStvecLib.c @@ -0,0 +1,48 @@ +/** @file + This instance uses This iinstance Supervisor mode STVEC CSR to + get/set the pointer of firmware context. + + Copyright (c) 2021 Hewlett Packard Enterprise Development LP. All rights= reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +#include + +#include +#include + +/** + Get pointer to OpenSBI Firmware Context + + Get the pointer of firmware context through Supervisor mode STVEC CSR. + + @param FirmwareContextPtr Pointer to retrieve pointer to the + Firmware Context. +**/ +VOID +EFIAPI +GetFirmwareContextPointer ( + IN OUT EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT **FirmwareContextPtr + ) +{ + *FirmwareContextPtr =3D (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *)RiscVGetSu= pervisorStvec (); +} + +/** + Set pointer to OpenSBI Firmware Context + + Set the pointer of firmware context through Supervisor mode STVEC CSR + + @param FirmwareContextPtr Pointer to Firmware Context. +**/ +VOID +EFIAPI +SetFirmwareContextPointer ( + IN EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContextPtr + ) +{ + RiscVSetSupervisorStvec ((UINT64)FirmwareContextPtr); +} diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVCpuLib/Cpu.S b/Silico= n/RISC-V/ProcessorPkg/Library/RiscVCpuLib/Cpu.S index 06ba80cb5fcb..e242c9b866a1 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVCpuLib/Cpu.S +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVCpuLib/Cpu.S @@ -2,7 +2,7 @@ // // RISC-V CPU functions. // -// Copyright (c) 2016 - 2020, Hewlett Packard Enterprise Development LP. A= ll rights reserved.
+// Copyright (c) 2016 - 2021, Hewlett Packard Enterprise Development LP. A= ll rights reserved.
// // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -101,6 +101,38 @@ ASM_FUNC (RiscVReadMachineImplementId) csrr a0, RISCV_CSR_MACHINE_MIMPID ret =20 +// +// Set Supervisor mode scratch. +// @param a0 : Value set to Supervisor mode scratch +// +ASM_FUNC (RiscVSetSupervisorScratch) + csrrw a1, RISCV_CSR_SUPERVISOR_SSCRATCH, a0 + ret + +// +// Get Supervisor mode scratch. +// @retval a0 : Value in Supervisor mode scratch +// +ASM_FUNC (RiscVGetSupervisorScratch) + csrr a0, RISCV_CSR_SUPERVISOR_SSCRATCH + ret + +// +// Set Supervisor mode trap vector. +// @param a0 : Value set to Supervisor mode trap vector +// +ASM_FUNC (RiscVSetSupervisorStvec) + csrrw a1, RISCV_CSR_SUPERVISOR_STVEC, a0 + ret + +// +// Get Supervisor mode scratch. +// @retval a0 : Value in Supervisor mode trap vector +// +ASM_FUNC (RiscVGetSupervisorStvec) + csrr a0, RISCV_CSR_SUPERVISOR_STVEC + ret + // // Set Supervisor Address Translation and // Protection Register. --=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 (#82275): https://edk2.groups.io/g/devel/message/82275 Mute This Topic: https://groups.io/mt/86432320/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- From nobody Tue May 7 05:34:20 2024 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+82273+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+82273+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 1634615373183870.0267971000835; Mon, 18 Oct 2021 20:49:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id aUiKYY1788612x8EaCVrhRjN; Mon, 18 Oct 2021 20:49:32 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.5143.1634615365103618926 for ; Mon, 18 Oct 2021 20:49:32 -0700 X-Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J1qQsW011242; Tue, 19 Oct 2021 03:49:24 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bs9b3nmtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:24 +0000 X-Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 86B566C; Tue, 19 Oct 2021 03:49:23 +0000 (UTC) X-Received: from G9W8673.americas.hpqcorp.net (16.220.49.32) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:23 +0000 X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W8673.americas.hpqcorp.net (16.220.49.32) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:23 +0000 X-Received: from NAM10-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; Tue, 19 Oct 2021 03:49:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L/ful9/d41xDaWaOZT0NRZZXGNsdBiRyyI3GbUvaYiZyMnwuDip9/0wUEwz+5G7z4xeC36UA9dBGc4UTOtcc0VadXIGgenQ7+BPnSSCyxtX8aeL9aEg0tjilwh3LkjP4EuNBNa8Abk/fxgElrh3oAcmWzl+Jx1LLDXS6Lgqh08ZBLAtkapZRIcvGu9XlS1Ctzs1yrmBMiWWBo2mdHQjTBGrCyOBXfSHmNo6tgV3hlljPgv/RzhuXNIwRaqvsw2GXfw2cddv+/m+UslC+HfbHdBIkAihHcoOIgXLuvsP5NdjJ1qImiffTNQLnjPFD1d06BJWj4mkGXWCM6wrGI3iwIQ== 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=NKjXTSIReGIrC1hDrqOtxgGgsPhlG39vJrTqECKe6pE=; b=jn7sSrnbVIE0cuY+wcykumWDdPkDaTkAIwLPxMazNNivRDQedsCyHZK9X1/HHyGZ4zvOVNV8LOvn3wvHYsdLchFrk3JLlfQOhQePDAbvMDS9tJqreBY8f5cDRC4nz5eILbqga9hcttXaP5hyg2ulbnAQGFYPzKDaJHvOf5Fko5u8l5g6glGFoXCc0YKbA2TsxAF16oJyQMqNmBcKr7gFh0WHEzvKOv+SckLLao6fJEg6K9VPSjccjQ1CQJ00k218VzCkQfDkNL2FVGnlz2r1kYrJz4Nl7R2XZgh9Yklducx1HDSVvQSGKqfFSM8nbS+kvVYsMwjSp4zhYRvJZ0KCKg== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:21 +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:49:21 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , Sunil V L , Daniel Schaefer Subject: [edk2-devel] [edk2-platforms] [PATCH v3 05/14] Silicon/RISC-V: PeiServiceTableLib uses RiscVFirmwareContextLib Date: Tue, 19 Oct 2021 11:48:40 +0800 Message-ID: <20211019034849.16847-6-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:49:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f22ffff6-f7e6-46e5-b81e-08d992b36f5c X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: vZaj8oOZfC8GDP7xxZcQcJDq7rPz2Oe+RIoj04enKKXrWkiG6pm9ntP+SFyI4zN8WJ/5L6GpkKUoZEUkNQmoLMRbhzJ0ZFaBeUNoBCmAUPWqvPTdMaK+Li69mPKGxviPWv4JIhk2Ib3PgiRXbAlto4yS3hv9+VvNsBi12J2op/IRogp9C3UmWUdC3uTnXkTXMOWpgduXeLULQXx9YZ/z06xk0qbvOf+fEHEcX56kLpuHbdv7Rcki74mAatul/oS4LWHlGoXdSXoLGSqy3fptiXgKdRXo5u9JUf926A7mpVW7AU0nXN5ivJvXPksN/YstL9sau/3f8FV8m0CYhDedpRS8B9RnYm/iN+CKExrtYbdjP/lmop3WCkwIZDrZd5bcUxMpj2CRwRoPYCuxRSCTZOZrY9Pe4WkeGmxXEohzTtgUCbicAhG0bi3Qz7WDd1DIBO3JMZ6yz7E71ggYozrWgfWmtfjHuZol9naZ3QM93o5Q8Z28xR+OWop4vzBzoE1D+51QNawDI5T49XHHz4nsRFwGHHk2nbu37B8Vz9vWK+xNZOO64P5Md6xbJPnxKVeQyB+d6+iF/50K1pOPaw4RfY0toal0w4nHgigu2+pa9jsF/wiWP7HDztbVaJ6AdQy0i4XPwhGw8pj2v1F9szj2bE0eZ++ukWsVrVqFh9z6xIJyEzsDs7n3bIKwIJu000PJVDtWRLWzsXUGs5KMZG3GILKCxsryBbj/aB166TU3ieg= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OInmsTk+j92jML8MNZDSc1G+Kb7Cg22qseMHMBeBhGxgOTlfyhsI7S0ri6z8?= =?us-ascii?Q?AijSjsveZkjZZWfORJMgXiI366XT8poaggyKXjHnjIHkU/jvkGnG4gjLjvDT?= =?us-ascii?Q?ejgvaUx4mnvbonLg+fUbCpKIJknKebRqsVHNJ8KmeHVtimehxyLSrcHDR3aw?= =?us-ascii?Q?vaX4JoYHX3CP7mMkkvI5AXnQlFldRAzIh/JTjQPxXuX2DPtEO+LILOiiUz+m?= =?us-ascii?Q?95RGmRqqd1b2n8XMeWuFi/7ttZtHc06dGohvZwdexm6+WVWi6S/c1Ao+7Rfx?= =?us-ascii?Q?mWbetrUw4fg8XQjaY/YGb8DNNZf6TOpwGZDiy5eTjYNuIvJkJtsEx60usSgC?= =?us-ascii?Q?4FI5mXTwEHQtAABXuX4Xt+7vRRfnLA8tWoVycbDJq10tZVSK/9ux2llAY4b8?= =?us-ascii?Q?ngy47COUtAi/mvS9H6H5JEFMxoVnpc5dYMvMmZBPqORpvsV0VSm9/aTJMO+G?= =?us-ascii?Q?Fg3GlLWTxuS/M1XywsiajZiNlFYGI6B47llEkJIxv4NPhV0UVi5Gy4xfQx60?= =?us-ascii?Q?wZmL2/szhNjmRpIIKeqpaFxDTJSca60SruOwyuZemOZ+k3Oc6oPA0mh+ziTz?= =?us-ascii?Q?RQh+jF5Yyd68Qfmo8bM9FhM98GxAkiGUNT8edQ7NbfQ+ZVcDMd6iHptb+m7c?= =?us-ascii?Q?XzLAcyToEu0Ug86jUlZ84MguJcj63XBaCdlsU84hRvkpFp2zozM/IJp0y8Sh?= =?us-ascii?Q?dx/SmNGab11+pOuFDxE2qiXsD7eHB2bjING+Psqa6TQWok8Cbv5MaSwqc6/3?= =?us-ascii?Q?sI4NHCf7XVtdrI0+iWzKRvN48oNQ+k5q42w7vi9zVyVz6iE/1FpyVeFuuYLv?= =?us-ascii?Q?SOOrJF/aQUJkKOFPWRlsS8Ri0C2v8yOBKEgFJaQSoGlKw3+2HAkAqMeuooIr?= =?us-ascii?Q?CH1omtBb2K+KBj/iaJxh1v1iU3lDZ+QafOnVdqPInnh0lNTzLBnTmjpSje6M?= =?us-ascii?Q?zhKnU7CourXLiJYxNIEu967RMOW63XiIXMyO+ciTAf6lvORWXzsPX/BfFF01?= =?us-ascii?Q?i9I5Ggueev3WcP/RjRCHK66Gk7TQi1WnbTTQXIZMDiack7BPVDRSWCslzcXY?= =?us-ascii?Q?4+W/gSmfq9JlwJmaJXoTU9LXJGAV2MLQbr59m58cdEfCGqk4lvCYBqmesJip?= =?us-ascii?Q?JfclwJxQ09DuGhKOzyC2UY4jdLHrkeQLU7yPYynnYCB8XZzkXh9tkhA31OmM?= =?us-ascii?Q?LtLxlDVPz6Wx6tSD6SdfXRlsL4TcK/tI+Yepztjf2NRqxQCqerr/YI6avAly?= =?us-ascii?Q?jQIVXGkqv02EiPJFYsrkriJPEuFTIIqqTk7LbiANggx8UnPHRYnbHNZyyMQm?= =?us-ascii?Q?+ZIengA2SCY+uycoFjOCcJTM?= X-MS-Exchange-CrossTenant-Network-Message-Id: f22ffff6-f7e6-46e5-b81e-08d992b36f5c 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:49:21.6593 (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: rs2ViquJbOXsD3y6sNza0A8ygXuE2sci++0lCMSrZSn1reF8Wn8wmrJkAfxWS1cG4LlS8rampI/Y8sWY5TI5nA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: Qm07kpQjQbMkkd4DUzz05KxYp0dan8ln X-Proofpoint-ORIG-GUID: Qm07kpQjQbMkkd4DUzz05KxYp0dan8ln 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: i1Az8aAAqs4dvSJu1RTxmTN9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615372; bh=tqNM8PkMyWu5HP7fQTHxUz/OF7NvYsUbP1xbzciO+9I=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=v7Ld/AAPKtWzXzyB7rKLOKO6u17VOXs5Obm08Orpnq3gtKSFom7lvGviyZKoDkLT1vm d8yTyi3IJbTWlUA57utimZ9a5QVLbI6UISfyjiuEaP13PGCkh20UeUfspRZnYQS5xFmo1 vrQvDYAe/1DLkLBD7Py/q311aslKLZec84I= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615374804100001 Content-Type: text/plain; charset="utf-8" From: Abner Chang Use RISC-V FirmwareContext library to set and get the pointer of PeiService. Cc: Sunil V L Cc: Daniel Schaefer Reviewed-by: Daniel Schaefer Signed-off-by: Abner Chang --- Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi/PeiS= ervicesTablePointerLibOpenSbi.inf | 4 ++-- Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi/PeiS= ervicesTablePointerOpenSbi.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLib= OpenSbi/PeiServicesTablePointerLibOpenSbi.inf b/Silicon/RISC-V/ProcessorPkg= /Library/PeiServicesTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSb= i.inf index f23272016b72..fa9fe7851864 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi= /PeiServicesTablePointerLibOpenSbi.inf +++ b/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi= /PeiServicesTablePointerLibOpenSbi.inf @@ -4,7 +4,7 @@ # PEI Services Table Pointer Library implementation that retrieves a poin= ter to the # PEI Services Table from a RISC-V OpenSBI sbi_platform firmware context = structure. # -# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -35,5 +35,5 @@ [LibraryClasses] DebugLib RiscVCpuLib - RiscVEdk2SbiLib + RiscVFirmwareContextLib =20 diff --git a/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLib= OpenSbi/PeiServicesTablePointerOpenSbi.c b/Silicon/RISC-V/ProcessorPkg/Libr= ary/PeiServicesTablePointerLibOpenSbi/PeiServicesTablePointerOpenSbi.c index 0c1473e93288..9aa74b4f9fbf 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi= /PeiServicesTablePointerOpenSbi.c +++ b/Silicon/RISC-V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi= /PeiServicesTablePointerOpenSbi.c @@ -1,7 +1,7 @@ /** @file PEI Services Table Pointer Library. =20 - Copyright (c) 2019 - 2020, Hewlett Packard Enterprise Development LP. Al= l rights reserved.
+ Copyright (c) 2019 - 2021, Hewlett Packard Enterprise Development LP. Al= l rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,8 +32,8 @@ SetPeiServicesTablePointer ( ) { EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext; - SbiGetFirmwareContext (&FirmwareContext); =20 + GetFirmwareContextPointer (&FirmwareContext); FirmwareContext->PeiServiceTable =3D (VOID *)(UINTN)PeiServicesTablePoin= ter; =20 DEBUG ((DEBUG_INFO, "Set PEI Service 0x%x at OpenSBI Firmware Context at= 0x%x\n", @@ -61,8 +61,8 @@ GetPeiServicesTablePointer ( ) { EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext; - SbiGetFirmwareContext (&FirmwareContext); =20 + GetFirmwareContextPointer (&FirmwareContext); return (CONST EFI_PEI_SERVICES **)FirmwareContext->PeiServiceTable; } =20 --=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 (#82273): https://edk2.groups.io/g/devel/message/82273 Mute This Topic: https://groups.io/mt/86432317/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- From nobody Tue May 7 05:34:20 2024 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+82274+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+82274+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 1634615375546907.1618410484784; Mon, 18 Oct 2021 20:49:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1jWAYY1788612xBRTdHExu3z; Mon, 18 Oct 2021 20:49:35 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.4990.1634615366619546681 for ; Mon, 18 Oct 2021 20:49:34 -0700 X-Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ILhXnu030099; Tue, 19 Oct 2021 03:49:26 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 3bseymjj0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:49:26 +0000 X-Received: from G2W6310.americas.hpqcorp.net (g2w6310.austin.hp.com [16.197.64.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 665185A; Tue, 19 Oct 2021 03:49:25 +0000 (UTC) X-Received: from G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) by G2W6310.americas.hpqcorp.net (2002:10c5:4034::10c5:4034) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:49:25 +0000 X-Received: from NAM10-DM6-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:49:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IvhohDm6u1SPF6dwQd7p1quM5X08/soEqFIzA9MGe1cLCNkmcLyyGKUeMPNBTOCmi42YhS6VSIkllMvKD5QuFq9ooosgcItLtvFa6an8kiguhH2YYNIuwMdA7JRatJNniaKn5BIMkffcpgvgdDU5DWBXBHt+rRR+AFLSrwPIRER7Tojx3HyTaA1qpxESXapRgI+6CNIm7bLnB6ZgXhGHDHvosI3R8RVA6ADGoKeUCidPwzbz3znl9HcwM5f1y/z/6ESwkmf9fDc/OmV1gJJVRCJa/JU8totP+TRWYtSovwhNoLW8V0GyD17rHa2MyvtleZ64UBVhgb+o+ZFY3RnWCQ== 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=TzXcKqc9waPebUymxomcJmrUGVIRGFWYt0dYob0QnRw=; b=Eoc+DpW/AjZdPzp7pyUggzNPRecIBWw0hgKfUkjpMbi+u9TlVXpCJ+fWZW1Gt+D2rBx2uHKmuy7ThRa8r/wGf5rZVGsW/E0NxE5ILzDAVdt1ivTHI2Js9yUq/IriGp1dfLsVwzjgRzyCgqXJro0wNGgBvxJCWP0cYay3YjU4w6sc0jQHh0uSohhzpMd9+NpGqoLf8QZQW8CiMDYebNsHoBXzUcYT9C2K/EY+G06vke7VeJ4EsoQiRulde2ImnH2kF7vgDz9bY1NdSLkOjTofDj8JwOGGh9Ts1yX2ISRO2T5i/iYb5Zs0cASHHUngOWmZne0KRcgQPZr83yUCd60ZYA== 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 DF4PR8401MB1321.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 03:49:24 +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:49:24 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , Sunil V L , Daniel Schaefer Subject: [edk2-devel] [edk2-platforms] [PATCH v3 06/14] SiFive/U5SeriesPkg: Use FirmwareContext library Date: Tue, 19 Oct 2021 11:48:41 +0800 Message-ID: <20211019034849.16847-7-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:49:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 17feb622-d075-4188-950d-08d992b370c5 X-MS-TrafficTypeDiagnostic: DF4PR8401MB1321: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: BAhl5wKrWaxrUE4/fr1BVgMb4OaxoNi5Yuks6BD/BflQJ4E3oQ0LMIRHOunwynnJOJ0RnJMSguKmCdE2dlnl6hUwrBL2P5oB6BXMcz7gYf+VrARSsrhQlDDRWClV8bX9wAa+4S4OYQefzHL4t8OHYWy4GGa6yxTtkO2dcpYW+m7eWyEzhkr3BpshJEaOad/Xda5DqFwQfmtLaIs2JvFWXexK+KdO6Ik7MDpAtiBMe4Xrd7QBGMzHPT9i6GWLuHzADOaQdSC+/R36otpv/ZtYtCUMA9XjokRSppAxYOpkp/j53b3zo1e4F3ehapK/bqK2DR3WJ7Ivgr5B+hTnJmt7EiBwKOZ1AMySb7BbuXlEAibSMgb/ZwEA882lh4RBeehnueSBPAtyXIBHgk8xtt4orIxqC4If2PsfgBrE/LCV7TxKPXutlzigU9EC4/e0CM40vK8ax2Jooe8NlvS8fDLs3thKxe5IlmnOYKc31VwWapztbyVSI4WFPHNWXseIYKCjENHR/kR0heA2wqFnQllJO9yTGsFg0PnnFyxooYGzomoz6ahsMeMz9zBqcXTqM+1xaLQDf5ZfZT2CjuJ9SfeI7quxmmVew/oS3kwXXzcIULjYjqtc80bRohazohb4Ax5shQUtI//C1D5OVbFDnDV1kPdf3sdCXz+VN9YXuJAtN+4UX4JoEGD78l125UwdShQBhX+iimWbaA3m/wNrjx4JcQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1i7QusvSXeJj3kQMTgJfyq+1ViQ6GsOMGMfQ7utgUF0lgd27JNuBSc3VppBt?= =?us-ascii?Q?GtQdMq+RoZpdeZ81/oBRQLtiqDVH3ECUnC/LRRiICr60ctHkbdkd9zlQ1BGl?= =?us-ascii?Q?urQS1GONlCR+E+TsmA0eLoxdcvOKyhRPtIT6UJ4qDjXdevZVmXsHxSumuObW?= =?us-ascii?Q?QiUHY2Wb4r19bXQJiVG83/31xTEnVgHsWKpARUZB6V+FtPwOqQseLLWC08lU?= =?us-ascii?Q?jxurhbJXqYAROJVKfAqyRkLjgl8+3QTdYsWrBJztHD4JrCkY8Gr6fjU3pU6B?= =?us-ascii?Q?lxIcpoqnedawNu27H8QKJDPqqAleZMKZkYUc8Tnxk+PlDZA1vN4TUMO63DBC?= =?us-ascii?Q?S7tTlStO7Ua3WpPS0fP19yoMPuw/It13tzXMUZFjR8oa2dKT8O4L4PbAdc/n?= =?us-ascii?Q?lIo8ZF5/RTmfT1ykEDmCrFQ3IucmY8KIIJ8FqjKVQ3Arq9BlUPMVPT3ueyhr?= =?us-ascii?Q?2NXbesPfipl+g2+gMEI7T3HJUpIx8njb2gmgA4R/Zo1UQ9mKzmX10dO+pZoZ?= =?us-ascii?Q?EKr71qUNY08AuXCPrKGrEuSNyKk8nW+7Nj3tc/R6lOKryU/UYBqN1+5otpHX?= =?us-ascii?Q?KElI6zn31ZiH9QpKHa/AUum5eLRdGFKeIxOkrV1Rr0+AwB5i0+mRsv1fShGK?= =?us-ascii?Q?HXmJxrJ1o6rf+ZdH6hLW7Fv3c/P2abzBBeNL7r0tixvvZgL/c8h4fxSIHUn9?= =?us-ascii?Q?1PobEjoIhA3RY9nHf/8derEcrtudHGOipfOKdhmj3mckRdVjf190vgXws77d?= =?us-ascii?Q?ve98Z9eOWchm2AdGBrh6gJkFOudrHm/BD0tFlzBuP0U4ObfvXZRplWJyDG+Y?= =?us-ascii?Q?4Hw4uNDy/k2rn/XUpSgPhMBtl7bltl6F+yQ7UQthAXe6DgMDP2R60MwMAX3o?= =?us-ascii?Q?Fjh2SLn/Bg5gsPZi2/d3JTIXXwGc/50NCIttE5sKefSTWNCESokHvZAINTEL?= =?us-ascii?Q?wWvikr+qnUdWjeCQyd5KQz+d35sVy8jUDXs+0X1Gk3oU4XpvyJkqmDlghc1e?= =?us-ascii?Q?YNq2q5oh0dal00s9iUemQPZRaVcewRRBdvzldu70MDRx3qcN1i1KkpKceuo8?= =?us-ascii?Q?UgiwI1lTSXykaHTxo0tIp8khnCxwJStvBrM3D1Np4IXmJx9dFz9nL1RY36Xd?= =?us-ascii?Q?AcR5t34TrFot7HsUr7dc8UUy7E82zbLPvZEJ6o+PlA/O+695jciOUfNc77TL?= =?us-ascii?Q?qcOjpEop9S6+KzFgRnJtxpJtHa6bGucsL5rpPkPftvmKTVnxlArt5IpcfRzd?= =?us-ascii?Q?GYDR7UTCfO8qvvn2GFQrb8HrH8KmGvUeEPo785AnpvRJNLkkN1sCxDXmnmG3?= =?us-ascii?Q?kghEBTIH1uA4DRCHWaAEzJdJ?= X-MS-Exchange-CrossTenant-Network-Message-Id: 17feb622-d075-4188-950d-08d992b370c5 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:49:24.0243 (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: Q3P7oxsN3Dm3wjBO/6lM+V0Fv9ixR1gq/UfD+fsd+8+gVd0LqtKHuApVNSQS+cLTCAUzoZZWNKlJOKksLQErpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1321 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: 0AqwGXowUcC79KZwkWdvDngVpb3yhTSw X-Proofpoint-GUID: 0AqwGXowUcC79KZwkWdvDngVpb3yhTSw 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: G8YbqeZoDum4z8dzyWXScC18x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615375; bh=P2H/6SotZ4LSoBiXwP90C27gGTcw3/6XJpF7yIZOqsI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=g7zmuv5lvQNMqRpdCaiDVFn5+0bQuJEV97Ky6ZznStrf4XygcwYnoflURdMeTpeiVE8 XzXy22JU0b2EJTy3Z3ZdALGF2EcGVcO3QMzicBLqApHIYHUfUG6TE5a+4GzhWnCMhDV49 z12vN1plKCyW5TysiDRqbia4Uv3xiTd0g7c= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615376942100006 Content-Type: text/plain; charset="utf-8" From: Abner Chang Use RISC-V FirmwareContext library to set and get the pointer of PeiService on SiFive U5 series platforms. Cc: Sunil V L Cc: Daniel Schaefer Reviewed-by: Daniel Schaefer Signed-off-by: Abner Chang --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 18a99b86d849..2b00176c27a0 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -174,6 +174,7 @@ [LibraryClasses.common.PEI_CORE] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesTablePointerLib|Silicon/RISC-V/ProcessorPkg/Library/PeiServic= esTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSbi.inf + RiscVFirmwareContextLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwar= eContextSscratchLib/RiscVFirmwareContextSscratchLib.inf PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf @@ -190,6 +191,7 @@ [LibraryClasses.common.PEIM] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesTablePointerLib|Silicon/RISC-V/ProcessorPkg/Library/PeiServic= esTablePointerLibOpenSbi/PeiServicesTablePointerLibOpenSbi.inf + RiscVFirmwareContextLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVFirmwar= eContextSscratchLib/RiscVFirmwareContextSscratchLib.inf PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf --=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 (#82274): https://edk2.groups.io/g/devel/message/82274 Mute This Topic: https://groups.io/mt/86432318/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- From nobody Tue May 7 05:34:20 2024 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+82279+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+82279+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 163461545370240.19368076863873; Mon, 18 Oct 2021 20:50:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dxJmYY1788612x7wTj9b5X18; Mon, 18 Oct 2021 20:50:53 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.5151.1634615449305263230 for ; Mon, 18 Oct 2021 20:50:52 -0700 X-Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IMb3OU015210; Tue, 19 Oct 2021 03:50:49 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bs5guyn0e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:48 +0000 X-Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 4F1E272; Tue, 19 Oct 2021 03:50:47 +0000 (UTC) X-Received: from G4W9336.americas.hpqcorp.net (16.208.33.86) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:27 +0000 X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G4W9336.americas.hpqcorp.net (16.208.33.86) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:27 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.10) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZn1sOrZIMMxnqZIX8TQRJy3B7P+3Rp7CzCLaIn/47ozXNrjNXO68u4Oh0c8V2aBgB/wOfraopbjZOR93ItXhr4c8ZrVE+ugUxYq5L0AUPinHWd5oikP9PVsNxqGPwfgGPqqj61U3zEGugyVI8bX+aEgHu88tOoZxSGh99QArzeh9J0Umxu0IYKDtXDdt9l3DNx25TDCK0Oo4f4uWi/ZT4CYJxmxHQ7fJraoE8W5MN9Du6TEftlXvU3hbWyEdISAT96FYKknHjUlsWM+Mvm8ZW30YEeUkOjdN2wo6t1Pv/qJApkz7+7weL4Rfy1WWBbsO2x9xdKcHjPX35h6f72nSw== 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=KjJXBYNqtjnzllsnbdgMF5JoW+4mcMm8hPgBJrRiHZo=; b=ImE29KqrLqy68/bRnJqvR51KKqE81q+CHatYZJKz3pTiWbPLM24m7a43VcdAIaiG1Aqc8DZXvOkU4l6AVIbsYK92bdBaA71jnpeiwq5CA3BQttdQEfN4hhCtC7p0rDsxaFnbHKzjJF2VSt90fShX9+FXXCUb2a4iLn+NET67nR4MARc51D8M1MHYKdhgsqGdmOXyEPfeAaUVfyvcUANrc8hZ8V2FHCJthP1EilqRWLQZl98B5UsW7JYScbmnC22uZxVR1rEmkPRCBqvVyYcWc8yx9OlhfV4SmsyxZMFtDfDIFVfSuRy9Ebc5teNNf1+pRhroyv82+dGBnjStTCS/rQ== 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:25 +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:25 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 07/14] U540: Add and build device tree Date: Tue, 19 Oct 2021 11:48:42 +0800 Message-ID: <20211019034849.16847-8-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:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4204419a-d264-4f3e-de76-08d992b3952c X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:626; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: jvETeg67HJZs0alJv0Zv+6HMd5YUk3jl9zQxycowI/4AikS6/i3UEo4XQ+L+Z9+VTKpWxq9lmX29g4jLtotzP4hQII/R680ndpWJeU7fQzZy92JNa8Am9A6LnTmx2d/jTwljkoTF65aZzUXzApJeNYUuLXbmvV8gsP1UKXgEWwPVok39P/luxAfv2dF/a9ThnNgsnz4YoBWinIoZWZRM1Nahy3bjBP7zuIFES0LWtD8ZuI4jhrOFyCca6TnzmC6JORPyIJO1Vo+VxdnPhU6leq07mfUF4DITByfCuDHkS6Agxs6EceL+vGjdlHbzoKYk/2/2a5Z8s7a4tgq42WKy1FZczGsUqgZmR6NJyASrGclHC51lCAneeeJ6EosshKaa8bTBQaE3cN8yrfJoCva/s072rBtEnfWKb4m3ijRc9Xz9COtsL9ALEfrNzw5hKfBYQuGxNqv84pglpWRa09TCVy00fvhp/DkD1yqVRBI/1CrGkdjwKMHQrFb+HhZmqVKNWDGt/Qr61oO5ZVIKyEFzH3epxwrYMmSwX5Xv6bpjTMzCQykWO/cl1QHko+IvdRw4PnltSBuvVDlVu2VsfzCLm3YBwSPtmGj7Dbo8CvbrOGfp7sKEs3V4O6TTiW5EnzIGMsdUcCnvF1t5PI6diodsCgaNUf8fOYYgWcpHgQr2lfUbdZqVax9ST40JldAerznSoZrzKR9hmJlI7NATT45Vng== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tCDrCMMIqlKFDVEbMy4MJG0/UVqUqz+EqhGsGr9pb1UAzWzVo5uEF66RddYC?= =?us-ascii?Q?4uOdjFQdKOG3OGzCap9bVZEZB2G4heVVPaHYBJpIwkRsqIgBDJkU4ZC/VbCN?= =?us-ascii?Q?gzP/FPhBlCyHhIGcGn+nNp0mlW6SPasS2y/J7awt4m8psn67mzUbrdgzBL3/?= =?us-ascii?Q?xosFfyRCDziWhZiYbxk3rUeRpSKbkkbWsAMBW5ZAlIOetLmtq3Wq2i1OpFL3?= =?us-ascii?Q?NmU99Lgx5xzV9+fgKDUmAxDJqYrB+xtpuJbfT8FYg/RpYYbIwWqG8fuLUcLJ?= =?us-ascii?Q?Oion7fFdMzNBt5XaRF/XgyGDG0k22g+dRC0u1U5iRwSoQl4JMpxD+bacNEeD?= =?us-ascii?Q?UTYG9Z9zO1e6UtXdzuGpBs0/jHfgJ8xLuJjDBoG6cv6sfhZTEga/mxAzHqLA?= =?us-ascii?Q?MkNj2ZI56OydujkP2cxHqi+R/Ryeho+2DPuWYSKToeY5ynIHSwSDKaC7wXgV?= =?us-ascii?Q?lhmNXSnUG1URUVtp2kCtupiNFc6zxHHxipk3qCH+edIvPS7vnmTwxoNJPZfO?= =?us-ascii?Q?WOQ8IZaRgKvU7V6qYhXZ2Qe3M1hzn05NsHJCrVCsZC6J1+KcBl0g+XSoG/ow?= =?us-ascii?Q?/WYTZHPH8/LGDvD66Ylmbfcw6G5gCkYHEqGoY5paOSZ2jbFLu1dScp6izZqX?= =?us-ascii?Q?flUvnZaUmW8N6Z65JE/PSPYqAwX0lKjOEwQ+6l9oxX+X/GJ+0+UOS8UrSJsN?= =?us-ascii?Q?+jT5NItW/0fcNa0hjxwEviiaZux1Ne5nWnPWvE1jEuzqAlIDr+pOnuxRPDea?= =?us-ascii?Q?BWFchn4DmB26R0fSo05ZywiNsEwikvJTzJuHcjgjXoFwnPGk7/Z3g9gW85Wg?= =?us-ascii?Q?GV6m+5smna3kcdRf8jJ2eAQUhYeit4S4yuSVGNap1vBdDoELSLzGu7NvJBSo?= =?us-ascii?Q?hfUKaI2tRQy9VhJNIMUIoRnFWaRJTMSA3bJXxw2eQ2yOr/ke9GJOicZLyVQh?= =?us-ascii?Q?9q2gswU1wjXCfmdj9YRxZ7KQlRqB7NHQblhsEI1IcZQNBBdJ7WwxDRtx/4HR?= =?us-ascii?Q?+hear+SZIdyulWuLm4ustapvBhzS/ZMRVbLPk29fswQpuZzO4B9kZ75oxX6w?= =?us-ascii?Q?oSfmkhI9GIHM60JXoEIL1rxIHtIp11jgcR0smB/FBmwpIlP+mZ1c//5CZJhQ?= =?us-ascii?Q?m9fQqTp4zPaj8uBHB6zaCVA97pxC3K3tvLYkQIdw6JH/fkg4ZgrGjmHxC4kb?= =?us-ascii?Q?iEyGQ4tNLSG60TZZ0EG53aTF03Ju84CxEhVD6ZE/1wSj6IZqegX9XO+rN3Pd?= =?us-ascii?Q?/zsVWnz/pIbmGN1gYN05y3lauOuez1hCOKCqWBj7AKt9mjSlKb3Sy32nvTiX?= =?us-ascii?Q?ovdzoJYstEvMq/qA9CJYKqkh?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4204419a-d264-4f3e-de76-08d992b3952c 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:25.1871 (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: CuFkqHmFHmORJYGgEfe0tY4fvExvtoFrt7zqPX5j8WP2kRr3wclV3At3UwFHOK79VcJ9EnV2TSZVSNe202FMSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: QYvmDVxJJBy-JXkIHN-O5_C5sccSc9YO X-Proofpoint-GUID: QYvmDVxJJBy-JXkIHN-O5_C5sccSc9YO 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: Jkam205VO3kLUvUH0EVgxYLzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615453; bh=RV2WsxHfpiGrb+ZO+0r1vM8bAPUIT8HbP3PtgWGltCk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=bntD8NTf/QvSFFrb/Xom7eZ7zA8GLk9nJdg2JWbHNHhjMC9HRHsyO0EfvvTv3ks2Dhc mHTuOyHYCw+J5Ov++z2dmxei8YM2rSQ0julb6dwQMPX+6VnHuTa4CuDM02FJjqOQv8NJp zznl+E3KrOFYgKtF00VuKUvMuR+wJqIuDtY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615455583100010 Content-Type: text/plain; charset="utf-8" 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 + Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf = | 6 + Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/U54= 0DeviceTree.inf | 25 ++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/gpi= o.h | 42 +++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/sif= ive-fu540-prci.h | 18 ++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree.fdf= .inc | 35 +++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/fu5= 40-c000.dtsi | 287 ++++++++++++++++++++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/hif= ive-unleashed-a00.dts | 106 ++++++++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc = | 8 +- 9 files changed, 526 insertions(+), 3 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 2b00176c27a0..e971993b7b00 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -489,6 +489,8 @@ MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf MdeModulePkg/Universal/SerialDxe/SerialDxe.inf =20 + Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTree/U= 540DeviceTree.inf + # # SMBIOS Support # diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.f= df index 74717377287b..820e19d11334 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf @@ -33,6 +33,7 @@ gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvBase|gUe= fiRiscVPlatformPkgToken FV =3D FVMAIN_COMPACT =20 !include VarStore.fdf.inc +!include DeviceTree.fdf.inc =20 ##########################################################################= ###### =20 @@ -325,3 +326,8 @@ FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { RAW ACPI |.acpi RAW ASL |.aml } + +[Rule.Common.USER_DEFINED.DTB] + FILE FREEFORM =3D $(NAMED_GUID) { + RAW BIN |.dtb + } diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree/U540DeviceTree.inf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFive= UnleashedBoard/DeviceTree/U540DeviceTree.inf new file mode 100644 index 000000000000..ebf0881c68bd --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e/U540DeviceTree.inf @@ -0,0 +1,25 @@ +## @file +# +# Device tree description of the Hifive Unleashed platform +# +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D U540DeviceTree + FILE_GUID =3D 25462CDA-221F-47DF-AC1D-259CFAA4E326 # gDtPlatformDef= aultDtbFileGuid + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + +[Sources] + gpio.h + hifive-unleashed-a00.dts + fu540-c000.dtsi + sifive-fu540-prci.h + +[Packages] + MdePkg/MdePkg.dec diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree/gpio.h b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoa= rd/DeviceTree/gpio.h new file mode 100644 index 000000000000..c029467e828b --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e/gpio.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This header provides constants for most GPIO bindings. + * + * Most GPIO bindings include a flags cell as part of the GPIO specifier. + * In most cases, the format of the flags cell uses the standard values + * defined in this header. + */ + +#ifndef _DT_BINDINGS_GPIO_GPIO_H +#define _DT_BINDINGS_GPIO_GPIO_H + +/* Bit 0 express polarity */ +#define GPIO_ACTIVE_HIGH 0 +#define GPIO_ACTIVE_LOW 1 + +/* Bit 1 express single-endedness */ +#define GPIO_PUSH_PULL 0 +#define GPIO_SINGLE_ENDED 2 + +/* Bit 2 express Open drain or open source */ +#define GPIO_LINE_OPEN_SOURCE 0 +#define GPIO_LINE_OPEN_DRAIN 4 + +/* + * Open Drain/Collector is the combination of single-ended open drain inte= rface. + * Open Source/Emitter is the combination of single-ended open source inte= rface. + */ +#define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) +#define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE) + +/* Bit 3 express GPIO suspend/resume and reset persistence */ +#define GPIO_PERSISTENT 0 +#define GPIO_TRANSITORY 8 + +/* Bit 4 express pull up */ +#define GPIO_PULL_UP 16 + +/* Bit 5 express pull down */ +#define GPIO_PULL_DOWN 32 + +#endif diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree/sifive-fu540-prci.h b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiv= eUnleashedBoard/DeviceTree/sifive-fu540-prci.h new file mode 100644 index 000000000000..6a0b70a37d78 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e/sifive-fu540-prci.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018-2019 SiFive, Inc. + * Wesley Terpstra + * Paul Walmsley + */ + +#ifndef __DT_BINDINGS_CLOCK_SIFIVE_FU540_PRCI_H +#define __DT_BINDINGS_CLOCK_SIFIVE_FU540_PRCI_H + +/* Clock indexes for use by Device Tree data and the PRCI driver */ + +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_TLCLK 3 + +#endif diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBo= ard/DeviceTree.fdf.inc new file mode 100644 index 000000000000..fb28be2767e7 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e.fdf.inc @@ -0,0 +1,35 @@ +## @file +# FDF include file with Layout Regions that define an empty variable stor= e. +# +# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# Copyright (C) 2014, Red Hat, Inc. +# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +$(DTB_OFFSET)|$(DTB_SIZE) +gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDtbFvBase|gUefiRiscVPlatformPk= gTokenSpaceGuid.PcdRiscVDtbFvSize +FV =3D DTBFV + +[FV.DTBFV] +BlockSize =3D 0x1000 +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +INF RuleOverride =3D DTB Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnle= ashedBoard/DeviceTree/U540DeviceTree.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree/fu540-c000.dtsi b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnl= eashedBoard/DeviceTree/fu540-c000.dtsi new file mode 100644 index 000000000000..e44b6f7c562e --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e/fu540-c000.dtsi @@ -0,0 +1,287 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Copyright (c) 2018-2019 SiFive, Inc */ + +/dts-v1/; + +/*#include */ +#include "sifive-fu540-prci.h" + +/ { + #address-cells =3D <2>; + #size-cells =3D <2>; + compatible =3D "sifive,fu540-c000", "sifive,fu540"; + + aliases { + serial0 =3D &uart0; + serial1 =3D &uart1; + ethernet0 =3D ð0; + }; + + chosen { + }; + + cpus { + #address-cells =3D <1>; + #size-cells =3D <0>; + cpu0: cpu@0 { + compatible =3D "sifive,e51", "sifive,rocket0", "riscv"; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <128>; + i-cache-size =3D <16384>; + reg =3D <0>; + riscv,isa =3D "rv64imac"; + status =3D "disabled"; + cpu0_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu1: cpu@1 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <1>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + next-level-cache =3D <&l2cache>; + cpu1_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu2: cpu@2 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <2>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + next-level-cache =3D <&l2cache>; + cpu2_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu3: cpu@3 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <3>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + next-level-cache =3D <&l2cache>; + cpu3_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu4: cpu@4 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <4>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + next-level-cache =3D <&l2cache>; + cpu4_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + }; + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + compatible =3D "sifive,fu540-c000", "sifive,fu540", "simple-bus"; + ranges; + plic0: interrupt-controller@c000000 { + #interrupt-cells =3D <1>; + compatible =3D "sifive,plic-1.0.0"; + reg =3D <0x0 0xc000000 0x0 0x4000000>; + riscv,ndev =3D <53>; + interrupt-controller; + interrupts-extended =3D < + &cpu0_intc 0xffffffff + &cpu1_intc 0xffffffff &cpu1_intc 9 + &cpu2_intc 0xffffffff &cpu2_intc 9 + &cpu3_intc 0xffffffff &cpu3_intc 9 + &cpu4_intc 0xffffffff &cpu4_intc 9>; + }; + prci: clock-controller@10000000 { + compatible =3D "sifive,fu540-c000-prci"; + reg =3D <0x0 0x10000000 0x0 0x1000>; + clocks =3D <&hfclk>, <&rtcclk>; + #clock-cells =3D <1>; + }; + uart0: serial@10010000 { + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; + reg =3D <0x0 0x10010000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <4>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + status =3D "disabled"; + }; + dma: dma@3000000 { + compatible =3D "sifive,fu540-c000-pdma"; + reg =3D <0x0 0x3000000 0x0 0x8000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <23 24 25 26 27 28 29 30>; + #dma-cells =3D <1>; + }; + uart1: serial@10011000 { + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; + reg =3D <0x0 0x10011000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <5>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + status =3D "disabled"; + }; + i2c0: i2c@10030000 { + compatible =3D "sifive,fu540-c000-i2c", "sifive,i2c0"; + reg =3D <0x0 0x10030000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <50>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + reg-shift =3D <2>; + reg-io-width =3D <1>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi0: spi@10040000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10040000 0x0 0x1000 + 0x0 0x20000000 0x0 0x10000000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <51>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi1: spi@10041000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10041000 0x0 0x1000 + 0x0 0x30000000 0x0 0x10000000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <52>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi2: spi@10050000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10050000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <6>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + eth0: ethernet@10090000 { + compatible =3D "sifive,fu540-c000-gem"; + interrupt-parent =3D <&plic0>; + interrupts =3D <53>; + reg =3D <0x0 0x10090000 0x0 0x2000 + 0x0 0x100a0000 0x0 0x1000>; + local-mac-address =3D [00 00 00 00 00 00]; + clock-names =3D "pclk", "hclk"; + clocks =3D <&prci PRCI_CLK_GEMGXLPLL>, + <&prci PRCI_CLK_GEMGXLPLL>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + pwm0: pwm@10020000 { + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; + reg =3D <0x0 0x10020000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <42 43 44 45>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #pwm-cells =3D <3>; + status =3D "disabled"; + }; + pwm1: pwm@10021000 { + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; + reg =3D <0x0 0x10021000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <46 47 48 49>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #pwm-cells =3D <3>; + status =3D "disabled"; + }; + l2cache: cache-controller@2010000 { + compatible =3D "sifive,fu540-c000-ccache", "cache"; + cache-block-size =3D <64>; + cache-level =3D <2>; + cache-sets =3D <1024>; + cache-size =3D <2097152>; + cache-unified; + interrupt-parent =3D <&plic0>; + interrupts =3D <1 2 3>; + reg =3D <0x0 0x2010000 0x0 0x1000>; + }; + gpio: gpio@10060000 { + compatible =3D "sifive,fu540-c000-gpio", "sifive,gpio0"; + interrupt-parent =3D <&plic0>; + interrupts =3D <7>, <8>, <9>, <10>, <11>, <12>, <13>, + <14>, <15>, <16>, <17>, <18>, <19>, <20>, + <21>, <22>; + reg =3D <0x0 0x10060000 0x0 0x1000>; + gpio-controller; + #gpio-cells =3D <2>; + interrupt-controller; + #interrupt-cells =3D <2>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + status =3D "disabled"; + }; + }; +}; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/De= viceTree/hifive-unleashed-a00.dts b/Platform/SiFive/U5SeriesPkg/FreedomU540= HiFiveUnleashedBoard/DeviceTree/hifive-unleashed-a00.dts new file mode 100644 index 000000000000..df06f1c8c435 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/DeviceTre= e/hifive-unleashed-a00.dts @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Copyright (c) 2018-2019 SiFive, Inc */ + +#include "fu540-c000.dtsi" +/*#include */ +#include "gpio.h" + +/* Clock frequency (in Hz) of the PCB crystal for rtcclk */ +#define RTCCLK_FREQ 1000000 + +/ { + #address-cells =3D <2>; + #size-cells =3D <2>; + model =3D "SiFive HiFive Unleashed A00"; + compatible =3D "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; + + chosen { + stdout-path =3D "serial0"; + }; + + cpus { + timebase-frequency =3D ; + }; + + memory@80000000 { + device_type =3D "memory"; + reg =3D <0x0 0x80000000 0x2 0x00000000>; + }; + + soc { + }; + + hfclk: hfclk { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D <33333333>; + clock-output-names =3D "hfclk"; + }; + + rtcclk: rtcclk { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D ; + clock-output-names =3D "rtcclk"; + }; + gpio-restart { + compatible =3D "gpio-restart"; + gpios =3D <&gpio 10 GPIO_ACTIVE_LOW>; + }; +}; + +&uart0 { + status =3D "okay"; +}; + +&uart1 { + status =3D "okay"; +}; + +&i2c0 { + status =3D "okay"; +}; + +&qspi0 { + status =3D "okay"; + flash@0 { + compatible =3D "issi,is25wp256", "jedec,spi-nor"; + reg =3D <0>; + spi-max-frequency =3D <50000000>; + m25p,fast-read; + spi-tx-bus-width =3D <4>; + spi-rx-bus-width =3D <4>; + }; +}; + +&qspi2 { + status =3D "okay"; + mmc@0 { + compatible =3D "mmc-spi-slot"; + reg =3D <0>; + spi-max-frequency =3D <20000000>; + voltage-ranges =3D <3300 3300>; + disable-wp; + }; +}; + +ð0 { + status =3D "okay"; + phy-mode =3D "gmii"; + phy-handle =3D <&phy0>; + phy0: ethernet-phy@0 { + reg =3D <0>; + }; +}; + +&pwm0 { + status =3D "okay"; +}; + +&pwm1 { + status =3D "okay"; +}; + +&gpio { + status =3D "okay"; +}; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf.inc index f72947da61af..723632dc792d 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.= inc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.= inc @@ -10,8 +10,8 @@ DEFINE BLOCK_SIZE =3D 0x1000 =20 DEFINE FW_BASE_ADDRESS =3D 0x80000000 -DEFINE FW_SIZE =3D 0x00800000 -DEFINE FW_BLOCKS =3D 0x800 +DEFINE FW_SIZE =3D 0x00820000 +DEFINE FW_BLOCKS =3D 0x820 =20 # # 0x000000-0x7DFFFF code @@ -32,13 +32,15 @@ DEFINE FVMAIN_OFFSET =3D 0x00100000 # Must be power= of 2 for PMP setting DEFINE FVMAIN_SIZE =3D 0x0018C000 DEFINE VARS_OFFSET =3D 0x007E0000 DEFINE VARS_SIZE =3D 0x00020000 +DEFINE DTB_OFFSET =3D 0x00800000 +DEFINE DTB_SIZE =3D 0x00002000 =20 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdVariableFdBaseAddress =3D $(FW_= BASE_ADDRESS) + $(VARS_OFFSET) SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdVariableFdSize =3D $(VAR= S_SIZE) SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdVariableFdBlockSize =3D $(BLO= CK_SIZE) =20 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdFwStartAddress =3D $(CODE_BAS= E_ADDRESS) -SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdFwEndAddress =3D $(CODE_BAS= E_ADDRESS) + $(SECFV_SIZE) + $(PEIFV_SIZE) + $(SCRATCH_SIZE) +SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdFwEndAddress =3D $(CODE_BAS= E_ADDRESS) + $(SECFV_SIZE) + $(PEIFV_SIZE) + $(SCRATCH_SIZE) + $(DTB_SIZE) SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdOpenSbiStackSize =3D 8192 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdScratchRamBase =3D $(CODE_BAS= E_ADDRESS) + $(SCRATCH_OFFSET) SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdScratchRamSize =3D $(SCRATCH_= SIZE) --=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 (#82279): https://edk2.groups.io/g/devel/message/82279 Mute This Topic: https://groups.io/mt/86432331/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- From nobody Tue May 7 05:34:20 2024 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+82276+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+82276+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 1634615440112808.4133236780706; Mon, 18 Oct 2021 20:50:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JDE9YY1788612xMVzym74h5P; Mon, 18 Oct 2021 20:50:39 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web08.5101.1634615430759354911 for ; Mon, 18 Oct 2021 20:50:38 -0700 X-Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IMalUH016922; Tue, 19 Oct 2021 03:50:30 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bs9b3nn0s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:30 +0000 X-Received: from G9W8456.americas.hpqcorp.net (g9w8456.houston.hp.com [16.216.161.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 7CB4E60; Tue, 19 Oct 2021 03:50:29 +0000 (UTC) X-Received: from G4W9120.americas.hpqcorp.net (2002:10d2:150f::10d2:150f) by G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:29 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.10) by G4W9120.americas.hpqcorp.net (16.210.21.15) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C/LCHqR8uJunfc92j+rh3iNuaYZeaTcnc4Y6dTBIAKdXLFrxHRVHoO8pysK6INveGriuxNEf4Nf6d28Z+mL0ZtcfFNHMpqqdcvRi5C7Z4fd8BwFF/B8hcm6nUFoHMltnRVoda719NL5iu2yp+efCgtA6yH9VgJSHHEsmMPTlZCUvLK5pYnQfRUFIemi/oWDwato8asyWWx1fX3RafUhpoleJ19xifMD+bNlfP3zro9J0887tpNGLYoA6eZOpplfLyhLFrn4OnD+z50RZIjarsYHGEwQAkoXJd+CMI9DiV9zCfs3M8KzF8IDDMgxmF0sybQ15SnXYA11HI2XEQw7T4A== 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=mZm+/B/f2q7utnL28ANRxq99AlPK7r3fIDXr73uAlwU=; b=Te+cWskvzyN1fdA172mUuZbkxyEtTRUbsP1mccu34bAFgoZ9toziVBCtccwUTn3GorAKn7fCbfDbJvc+Kw5EDvIXRhFwDu7jeflcWb54FhxzDl1m/LieCjfdCBOPXmefX3HDKPRL9jtWDzHHm8U5N+nl40qK2jhVUHDMaKN8aMsrAfuTY/ZZaBg3HYs9ivL8zndHD2MH0PyobKKfgx6ds6V4y34mT4ifGF9/3acaE7AV4tDR7aQgISvcmrypbhuoN4H4VsjLVcmBGyziZT1QlQLrl29plqoM9iTDr1rXeJru/5xOB7UFZFha6hApYgbL295EelXOttgTog6zQ5FXPA== 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:28 +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:28 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 08/14] RISC-V/PlatformPkg: Build DeviceTree and use that in SEC Date: Tue, 19 Oct 2021 11:48:43 +0800 Message-ID: <20211019034849.16847-9-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:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23f77ec7-2caa-44dc-d2b8-08d992b396da X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: OfNojmlf1fARB/9dbyWo57wPwTf/Xm6IzNxvNXU2S4hww5U8eAF/Y+pqNrHywx4pbk8dGOKsQsR7a/aIJpx+o2tc9n127VOQigJgMGD7a1jmN0j8QN8gC9wasmXFx6rv6BU8CaJdQeGqCVJQ1df41hqpQQsQIwMwge0+phwIAs8zk3atahL+Gm+LfnwnHGsTHug+yKXVYCJJrhTxS3T5E1IYq3qPyOdm5kdkh+4W+VlqTVXk9P4egrV4m+YfB8mgzn7DLLYRESywkIIIf6Tlp9mMPNKQRwGpvH2Vei1awPEEiWPK5mkU7n61YSqsXEmvGRkMv7geQnWhBeZ2ChRD1c5BlPGNHPoFZKXJHHzFyUpeJCpH3fEctMvZjgzuYolziKWoTSmdYCl82Z+61n28Y2rlv+mKOyRwV/blymro8GxEtuLSEDENyjCeKw3IOY6uhQGkOPtBnF5L6LeIq0yRMi1P9pMPC3e5vkqahSjenH1OThOl3UEtoKhEXImWxzqu3VmEP4AX+d9sEH3NAugArnYHelUWTJQ3XNAlgSlbGXarzZyZj5+zNanW9b35PdouYXjECYoSvo/8/RbP/7/QfMZewXOxmwJjEZ1LmmottPneNxmz4RCtGeEf8M0vE+kyLZRB1tfMsUPaNXcRLhDKO5EunkUKAxljTtYDquhc15cZpoYh3HSKE/ad/P7GAsb+OL7D6ynn0QcTGyirsxlGBw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zq5zfoNZPwpUUqMJllUSvOBTKkblDHz+aEKFeJTMcAWgNgG4W1xpp0hqb0I+?= =?us-ascii?Q?p/Q+SIQl8TLJpIoVErhzldrLLfGXYBlZZKhmh4XFoBqezOwyyICsjvG6XI41?= =?us-ascii?Q?LCCReSOXAFSVx1G1Oax0x2YiBvvTlBI9n0xZq9HPLIbC4ITT7my+Q11++Y+h?= =?us-ascii?Q?8rd7YFg58BTveMTNh2gk0N+kr1M9aQY4nnwaS7kXhEioC0aUmq6jGRRFBbyv?= =?us-ascii?Q?iWqhLEC0aYTOYzjwXoLuXWSgsrugyDyTULixHDv+kU74pj8EL25FGhO+PakC?= =?us-ascii?Q?2T2CsKrJRdbOU8RqRNLyezbphIKmPd0ALd4Hc5UqtxHI+FMcF5vvpb7WHfXX?= =?us-ascii?Q?XYA73TfC3K5l8fQCv8WjXcLIc2927LNkfs8IIn8MfbrWRoZBm+QTNGTE7WsF?= =?us-ascii?Q?be3sGsOduWfhmSm+HudKmpaQfxF3KQ1IJxy+9RCjutMImytzAizc3jhydXEE?= =?us-ascii?Q?I0Tqokgd6bYSgxLPvK/P+wbr1s0h94PKZ7Km+1cqOMrpb7RH2pLHb5PX44Ts?= =?us-ascii?Q?sEIRfHBw0dKUz6jQ2RtbGeLu1HmwpNJ3X1ioxl6lEvA3ae8FN11oHaA54BqL?= =?us-ascii?Q?agyBh4z23j65gBeZ5j31iywFOBH2FXG/KTFHzOj6LSAvbLZ4BfC4CqDUs/v5?= =?us-ascii?Q?653KH2xQ5Psrj8UKBNx8CcSFLeXtWsz0ZXD41G+6XqxFQBLGRmQ4np6HhpbJ?= =?us-ascii?Q?RiMZhZtiVJvekU7veGJxjUEphVhBJYUIE6gd2rz4REzhx4OBkTY7KEoce30F?= =?us-ascii?Q?Y5aU2wwbnPWuzEZELaH8yvwzmwXRZvsiZ31k4v3pBCmYrr4m86UjAWq6iyaR?= =?us-ascii?Q?RSUNT7MYqbG6stt3tDaOc4qw/opp8zFGZBkd8oZH7TxVzKeldsatLtIyM06w?= =?us-ascii?Q?SbDD54rt1GaJ8IwGg+jPUFKCKpS3vaqHZT2pNG6EnuuFdElX8kCozVPCAqQU?= =?us-ascii?Q?+7a/Vp892ekYMf3djDMlKcjLKS3BTfrRajC99zR0r3X3Sq5Mx6i5m8+o9ULl?= =?us-ascii?Q?Hvr9KtZ1oIKRTGwPk3coB14gSYhoe6fZQqtEUnyVziGL2KhMZFFyQKkujP6P?= =?us-ascii?Q?s+3ynOrnS8hyk/vQmxUvq+horFnIhmYE1afU1xg6ZrbtDvberFyHPmXQdjiG?= =?us-ascii?Q?gG5q5zC869R2v0zeOM5BmdvmTFAie1g0ckojomQ9p08AiTwcUapIMrFTqyJH?= =?us-ascii?Q?mx3HI8SedvMW6CxtFZEgUnGW92wqwb1TkaMoNfRUQINCB1DSSWiZa2cjxwBB?= =?us-ascii?Q?MKvv7b7DreBJFKybXidIcYjdqhy2DD/80CumHsPtWlagmuwMs9+dhh+bdHhr?= =?us-ascii?Q?pj7KFIX4YZPyET7BnxIoXXfa?= X-MS-Exchange-CrossTenant-Network-Message-Id: 23f77ec7-2caa-44dc-d2b8-08d992b396da 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:27.9239 (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: oTUvRtUit2G5WYbUm+FT0tekFbtzNnXZPeGfzKeAXavxbTTID7fZMlrpYXqfxGqFYqfumzJZp2//gLDDPJkP3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: RmLcbrlt1ULwx6ocvBNWMzq5lTz4R9RL X-Proofpoint-ORIG-GUID: RmLcbrlt1ULwx6ocvBNWMzq5lTz4R9RL 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: LkZnmraueek4tzDb1AlATp5rx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615439; bh=EAJiSAJlcB2RxrmyewohNCyjqHc3vLADJqEEj4pb7Oo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=TOZOj8A6jkgaAxfG1KcBkYboL4XAe39M1nIW4ExH6y8J+gxiPV3/0vfnI+zA5D0xkPY 1bwOPFKOHBbuIbhNPtCX3hCNqRiqEEU8sEtMrpYq8XqHOOnBNk7oz/HieXzI9DoSf+5iv ibr2ElQvhZox1UwzxQqXO3e1BejsFH1o+XE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615440915100002 Content-Type: text/plain; charset="utf-8" OpenSBI uses the device tree for platform specific initialization, so we need to have it already in SEC. Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec | 4 ++ Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf | 2 + Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h | 1 + Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c | 49 += +++++++++++++++++++ Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S | 22 -= -------- 5 files changed, 56 insertions(+), 22 deletions(-) diff --git a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec b/Platform/RI= SC-V/PlatformPkg/RiscVPlatformPkg.dec index 48aeb97431d7..ad15a155fe31 100644 --- a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec +++ b/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec @@ -31,6 +31,8 @@ gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVPeiFvSize|0x0|UINT32|0x00001= 003 gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvBase|0x0|UINT32|0x00001= 004 gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDxeFvSize|0x0|UINT32|0x00001= 005 + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDtbFvBase|0x0|UINT32|0x00001= 016 + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDtbFvSize|0x0|UINT32|0x00001= 017 =20 # # Definition of EFI Variable region @@ -66,6 +68,8 @@ gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize|0|UINT32|0x00001= 104 gUefiRiscVPlatformPkgTokenSpaceGuid.PcdPeiCorePrivilegeMode|0|UINT32|0x0= 0001105 =20 + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdDeviceTreeAddress|0|UINT32|0x0000= 1106 + [PcdsPatchableInModule] =20 [PcdsFeatureFlag] diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf b/Platfo= rm/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf index 89bcb039a6ab..78bd75e3ac11 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf @@ -57,6 +57,8 @@ [FixedPcd] gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVPeiFvBase gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVPeiFvSize + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdRiscVDtbFvBase + gUefiRiscVPlatformPkgTokenSpaceGuid.PcdDeviceTreeAddress =20 [Pcd] gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId diff --git a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpen= sbi.h b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h index 2dab696af84d..e7ac6d26ee85 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h @@ -47,6 +47,7 @@ typedef struct { =20 typedef struct { VOID *PeiServiceTable; // PEI Service table + UINT64 FlattenedDeviceTree; // Pointer to Flattened Device t= ree EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartSpecific[RISC_V_MAX_HART_= SUPPORTED]; } EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT; =20 diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform= /RISC-V/PlatformPkg/Universal/Sec/SecMain.c index fa9ecd789a57..0af0b4bac831 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c @@ -557,6 +557,12 @@ VOID EFIAPI PeiCore ( &FirmwareContext )); ThisSbiPlatform->firmware_context =3D (unsigned long)&FirmwareContext; + + // + // Save Flattened Device tree in firmware context + // + FirmwareContext.FlattenedDeviceTree =3D FuncArg1; + // // Set firmware context Hart-specific pointer // @@ -647,6 +653,42 @@ RiscVOpenSbiHartSwitchMode ( sbi_hart_switch_mode(FuncArg0, FuncArg1, NextAddr, NextMode, NextVirt); } =20 +/** + Get device tree address + + @retval The address of Device Tree binary. +**/ +VOID * +EFIAPI +GetDeviceTreeAddress ( + VOID + ) +{ + EFI_STATUS Status; + EFI_COMMON_SECTION_HEADER *FoundSection; + + if (FixedPcdGet32 (PcdDeviceTreeAddress)) { + return (VOID *)*((unsigned long *)FixedPcdGet32 (PcdDeviceTreeAddres= s)); + } else if (FixedPcdGet32 (PcdRiscVDtbFvBase)) { + Status =3D FindFfsFileAndSection ( + (EFI_FIRMWARE_VOLUME_HEADER *)FixedPcdGet32 (PcdRiscVDtbF= vBase), + EFI_FV_FILETYPE_FREEFORM, + EFI_SECTION_RAW, + &FoundSection + ); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "Platform Device Tree is not found from FV.\n= ")); + return NULL; + } + FoundSection ++; + return (VOID *)FoundSection; + } else { + DEBUG ((DEBUG_ERROR, "Must use DTB either from memory or compiled in= FW. PCDs configured incorrectly.\n")); + ASSERT (FALSE); + } + return NULL; +} + /** This function initilizes hart specific information and SBI. For the boot hart, it boots system through PEI core and initial SBI in t= he DXE IPL. @@ -686,6 +728,13 @@ VOID EFIAPI SecCoreStartUpWithStack( UINT64 NonBootHartMessageLockValue; EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartFirmwareContext; =20 + Scratch->next_arg1 =3D (unsigned long)GetDeviceTreeAddress (); + if (Scratch->next_arg1 =3D=3D (unsigned long)NULL) { + DEBUG ((DEBUG_ERROR, "Platform Device Tree is not found\n")); + ASSERT (FALSE); + } + DEBUG ((DEBUG_INFO, "DTB address: 0x%08x\n", Scratch->next_arg1)); + // // Setup EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC for each hart. // diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S b= /Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S index 8434d1a4e0e9..0e3940180d44 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S @@ -75,11 +75,6 @@ _scratch_init: sd a4, SBI_SCRATCH_FW_START_OFFSET(tp) sd a5, SBI_SCRATCH_FW_SIZE_OFFSET(tp) =20 - /* - * Note: fw_next_arg1() uses a0, a1, and ra - */ - call fw_next_arg1 - sd a0, SBI_SCRATCH_NEXT_ARG1_OFFSET(tp) /* Save agr1 in scratch buffe= r*/ /* Note: fw_next_addr()uses a0, a1, and ra */ @@ -500,23 +495,6 @@ _reset_regs: csrw CSR_MSCRATCH, 0 ret =20 - .align 3 - .section .entry, "ax", %progbits - .global fw_prev_arg1 -fw_prev_arg1: - - /* We return previous arg1 in 'a0' */ - add a0, zero, zero - ret - - .align 3 - .section .entry, "ax", %progbits - .global fw_next_arg1 -fw_next_arg1: - /* We return next arg1 in 'a0' */ - li a0, FixedPcdGet32(PcdRiscVPeiFvBase) - ret - .align 3 .section .entry, "ax", %progbits .global fw_next_addr --=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 (#82276): https://edk2.groups.io/g/devel/message/82276 Mute This Topic: https://groups.io/mt/86432326/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- From nobody Tue May 7 05:34:20 2024 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+82283+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+82283+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 1634615525029980.6322744750966; Mon, 18 Oct 2021 20:52:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rNJXYY1788612xNZ8gjtXAgo; Mon, 18 Oct 2021 20:52:04 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web12.5103.1634615516003887025 for ; Mon, 18 Oct 2021 20:52:04 -0700 X-Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ILhSaR023790; Tue, 19 Oct 2021 03:51:55 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bsc4suy4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:51:55 +0000 X-Received: from G4W9120.americas.hpqcorp.net (g4w9120.houston.hp.com [16.210.21.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id D390C62; Tue, 19 Oct 2021 03:51:54 +0000 (UTC) X-Received: from G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) by G4W9120.americas.hpqcorp.net (2002:10d2:150f::10d2:150f) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:38 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.13) by G9W8456.americas.hpqcorp.net (16.216.161.95) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ENbdspki1PZy+E7ADlhEiKKgTAcUpoU/53jqe6/PhfLTLfgUka5Ez39VhSLLiJDdpL3z3J5w7zuBn813wVi3IwFFMaydtY5ntcR85GY5uDHkKSrJtRXMC+PggapYh/YxDRcg8Uy2KgvzD9XD3MrY+OE7UotnxlyGXsshGSYkP9itdK1aa/jLom3f6eyKKZTdzv7yiwgO06m6nV0sx4BJzIXE3f6yxlvpZTOPJ90iJo7x70ZyiaoHs13vgWD7dGvVQHuUaCWYRa9qgwS0+ylpbnRufkvFzMPzpmuX++r9x7eylJ15mjmu3o5NTkxfrrXku7UZiVMSgcw9jXRFRCqAiA== 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=bQO3Bag+nCKUiIhdVhpPNvYBHbB6reUTy1itCokxe/s=; b=IAZFtyo7h+g3cAh+tWTxKqC8N17H1SGDIoDklfj/ZPIbTc8GCODw6nblfE1N6qb055gFkQsJG6X51LBF/ULH61RP09+kGJIMFm4ZGA9v+WWlPRRpHO8dVAeMgHYsdFAKovUm2eo267Q8htzF/KKF/v4DK2jPEHNioBp0PB70Xf1bXX9T8nBAFbgUoXw69RUQnk8olbyadGzlpCAN0fKp9vgg6fUWlHidqEVTlC18rssZisYid5mbuoPlIZauRi1sbRGO7ye+jpLPMKwQxCHLC3a5s+ppbvdksUmEc7X+CNNs78LIuwZw5UY0MBrdYNzE01S9DLfwoVijwS8pnDsW2A== 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:37 +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:37 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 09/14] RISC-V/PlatformPkg: Add FdtPeim to pass DTB from PEI to DXE via HOB Date: Tue, 19 Oct 2021 11:48:44 +0800 Message-ID: <20211019034849.16847-10-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:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37d2f2a3-ba7d-4a63-f490-08d992b39c64 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:983; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: MTrAmTIqlGLQChewQtSgq5nnqluZtkQlSHICoj0HMDujs1pQIsrQSAvxdltEzgKrk6+ECS2Knvfp2aXOVW+Kb/TVZphG5JFxc5U8WNbCrDdTRcD56LXjFWGlo6KjAJkfrmsHavocdl5WLZhawawh0STYLW8jtdi7DlGuC5im86trxzN5mMrogugv3qdStdIrKYsqBJnmXltAPlhNP4OWTYfQcW+Oe2Snfb46hbxMZC9ubj0hSU6NmUBIZVGG8Dph7DC/o3zRQTyVM+CQC8vFJmwF/NkSfMuLsIq84CUAb///+zCiA653luxBbzWrb0eB5j1dewiF+mp8wFzlaRUu0o2VaKcoDohi8KVQ4DWj8sCpvJRkzPyN10JmRnyBlqZjEMDeB/JD2a6DQDjkrIqxLx1krW+X991yEmLPre8Hss2UEpK1EDO7VCivT2kzoZ2U1E8hmTubchGpFHfk4F8Pn5LBxlId1fCjX2QDMhV0nj1Q29+3J1tC0WOuOF0TgCXDi+FDyUTtAypRuJ2sojaBRY/XbHy6e4EE7WYKPSvy2kjE3e7GWUfWlFwYQFKVvXTeBOEOmwQXcfFYgWnIjy4tX8EO1njAPlCPlMamrSX+m10RS4gQvrfJTQ5PhVz1h7dNfsK809eGtztqyVrPkiuI22g5X6KlDXs6jEzrHdSwAAVU3O5NezC/qMGtlehXy3ZWAg46+IuUciaaFxIhHRJJEA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?C1iB7D5d6xPDOrifandpKx1rA9BwvW5NhwhAiGfTnfDcUvWaLDXtwf5zOaQy?= =?us-ascii?Q?KlEuCJVBfg9OynohBOznKmnVUwbwuM+32WxaoRhYGdBKF8PNqymIdIdmMY3c?= =?us-ascii?Q?Hj4Uj6UGEV0ipu+OWMspGUzXsFLwXjkNFq9ZOikZbmSRfEbnao0iJrqNkZpA?= =?us-ascii?Q?71kSyQpOSK1v/tAJsJsBTgGVS6OmujzLDT8T7uSTyawbYiSzDMlJal4GkXTY?= =?us-ascii?Q?N64c4ETJZdtyNgVd6W63miFL8rFs57ELJoqaWB+QMYnq9aREnOfl7lrMEBTg?= =?us-ascii?Q?AAjdvMHSTmETBV/EVxga92eEooKULmfzgoGUB6NtfIvpTu/m9IPQm4AJHCjo?= =?us-ascii?Q?ypoPKS8fyVo4S5Xn6bSDGUda4ma88A/78TNommACOHqGNrRaFcU8uDtKRwcN?= =?us-ascii?Q?MU3L579BcwavPNpwB25gsp16lVyMJkpGnrT6fMLfZuPcXm4c7PVrLewILoLP?= =?us-ascii?Q?wu/QaXUNk7HYWkDXKMtMRR3G0UxKFAhEGlcQb26GPJiSRiDsZ7hXQFZp30u5?= =?us-ascii?Q?IaD06c17TPAn8fVqVx69cwgQBmMLZQ60JrcVH+9UxMZiiGkC62zicHHLL7P7?= =?us-ascii?Q?No5rww/cufiaDk7fEGQkb2+woPnw/sj0GrwnSq8bztDfG61pWc1WMc8Nwjh7?= =?us-ascii?Q?J+MD4hzpimB98AXk8grta3DMVWv9xyP8/3dgRp3ktcReUybc4RpoQUGXzeiQ?= =?us-ascii?Q?OJy/TZqyWpvSbmRhwxVlQdWFu3d8ry8BeQ+5NMk0hK2zrRW5eNDomcLYLz3u?= =?us-ascii?Q?SBEyAlrmnwB0I2RYkNntIA8k6jrPrw6LNRj/t+bUsXjr2tv4Nco6uwxmF78R?= =?us-ascii?Q?d65rdGNrebebHGkhbijbsPJE/OLtwFhKtlDxUfA4gR0YzJxDm/2dMMxRlujp?= =?us-ascii?Q?F+SLYmvZWHiOyThYdqLkG9Wf3AAyv92IeAr6R6KxA4pHQJWEw2GsxsvXw9RC?= =?us-ascii?Q?L+T2Kq3htLmu6EJ5LmYROACWEkHlTLgx1Kc1rPZSAxmCt1w36Wx/T32rvLtF?= =?us-ascii?Q?Kf3R/MQP9AqNJM0aeZF0Hw0DM2Ywg98xXkaUYUlDzl6fmGoX8x9nuMtionWp?= =?us-ascii?Q?M+hD+40DGtMDCTb5AkcJlM6k+W5OZ7nXU+omEcTOsbqO0NxvBdWtftTf8VTE?= =?us-ascii?Q?XplZywqD7C70pI9hTpshTDUsPlGl6AIk2LOXBFsczXMnn3PJxZ5ucG4reGbi?= =?us-ascii?Q?/9bLKbGU+i+tC+V6tOfYUkyG6qw8Yty1i441F5TlVH0hBY8QP1wM7QvA46bf?= =?us-ascii?Q?mpF5Ab9CTvjwk53ClFejbVNILaZBnAZeoulfHFWDLplH/6s+l6VgB9/2ZGJO?= =?us-ascii?Q?Nzw/M9C6vQ5To9rXU0RlZraE?= X-MS-Exchange-CrossTenant-Network-Message-Id: 37d2f2a3-ba7d-4a63-f490-08d992b39c64 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:37.2088 (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: FTzorZ2oKz/T4z8gopyFkPczETVV3z2876GVyIh2K52+ZSowzBurx8DN+z/u4+lSt6io0j0BILC5dzpz9WwkOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: olgKtF5OfCnS7P271p_vKz207-_y3oZb X-Proofpoint-ORIG-GUID: olgKtF5OfCnS7P271p_vKz207-_y3oZb 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: WFovk7CsVSzFRJDNDd8Ygs2ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615524; bh=nxs3HO65fdKS9s5806wRUeV7eSw2XUrKXPeTHD61bkw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=dDAjR6P7AgoQDmE2yr6XZFM6TRxWkMG1iuHA50TWZLDDHNHsxzSKtiEMKNbVMeHRC+K eZUF/gTOuQK09FFFXstmNEZiaukC+UCud9YT0USMMz+zTVC1tmvPjrGUfKeNQsBM5WLe4 Fn9gBCzF+IzvVxdZTfdxH0IqCR7OjWqhfRU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615527098100002 Content-Type: text/plain; charset="utf-8" From: Abner Chang 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 | 5 = ++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf | 1 + Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf | 49 = ++++++++++++++ Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c | 70 = ++++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi | 2 = +- 5 files changed, 126 insertions(+), 1 deletion(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index e971993b7b00..4fab3c4bdcbb 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -150,6 +150,10 @@ RiscVPlatformTimerLib|Platform/SiFive/U5SeriesPkg/Library/RiscVPlatformT= imerLib/RiscVPlatformTimerLib.inf CpuExceptionHandlerLib|Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptio= nLib/CpuExceptionHandlerDxeLib.inf =20 + + # Flattened Device Tree (FDT) access library + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + [LibraryClasses.common.SEC] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf @@ -400,6 +404,7 @@ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf } + Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf =20 # # DXE Phase modules diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.f= df index 820e19d11334..f0bd65fad648 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf @@ -101,6 +101,7 @@ INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 # RISC-V Platform PEI Driver INF Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/PlatformPei.inf +INF Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf =20 ##########################################################################= ###### =20 diff --git a/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf b/Pl= atform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf new file mode 100644 index 000000000000..8dc58f0a8bf4 --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.inf @@ -0,0 +1,49 @@ +## @file +# The FDT Peim driver is used to pass the device tree to DXE phase. +# +# Copyright (c) 2021, Hewlett Packard Enterprise Developmente LP. All righ= ts reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FdtPei + MODULE_UNI_FILE =3D FdtPei.uni + FILE_GUID =3D 724FD5E9-F35E-4386-B1E1-2ADA6103C4F9 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + + ENTRY_POINT =3D PeimPassFdt + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D RISCV64 +# + +[Sources] + FdtPeim.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + DebugLib + DebugLib + HobLib + FdtLib + PcdLib + PeiServicesLib + PeimEntryPoint + RiscVFirmwareContextLib + +[Guids] + gFdtHobGuid ## PRODUCES + +[Depex] + TRUE diff --git a/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c b/Plat= form/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c new file mode 100644 index 000000000000..2cd94f291c7d --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c @@ -0,0 +1,70 @@ +/** @file +The module to pass the device tree to DXE via HOB. + +Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights = reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +#include + +#include + +/** + The entrypoint of the module, it will pass the FDT via a HOB. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Servic= es. + + @retval TODO +**/ +EFI_STATUS +EFIAPI +PeimPassFdt ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + VOID *FdtPointer; + VOID *Base; + VOID *NewBase; + UINTN FdtSize; + UINTN FdtPages; + UINT64 *FdtHobData; + EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext; + + FirmwareContext =3D NULL; + GetFirmwareContextPointer (&FirmwareContext); + + if (FirmwareContext =3D=3D NULL) { + DEBUG((DEBUG_ERROR, "%a: OpenSBI Firmware Context is NULL\n", __FUNCTI= ON__)); + return EFI_UNSUPPORTED; + } + FdtPointer =3D (VOID *)FirmwareContext->FlattenedDeviceTree; + if (FdtPointer =3D=3D NULL) { + DEBUG((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __FUNCTION__)); + return EFI_UNSUPPORTED; + } + DEBUG((DEBUG_ERROR, "%a: Build FDT HOB - FDT at address: 0x%x \n", __FUN= CTION__, FdtPointer)); + Base =3D FdtPointer; + ASSERT (Base !=3D NULL); + ASSERT (fdt_check_header (Base) =3D=3D 0); + + FdtSize =3D fdt_totalsize (Base); + FdtPages =3D EFI_SIZE_TO_PAGES (FdtSize); + NewBase =3D AllocatePages (FdtPages); + ASSERT (NewBase !=3D NULL); + fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages)); + + FdtHobData =3D BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData); + ASSERT (FdtHobData !=3D NULL); + *FdtHobData =3D (UINTN)NewBase; + + return EFI_SUCCESS; +} diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi b/= Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi index 937caee08331..a731c7e36988 160000 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi @@ -1 +1 @@ -Subproject commit 937caee0833115f69d697ca190001ba0aa5c7368 +Subproject commit a731c7e36988c3308e1978ecde491f2f6182d490 --=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 (#82283): https://edk2.groups.io/g/devel/message/82283 Mute This Topic: https://groups.io/mt/86432346/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- From nobody Tue May 7 05:34:20 2024 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- From nobody Tue May 7 05:34:20 2024 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+82277+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+82277+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 1634615452476421.84809726351773; Mon, 18 Oct 2021 20:50:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id IGFkYY1788612xVzlSsfZ31l; Mon, 18 Oct 2021 20:50:52 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web12.5089.1634615445384358726 for ; Mon, 18 Oct 2021 20:50:51 -0700 X-Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J2WFCL009534; Tue, 19 Oct 2021 03:50:45 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsd6x3c8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:44 +0000 X-Received: from G9W8455.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 452A260; Tue, 19 Oct 2021 03:50:44 +0000 (UTC) X-Received: from G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) by G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:44 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.13) by G9W8455.americas.hpqcorp.net (16.216.161.94) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AnOnKkt2+ATB/Jms35h+ZmBsDtaQ0vwcZkIqKYRb1UpVZXudvodLRU2Ux/mu7yL+2/WKyAuox6sB11jTdvYO7tALO/WIBe4DJmn98gg83/2Di4Vc+Q+rTpGHNK66m0rrtJ2mame3MszK8YH7qjuXDxOg47qlObETIi2JbavzLedwfC0jz7z9yD0UXhT3QpWEcyeRn2QCcrwaGmXoIKxzmkbv/4mEGDiXF/OE5qL6ZzXuiM5S8EMje1fGpB8fLOWUJMHRIt1fhisGC1jIV50jwpuSpbsEJHsODXpe6ShAOuvkIOakAzVSgD2LHRm2wO91mt6bpG/bHbnv7ne+NEtkSQ== 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=3aM8UCyEG71LBEB90gAlzDR47HR8bzjfDqP3di6h/pI=; b=cTmcKhSi8Zg5udpvT2cYsheAQpvYTZP+OKGXmV1FD+6UedXvk+BnaFATjDeBUTUwuXj/EuPL098Jh/zPMhT5qS1G3d8AqRP4VoKQuS8s0oVsVSC371IoUrZvfw0MfLk4Dh1/8SS5i7JlE7WW5BTD14XOODxtHHIYnNt8FjSQxnAVmGyZmaBXbME1AZ1sH272Jv7ZEqL8nkRA5/5s+8y+BQ1BqmetrSFMjCj+M1YaTxIkiGFld95K1bK4z/22vLUs7MPeNU04d2E0VvsjOR43EmWq3rJMlAXaZZtk9+113hikvTpSbzkLoJ472QKLxOGuCRl9ffRlgthwLiBD9Spmhw== 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:42 +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:42 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 11/14] U5SeriesPkg: Switch to generic OpenSBI platform Date: Tue, 19 Oct 2021 11:48:46 +0800 Message-ID: <20211019034849.16847-12-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:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d14c0d11-e54b-4044-439f-08d992b39f78 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: o36HHQzLF2y5TTZIjWBn4R9ZRpAFVcJN+lC9i8UARHoGBMG6M8saaQ5sdzxiW6HpgMPBY4gokAC7HntAGU0u0VXCzDTTZTT7+LVUidZRgA2wGFHHA24z02e9kYRrG7/orJDJu7dUkkBh8tARTXZpry/p4XIrqLD+wSpI1DyNEgmGxgMDRgvgbEyttuS0AnFGsXp/MXHTH5bKuq7cTeTFEd3oOPXgYH6ohFR2MHEyut/CvEvoetw7Y8k7MwPhy1MrqU0kpsxFom7taPCSrXfqpyl88Lp4dIo/7RIJU+mp5wIdLez7QaRG96Ayi8MTI+8IwjwK94Sa1mBhHMeabFcS/5Rg+bNEhAb1bB2JzmaJ7SzUA2kZBEOAxQhY4XfizTIivDiPcKmtD7ZxmTrxs4CNvdwz5n4AxGzqnlDJVitupjy2IcePb8m7XOLDup9TcuDpcVX9o/7QYe7KRx8Epsmotywl176xLwuFZ1U73QABAYJcp5C1jVuNH8ehRV3YKWsDMjL94Ur6cH1fJ33VyvP39vFhIackg1F0HgpOK1kU1zTSWofWi1dFzD+b38nT+3KwmQxI7Mt3ztS4TCvEuINcWmGe5umuOoDaDQGlVpkQij9X6PEbKYz9CjENXOtPir5KbAb3l8AOHreYWrYqIjw0/6VaXI3jGWvEcqG/+FKr0Oelo3xZc7psqHh/GhKU4RaYoaQDeYpmerQU4rcEon+wq27K3MZq24HSoA8HAwA3tI0= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?g3zZlnsthgolREvnlR7BaHFw4gWupvHgbapfMTjlS0DMsZu1nnzF64RsOxRD?= =?us-ascii?Q?VXpTC6XVyTjiwbvNW4CxASXh7Uup5vBY4wUihBz94tkHfqBWa4XzfuhyZDos?= =?us-ascii?Q?IvkU+/r7VAaWIWUSoup1cWeXvaFabyvM2ByE3VrE28MK1OLpou8k2Q+woVhy?= =?us-ascii?Q?ehYMwGFkOpyybRxIUGum0Jze3+KzG0O60B13g2p8U3zAZfV5pStgvZq6KYrp?= =?us-ascii?Q?9fu6S4sv4dfaXVjMKWA57QZDG4meMg0373J6dIQ1jOMmERxVKSKfWzhPcldh?= =?us-ascii?Q?V1b69PH4ctvUWPP7witRxBCw/CwSFmPd9+/8YS2A/wpMlDlKeiah8rnibVQg?= =?us-ascii?Q?HWrNSHn9aAVJPbBjm8cThp2YsFC/jvAh3o2D3fy1WPP/GchD1tqLkFj9GTyJ?= =?us-ascii?Q?xm/QJAzMsWj0GBeQ2yZmNOFP4eExh1iXvOy5c6zcO5Nvt0DqajAhlNHBLR91?= =?us-ascii?Q?xl9QZ+hGQrtWfuhheaSJJeIxz8lmRoJCGlKzQuvIHEW15fqiCiIbg9y04ub/?= =?us-ascii?Q?bQ06nWqTMD/Kblq86Qf0oCZFlcLDIKYAW4m7Ryuav1+59BvVfQu+OOMy009J?= =?us-ascii?Q?7c6Dr4dkKZrx0c9Kc9v6ki13EHOD1fRLxIhhOMbXrpmQRPoAxGVt83Fj5M+O?= =?us-ascii?Q?KH9LynH6/HaQoZrywxuyLXJFdzQ5FiRUKox1D00rH3MyszxGTsS5MShB6n4j?= =?us-ascii?Q?39rkj9JKC0KMCmHgJ6TgpzmKPYLG8syFU9i3Gfs8BcgFmakc0xPhAEyYs9Zl?= =?us-ascii?Q?27eaZfZTY84QbUVGTD2KFG580Q/gyHfOAkF7tqeLmMkR9UD3QdxcR5MhkBUj?= =?us-ascii?Q?eXPBkdDn/z3mvv+ADEASadPhLocVfIyIbU0M/P01cArLzau6Nsk6oG51L9Oi?= =?us-ascii?Q?MmpOz0vkzp6kU/ItvSs9lWLdkRlm5U9lw/XTaV1boZgmoLZSDEQZmFDkFYsM?= =?us-ascii?Q?ghxKHeu0bnsjl9+KWEfgKpOjb9EFK4c4NZalHRfg38VJdgkxj+462qb0tZBV?= =?us-ascii?Q?CH+7qSy6oW3BL0O9KSRAX3EfyuXtyARZgbDulC6A4zWTNBfq1ph3xykyk1XH?= =?us-ascii?Q?RIUpuU+9b/dW+6s9fWOzGVrDODXQXtphgPeSMiMA3RNl3cp9auJCLLYlushZ?= =?us-ascii?Q?GJ+svb+8J4QV5vJeXZ31kliE62lONhw/fQtM/lGp5LXR3Qh7zaAYGSG9Xask?= =?us-ascii?Q?AMF4/U4PptkNx9F311s3ACkSKgqO2vrKn+gwU98Y8p4FwpSzNrwNt6JA1u3d?= =?us-ascii?Q?X08162OcnjT9uaEJ0BD39I7GgFeV70cs43qWu4RQArjnRMBcCDRhtR6XfBr6?= =?us-ascii?Q?FuJ093G5mzaUvMc0xjFeop7C?= X-MS-Exchange-CrossTenant-Network-Message-Id: d14c0d11-e54b-4044-439f-08d992b39f78 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:42.5564 (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: oGWckzR8GSAQNLDOyTVP+W2wqrhl0VXNWSP71QRzviOQBaj8MNmA2GMEyDx/Ba3+Nq/cq1LAZy9UqRHUGPFGNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: 5mMDh2CByZL6O96XuRFs08pt3frl4vpX X-Proofpoint-ORIG-GUID: 5mMDh2CByZL6O96XuRFs08pt3frl4vpX 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: ELIfprHljF28GyJ8iHMwKNGLx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615452; bh=WqLV1WuzZod7TE9mtoJexbLY9KzU+7vQDqbkHa0bFCw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=gu9eBpaI2il4sIIXTddzPG5/fsMJ9zEFp+0CEGcTASwxAoq1qFiUSdqoFgT323DbI0y ySnWwbe4fz+63Tc2KpXRoec+26Kx8mMDcaMkIKnjdCE8fm2U54qIXviNc8zh4I2Fph4y5 c+8bj/EvsCF0jEops+l35lWoJY1RHVEG55A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615453547100002 Content-Type: text/plain; charset="utf-8" New platform files require more space in SEC. Behavior is determined not by source code but by device tree. Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/OpensbiPlatformLib.inf | 2 + Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/PlatformOverride.h | 27 ++ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/Platform.c | 390 ++++++++++---------- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/SifiveFu540.c | 47 +++ Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc = | 6 +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc = | 6 +- 6 files changed, 281 insertions(+), 197 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/SiFive/U5SeriesP= kg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatfo= rmLib.inf index 317aaceb2519..f9f2073a5ba4 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/OpensbiPlatformLib.inf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/OpensbiPlatformLib.inf @@ -25,6 +25,8 @@ =20 [Sources] Platform.c + SifiveFu540.c + PlatformOverride.h =20 [Packages] EmbeddedPkg/EmbeddedPkg.dec diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/PlatformOverride.h b/Platform/SiFive/U5SeriesPkg/F= reedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/PlatformOverride.h new file mode 100644 index 000000000000..9b6fcdc15f45 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/PlatformOverride.h @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __PLATFORM_OVERRIDE_H__ +#define __PLATFORM_OVERRIDE_H__ + +#include + +struct platform_override { + const struct fdt_match *match_table; + u64 (*features)(const struct fdt_match *match); + u64 (*tlbr_flush_limit)(const struct fdt_match *match); + int (*early_init)(bool cold_boot, const struct fdt_match *match); + int (*final_init)(bool cold_boot, const struct fdt_match *match); + void (*early_exit)(const struct fdt_match *match); + void (*final_exit)(const struct fdt_match *match); + int (*system_reset)(u32 reset_type, const struct fdt_match *match); + int (*fdt_fixup)(void *fdt, const struct fdt_match *match); +}; + +#endif diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU5= 40HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c index aa6274be965b..fe6e2a8c943a 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c @@ -1,216 +1,224 @@ /* - * - * Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
- * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * Copyright (c) 2020 Western Digital Corporation or its affiliates. * * Authors: - * Atish Patra + * Anup Patel */ =20 #include +#include #include -#include -#include -#include -#include +#include #include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include =20 -#define U540_HART_COUNT FixedPcdGet32(PcdHartCount) -#define U540_BOOTABLE_HART_COUNT FixedPcdGet32(PcdBootableHartNumber) -#define U540_HART_STACK_SIZE FixedPcdGet32(PcdOpenSbiStackSize) -#define U540_BOOT_HART_ID FixedPcdGet32(PcdBootHartId) +extern const struct platform_override sifive_fu540; =20 -#define U540_SYS_CLK FixedPcdGet32(PcdU5PlatformSystemClock) - -#define U540_PLIC_ADDR 0xc000000 -#define U540_PLIC_NUM_SOURCES 0x35 -#define U540_PLIC_NUM_PRIORITIES 7 - -#define U540_UART_ADDR FixedPcdGet32(PcdU5UartBase) - -#define U540_UART_BAUDRATE 115200 - -/* PRCI clock related macros */ -//TODO: Do we need a separate driver for this ? -#define U540_PRCI_BASE_ADDR 0x10000000 -#define U540_PRCI_CLKMUXSTATUSREG 0x002C -#define U540_PRCI_CLKMUX_STATUS_TLCLKSEL (0x1 << 1) - -/* Full tlb flush always */ -#define U540_TLB_RANGE_FLUSH_LIMIT 0 - -unsigned long log2roundup(unsigned long x); - -static struct plic_data plic =3D { - .addr =3D U540_PLIC_ADDR, - .num_src =3D U540_PLIC_NUM_SOURCES, +static const struct platform_override *special_platforms[] =3D { + &sifive_fu540, }; =20 -static struct clint_data clint =3D { - .addr =3D CLINT_REG_BASE_ADDR, - .first_hartid =3D 0, - .hart_count =3D U540_HART_COUNT, - .has_64bit_mmio =3D TRUE, -}; - -static void U540_modify_dt(void *fdt) -{ - fdt_cpu_fixup(fdt); - - fdt_fixups(fdt); - - /* - * SiFive Freedom U540 has an erratum that prevents S-mode software - * to access a PMP protected region using 1GB page table mapping, so - * always add the no-map attribute on this platform. - */ - fdt_reserved_memory_nomap_fixup(fdt); -} - -static int U540_final_init(bool cold_boot) -{ - void *fdt; - struct sbi_scratch *ThisScratch; - - if (!cold_boot) - return 0; - - fdt =3D sbi_scratch_thishart_arg1_ptr(); - U540_modify_dt(fdt); - // - // Set PMP of firmware regions to R and X. We will lock this in the en= d of PEI. - // This region only protects SEC, PEI and Scratch buffer. - // - ThisScratch =3D sbi_scratch_thishart_ptr (); - pmp_set(0, PMP_R | PMP_X | PMP_W, ThisScratch->fw_start, log2roundup (= ThisScratch->fw_size)); - return 0; -} - -static u32 U540_pmp_region_count(u32 hartid) -{ - return 1; -} - -static int U540_pmp_region_info(u32 hartid, u32 index, - ulong *prot, ulong *addr, ulong *log2size) -{ - int ret =3D 0; - - switch (index) { - case 0: - *prot =3D PMP_R | PMP_W | PMP_X; - *addr =3D 0; - *log2size =3D __riscv_xlen; - break; - default: - ret =3D -1; - break; - }; - - return ret; -} - -static int U540_console_init(void) -{ - unsigned long peri_in_freq; - - peri_in_freq =3D U540_SYS_CLK/2; - return sifive_uart_init(U540_UART_ADDR, peri_in_freq, U540_UART_BAUDRA= TE); -} - -static int U540_irqchip_init(bool cold_boot) -{ - int rc; - u32 hartid =3D current_hartid(); - - if (cold_boot) { - rc =3D plic_cold_irqchip_init(&plic); - if (rc) - return rc; - } - - return plic_warm_irqchip_init(&plic, - (hartid) ? (2 * hartid - 1) : 0, - (hartid) ? (2 * hartid) : -1); -} - -static int U540_ipi_init(bool cold_boot) -{ - int rc; - - if (cold_boot) { - rc =3D clint_cold_ipi_init(&clint); - if (rc) - return rc; - - } - - return clint_warm_ipi_init(); -} - -static u64 U540_get_tlbr_flush_limit(void) -{ - return U540_TLB_RANGE_FLUSH_LIMIT; -} - -static int U540_timer_init(bool cold_boot) -{ - int rc; - - if (cold_boot) { - rc =3D clint_cold_timer_init(&clint, NULL); - if (rc) - return rc; - } - - return clint_warm_timer_init(); -} -/** - * The U540 SoC has 5 HARTs, Boot HART ID is determined by - * PcdBootHartId. +static const struct platform_override *generic_plat =3D NULL; +static const struct fdt_match *generic_plat_match =3D NULL; + +static void fw_platform_lookup_special(void *fdt, int root_offset) +{ + int pos, noff; + const struct platform_override *plat; + const struct fdt_match *match; + + for (pos =3D 0; pos < array_size(special_platforms); pos++) { + plat =3D special_platforms[pos]; + if (!plat->match_table) + continue; + + noff =3D fdt_find_match(fdt, -1, plat->match_table, &match); + if (noff < 0) + continue; + + generic_plat =3D plat; + generic_plat_match =3D match; + break; + } +} + +extern struct sbi_platform platform; +static u32 generic_hart_index2id[SBI_HARTMASK_MAX_BITS] =3D { 0 }; + +/* + * The fw_platform_init() function is called very early on the boot HART + * OpenSBI reference firmwares so that platform specific code get chance + * to update "platform" instance before it is used. + * + * The arguments passed to fw_platform_init() function are boot time state + * of A0 to A4 register. The "arg0" will be boot HART id and "arg1" will + * be address of FDT passed by previous booting stage. + * + * The return value of fw_platform_init() function is the FDT location. If + * FDT is unchanged (or FDT is modified in-place) then fw_platform_init() + * can always return the original FDT location (i.e. 'arg1') unmodified. */ -static u32 U540_hart_index2id[U540_BOOTABLE_HART_COUNT] =3D {1, 2, 3, 4}; +unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1, + unsigned long arg2, unsigned long arg3, + unsigned long arg4) +{ + const char *model, *mmu_type; + void *fdt =3D (void *)arg1; + u32 hartid, hart_count =3D 0; + int rc, root_offset, cpus_offset, cpu_offset, len; + + root_offset =3D fdt_path_offset(fdt, "/"); + if (root_offset < 0) + goto fail; + + fw_platform_lookup_special(fdt, root_offset); + + model =3D fdt_getprop(fdt, root_offset, "model", &len); + if (model) + sbi_strncpy(platform.name, model, sizeof(platform.name)); + + if (generic_plat && generic_plat->features) + platform.features =3D generic_plat->features(generic_plat_match); + + cpus_offset =3D fdt_path_offset(fdt, "/cpus"); + if (cpus_offset < 0) + goto fail; + + fdt_for_each_subnode(cpu_offset, fdt, cpus_offset) { + rc =3D fdt_parse_hart_id(fdt, cpu_offset, &hartid); + if (rc) + continue; + + if (SBI_HARTMASK_MAX_BITS <=3D hartid) + continue; + + mmu_type =3D fdt_getprop(fdt, cpu_offset, "mmu-type", &len); + if (!mmu_type || !len) + hartid =3D -1U; =20 -static int U540_system_reset(u32 type) + generic_hart_index2id[hart_count++] =3D hartid; + } + + platform.hart_count =3D hart_count; + + /* Return original FDT pointer */ + return arg1; + +fail: + while (1) + wfi(); +} + +static int generic_early_init(bool cold_boot) { - /* For now nothing to do. */ + int rc; + + if (generic_plat && generic_plat->early_init) { + rc =3D generic_plat->early_init(cold_boot, generic_plat_match); + if (rc) + return rc; + } + + if (!cold_boot) return 0; + + return fdt_reset_init(); +} + +static int generic_final_init(bool cold_boot) +{ + void *fdt; + int rc; + + if (generic_plat && generic_plat->final_init) { + rc =3D generic_plat->final_init(cold_boot, generic_plat_match); + if (rc) + return rc; + } + + if (!cold_boot) + return 0; + + fdt =3D sbi_scratch_thishart_arg1_ptr(); + + fdt_cpu_fixup(fdt); + fdt_fixups(fdt); + + if (generic_plat && generic_plat->fdt_fixup) { + rc =3D generic_plat->fdt_fixup(fdt, generic_plat_match); + if (rc) + return rc; + } + + return 0; +} + +static void generic_early_exit(void) +{ + if (generic_plat && generic_plat->early_exit) + generic_plat->early_exit(generic_plat_match); +} + +static void generic_final_exit(void) +{ + if (generic_plat && generic_plat->final_exit) + generic_plat->final_exit(generic_plat_match); +} + +static u64 generic_tlbr_flush_limit(void) +{ + if (generic_plat && generic_plat->tlbr_flush_limit) + return generic_plat->tlbr_flush_limit(generic_plat_match); + return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT; +} + +static int generic_system_reset(u32 reset_type) +{ + if (generic_plat && generic_plat->system_reset) + return generic_plat->system_reset(reset_type, + generic_plat_match); + return fdt_system_reset(reset_type); } =20 const struct sbi_platform_operations platform_ops =3D { - .pmp_region_count =3D U540_pmp_region_count, - .pmp_region_info =3D U540_pmp_region_info, - .final_init =3D U540_final_init, - .console_putc =3D sifive_uart_putc, - .console_getc =3D sifive_uart_getc, - .console_init =3D U540_console_init, - .irqchip_init =3D U540_irqchip_init, - .ipi_send =3D clint_ipi_send, - .ipi_clear =3D clint_ipi_clear, - .ipi_init =3D U540_ipi_init, - .get_tlbr_flush_limit =3D U540_get_tlbr_flush_limit, - .timer_value =3D clint_timer_value, - .timer_event_stop =3D clint_timer_event_stop, - .timer_event_start =3D clint_timer_event_start, - .timer_init =3D U540_timer_init, - .system_reset =3D U540_system_reset + .early_init =3D generic_early_init, + .final_init =3D generic_final_init, + .early_exit =3D generic_early_exit, + .final_exit =3D generic_final_exit, + .console_putc =3D fdt_serial_putc, + .console_getc =3D fdt_serial_getc, + .console_init =3D fdt_serial_init, + .irqchip_init =3D fdt_irqchip_init, + .irqchip_exit =3D fdt_irqchip_exit, + .ipi_send =3D fdt_ipi_send, + .ipi_clear =3D fdt_ipi_clear, + .ipi_init =3D fdt_ipi_init, + .ipi_exit =3D fdt_ipi_exit, + .get_tlbr_flush_limit =3D generic_tlbr_flush_limit, + .timer_value =3D fdt_timer_value, + .timer_event_stop =3D fdt_timer_event_stop, + .timer_event_start =3D fdt_timer_event_start, + .timer_init =3D fdt_timer_init, + .timer_exit =3D fdt_timer_exit, + .system_reset =3D generic_system_reset, }; =20 -const struct sbi_platform platform =3D { - .opensbi_version =3D OPENSBI_VERSION, // The O= penSBI version this platform table is built bassed on. - .platform_version =3D SBI_PLATFORM_VERSION(0x0001, 0x0000), // SBI P= latform version 1.0 - .name =3D "SiFive Freedom U540", - .features =3D SBI_PLATFORM_DEFAULT_FEATURES, - .hart_count =3D U540_BOOTABLE_HART_COUNT, - .hart_index2id =3D U540_hart_index2id, - .hart_stack_size =3D U540_HART_STACK_SIZE, - .platform_ops_addr =3D (unsigned long)&platform_ops +struct sbi_platform platform =3D { + .opensbi_version =3D OPENSBI_VERSION, + .platform_version =3D SBI_PLATFORM_VERSION(0x0, 0x01), + .name =3D "Generic", + .features =3D SBI_PLATFORM_DEFAULT_FEATURES, + .hart_count =3D SBI_HARTMASK_MAX_BITS, + .hart_index2id =3D generic_hart_index2id, + .hart_stack_size =3D SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, + .platform_ops_addr =3D (unsigned long)&platform_ops }; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/SifiveFu540.c b/Platform/SiFive/U5SeriesPkg/Freedo= mU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/SifiveFu540.c new file mode 100644 index 000000000000..748b058840e0 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/SifiveFu540.c @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#include +#include +#include + +static u64 sifive_fu540_tlbr_flush_limit(const struct fdt_match *match) +{ + /* + * The sfence.vma by virtual address does not work on + * SiFive FU540 so we return remote TLB flush limit as zero. + */ + return 0; +} + +static int sifive_fu540_fdt_fixup(void *fdt, const struct fdt_match *match) +{ + /* + * SiFive Freedom U540 has an erratum that prevents S-mode software + * to access a PMP protected region using 1GB page table mapping, so + * always add the no-map attribute on this platform. + */ + fdt_reserved_memory_nomap_fixup(fdt); + + return 0; +} + +static const struct fdt_match sifive_fu540_match[] =3D { + { .compatible =3D "sifive,fu540" }, + { .compatible =3D "sifive,fu540g" }, + { .compatible =3D "sifive,fu540-c000" }, + { .compatible =3D "sifive,hifive-unleashed-a00" }, + { }, +}; + +const struct platform_override sifive_fu540 =3D { + .match_table =3D sifive_fu540_match, + .tlbr_flush_limit =3D sifive_fu540_tlbr_flush_limit, + .fdt_fixup =3D sifive_fu540_fdt_fixup, +}; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc= b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc index 13c14a4a2c76..e88aee8c0212 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc @@ -23,10 +23,10 @@ DEFINE CODE_BLOCKS =3D 0x7E0 DEFINE VARS_BLOCKS =3D 0x20 =20 DEFINE SECFV_OFFSET =3D 0x00000000 -DEFINE SECFV_SIZE =3D 0x00020000 -DEFINE PEIFV_OFFSET =3D 0x00020000 +DEFINE SECFV_SIZE =3D 0x00030000 +DEFINE PEIFV_OFFSET =3D 0x00030000 DEFINE PEIFV_SIZE =3D 0x00080000 -DEFINE SCRATCH_OFFSET =3D 0x000a0000 +DEFINE SCRATCH_OFFSET =3D 0x000b0000 DEFINE SCRATCH_SIZE =3D 0x00010000 DEFINE FVMAIN_OFFSET =3D 0x00100000 # Must be power of 2 for PMP setti= ng DEFINE FVMAIN_SIZE =3D 0x0018C000 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.fdf.inc index 723632dc792d..8e7afc2d82c4 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.= inc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.= inc @@ -23,10 +23,10 @@ DEFINE CODE_BLOCKS =3D 0x7E0 DEFINE VARS_BLOCKS =3D 0x20 =20 DEFINE SECFV_OFFSET =3D 0x00000000 -DEFINE SECFV_SIZE =3D 0x00020000 -DEFINE PEIFV_OFFSET =3D 0x00020000 +DEFINE SECFV_SIZE =3D 0x00030000 +DEFINE PEIFV_OFFSET =3D 0x00030000 DEFINE PEIFV_SIZE =3D 0x00080000 -DEFINE SCRATCH_OFFSET =3D 0x000a0000 +DEFINE SCRATCH_OFFSET =3D 0x000b0000 DEFINE SCRATCH_SIZE =3D 0x00010000 DEFINE FVMAIN_OFFSET =3D 0x00100000 # Must be power of 2 for PMP setti= ng DEFINE FVMAIN_SIZE =3D 0x0018C000 --=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 (#82277): https://edk2.groups.io/g/devel/message/82277 Mute This Topic: https://groups.io/mt/86432329/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- From nobody Tue May 7 05:34:20 2024 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+82278+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+82278+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 163461545380531.77299242946185; Mon, 18 Oct 2021 20:50:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TofIYY1788612xgDKJCXTFxP; Mon, 18 Oct 2021 20:50:53 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.5150.1634615448302611590 for ; Mon, 18 Oct 2021 20:50:52 -0700 X-Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J11v6j010180; Tue, 19 Oct 2021 03:50:48 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bs5guyn09-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:47 +0000 X-Received: from G9W8456.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id EA16F6E; Tue, 19 Oct 2021 03:50:46 +0000 (UTC) X-Received: from G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) by G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:46 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.10) by G9W8453.americas.hpqcorp.net (16.216.160.211) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AjL0k8sDvYKdCdIxVvW/IYbq9furPZnI0RgQ8Rh2lHsbgYq+WI7DNiUYAq7mV52sqM84u//n2soWaJlyJm2eBGos27S1tv/wswOJcjvKUghS5PaTi6ap40UN0XFWVwCHtBDtPCdJNx7ZQLE0pTtSf8dMMU9Qj8296juve4srUDG+0ktAvVi0jv0jgfJrUxH3TPIe//hX4vIrrOykieEwR1BfJoE57paBwr4bCdzdj4W++rUCKDYlaFNfmYFJwQLonEtAxZewOoVllOBEW2gBaKIh62rA+GFAKsR1uMYJHTiD6aXhssK3xAo5LPRxzoJQVc5iHf+xXOCe2t7mgji0lA== 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=PT11H1cWoiOGspHAjIh6vGe6tsJlJMyOShyZO6RGYCw=; b=akbmSQdwIM02Gde1v1K5glZVQN4P+YchhJVgDJ3kGQGNaM0TfQ1OapiI1NBbBuzxzCwn6wT2hOfomAS53WqjVOZxe6U44dhlYnR5fgK9ZzZq6cZn2lKzEekLnT7fPfwPhejeNyqhXdz3x607fEGy0F1lJmbhW2vyuKGDwXE2SXdP9oG1pH5sPyBmxx7xm1GZydfLH2wP8tf8lT+DhhDUq4usj6YCsJuukHViP8wZGGygdTORW7LK+FhGncVbnXq6rZliA0hxLpwucZ2/jEDy+lGpKPcnxvb/lvIYevabk5PKsE71DQC1XD3GIWv4WUufOr3AkhVk+rD/5h+oG/+wqA== 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:45 +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:45 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 12/14] RISC-V: Switch to latest OpenSBI Date: Tue, 19 Oct 2021 11:48:47 +0800 Message-ID: <20211019034849.16847-13-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:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24333843-b4d7-4a12-5be2-08d992b3a104 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: RYqn174HqKVCZgCJ9l4zw6B6Q+k7QdibC0EjC2YTnyDEbmHHgo/Uw/PcIFAZzzfMH2p36FwJNUYO0HgB+YQqO6TbcqnbHf/hsiaoDj00jFOOzI3MxUW+WIeIlrz598q8zr+jE66HGK2poJaMBkpl/neK1j4tfkmNRUhDpQAUzFofwp0ZSQ/bDFwBYgtpFxX8N8ECDE9XZKNjllWU2vrTEfTwOAK53yq1p7TroZ/X5vwudkNT43cYdUJQdgB6IKgpJkiJBQiO8vPRQlG5qnwt9663IujDOwsF84PUaV3v07efPMi5+k8ssUsRQwtUtayvLSY0kQE77QeEILdhipoTZe8A0Okk9TOqtk4c45ReDaSqtZUfoXnOUgIA1fMI4uG/iCMQHMIe84tvlKbvOTBiQ+QsKyW++Z4HIMS6GIo1fxRCsrybLpnOaie4Bf9mJ3GCDBnNz9vFYDnPTyLxmFamjS/R59ixHtNbY81ygEvC2XPhkHEfSqGKz8KZ92gB+VqNVIMI/wV1f/HpiTor8iOhSjEi0Lak+Dy9M+69umTAnQS4+cV4f3gcbhj3sxCJkOAixDLx7wsZ01bSbkdp8kh3cOlPlCo9bewggh8B+Pt5cYUG2ciJmIwy/Nugk/r2hiG27BXG98IeG4wb3ljjGTDoo6rB0W9fiRfWKKm7zN4rPgMvBUjY1Yc+2Rwb/sC2XSaQT7rnYwz+ViEeJRPVCnOXWg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rgkYMcqe6bA+Zentgk79u3GSVJSHwalTFkzBfjahGEOemnTpZM4wpoekiHn7?= =?us-ascii?Q?S/N9XAJaIcKKFQF2v+EOJYNT4NziLKqz1qFngS5JXUZ/kqX3PnjCK0teXLkp?= =?us-ascii?Q?iRXhGP9JIXVuvmu/NMox1qp3QpDdkuhL2VG54TK72704fxrCSuGaGW5xOLVQ?= =?us-ascii?Q?GlWwTNKKnNuKbZyHBKDv3fzKlIOs/8E0CwChSoMwcjsrhVqtkhhQPeODwrsg?= =?us-ascii?Q?Rg2VekiXm4+O2EZ9rc3Y6vfsvc3fa57Uc27+qf2VU+e4PcPKHPEIf7OLmHfH?= =?us-ascii?Q?rMD2PKCiK1Yt10SvjQ7eQUE2PSlTYjUZXNn4Z9BKaSu/aawj84c7vlK2PU11?= =?us-ascii?Q?BlaC95TcCjG2gJKoPSEBwFMwCS8J/7CBFzir7TzM9bJgjXd9zu1wu0DAQBxt?= =?us-ascii?Q?lPWl3Wu/OCSIpZrfnLmMiYLBT+p3AQQCa413sRc/CcGL0ae0yqOnMKkJinpn?= =?us-ascii?Q?qRMPene8ejnnkztAHfWGcgkl/kqPbypu+VW5hKFEQNPFsu0ZYnRsta1sL6UJ?= =?us-ascii?Q?nKSsU3Cv1VwmKQZjIt9bXg1nr++UWZxaJxfb+mMneNFj9jBPvip8+c8gXckY?= =?us-ascii?Q?dN9QzRcwF9vLYkNY4E3RuilwmaOJL02YJYbExx9wNP2SkbiX7jlu3Z1hzsqN?= =?us-ascii?Q?u+M/fta3ahbYlgwQHFZOEBVKmdm7PGDsUJsabK3yfPbB5vnN9RQKXqc/3X6U?= =?us-ascii?Q?qWTAjGrDgYRfc3DuRr9YuYsCqP1F2n15ZvU2/NV8QeduOcLpctL8wWPwCing?= =?us-ascii?Q?8a85VXyDpJ83pRu9a6+PNg9bElVNkh/yO4kZjnNnFbrSyo275boTUjzbPP6p?= =?us-ascii?Q?eabMxwknNv3ifEe18VPCm5XaxOU9N34s4jqOIsmboDvfT9RC4Q0m+NElFvBe?= =?us-ascii?Q?Gk7NWR1S9TUvFuSwBE3BiLekDCW07dkH7NQctLlyIzqtOQUWA8oNaYbYwpzc?= =?us-ascii?Q?t4Tz/Rdfs99xtH+OnIkRpcMiq4mbTDQrQ1ofVtm9l/R2N/X2l6fKejlgCqXU?= =?us-ascii?Q?kSRpy90HKvvXTgy2h6uyCqGMMjjHLsDB7C6KecahPE+TP+IxSOZZNJT9ID8n?= =?us-ascii?Q?xPi70XaUe7ROpFqcbaqZ+qQroap3nxW3kOZhtc3YBTmmYrSuvTvZE6+sw36L?= =?us-ascii?Q?mPYdGzNlHS1XMMxRkkCmcFWXKVaUhooXqKn7R1zfzSFIDTWtywBZ8yTjhOSy?= =?us-ascii?Q?jkjVEAFVTF2m86rdnvQiuDTmc0/j/0leRX+Btbdqph6/eLcHEzzVE4HX73OT?= =?us-ascii?Q?sRe0AFEehdmT2aRd/2ayDztEPvuJAXNpVB2euUWLFkWz7rk/ZpujG9kLKPb/?= =?us-ascii?Q?UMQzV971TvDKHzEciDnLTv5b?= X-MS-Exchange-CrossTenant-Network-Message-Id: 24333843-b4d7-4a12-5be2-08d992b3a104 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:45.0373 (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: CvrLUg8Jqre2PeYc2QvRbAXmaF1JTuXEuA6jD4rAtDOb6p2Haz1IRkg3wOCBMZulal99DldkIEYMppmeVsChPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: OYoS0Uw-79lakwbISy16UVEf62ei-WQ8 X-Proofpoint-GUID: OYoS0Uw-79lakwbISy16UVEf62ei-WQ8 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: V52gjDzu3390jaM0ZQsg1cmtx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615453; bh=InGfgwAChALcuKu0UNwrRwAebDzJwLZ1zJTRjwdBrwY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=GPu4e5oXf499sheoF05Lt+9mRN+N3TvhPEVnQZsxuFn3lXJ09eazhTT8hueTllcAWlw QDakpCbWzmXu+mH/bQA8OQCYN4afJ68HEKN8mc1HAfErjuQutmVK1IzlAFj0Er/agyMMV q/ITNbOemUcKz9h3kcIkvMfAPKcta6eS8FQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615455602100011 Content-Type: text/plain; charset="utf-8" Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf = | 13 +++- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/PlatformOverride.h | 57 +++++++------- Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h = | 1 + Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h = | 1 + Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c = | 27 ++++--- Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c = | 5 +- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformL= ib/Platform.c | 29 +------ Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/Opensb= iPlatformLib/Platform.c | 31 +++----- Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c = | 81 +++++++++++++++++++- Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S = | 2 + 10 files changed, 154 insertions(+), 93 deletions(-) diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpens= biLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensb= iLib.inf index 71cc76444eef..e40a797896be 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.i= nf +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.i= nf @@ -23,6 +23,7 @@ opensbi/lib/sbi/sbi_bitmap.c opensbi/lib/sbi/sbi_bitops.c opensbi/lib/sbi/sbi_console.c + opensbi/lib/sbi/sbi_domain.c opensbi/lib/sbi/sbi_ecall.c opensbi/lib/sbi/sbi_ecall_base.c opensbi/lib/sbi/sbi_ecall_hsm.c @@ -51,27 +52,33 @@ =20 opensbi/lib/utils/fdt/fdt_helper.c opensbi/lib/utils/fdt/fdt_fixup.c + opensbi/lib/utils/fdt/fdt_domain.c opensbi/lib/utils/ipi/fdt_ipi.c - opensbi/lib/utils/ipi/fdt_ipi_clint.c + opensbi/lib/utils/ipi/aclint_mswi.c + opensbi/lib/utils/ipi/fdt_ipi_mswi.c opensbi/lib/utils/irqchip/fdt_irqchip.c opensbi/lib/utils/irqchip/fdt_irqchip_plic.c opensbi/lib/utils/irqchip/plic.c opensbi/lib/utils/reset/fdt_reset.c opensbi/lib/utils/reset/fdt_reset_htif.c opensbi/lib/utils/reset/fdt_reset_sifive.c + opensbi/lib/utils/reset/fdt_reset_thead.c + opensbi/lib/utils/reset/fdt_reset_thead_asm.S opensbi/lib/utils/serial/fdt_serial.c opensbi/lib/utils/serial/fdt_serial_htif.c opensbi/lib/utils/serial/fdt_serial_shakti.c opensbi/lib/utils/serial/fdt_serial_sifive.c opensbi/lib/utils/serial/fdt_serial_uart8250.c + opensbi/lib/utils/serial/fdt_serial_gaisler.c + opensbi/lib/utils/serial/gaisler-uart.c opensbi/lib/utils/serial/shakti-uart.c opensbi/lib/utils/serial/sifive-uart.c opensbi/lib/utils/serial/uart8250.c - opensbi/lib/utils/sys/clint.c opensbi/lib/utils/sys/htif.c opensbi/lib/utils/sys/sifive_test.c opensbi/lib/utils/timer/fdt_timer.c - opensbi/lib/utils/timer/fdt_timer_clint.c + opensbi/lib/utils/timer/aclint_mtimer.c + opensbi/lib/utils/timer/fdt_timer_mtimer.c =20 [Packages] EmbeddedPkg/EmbeddedPkg.dec # For libfdt. diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/PlatformOverride.h b/Platform/SiFive/U5SeriesPkg/F= reedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/PlatformOverride.h index 9b6fcdc15f45..467ebbd4b889 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/PlatformOverride.h +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/PlatformOverride.h @@ -1,27 +1,30 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Western Digital Corporation or its affiliates. - * - * Authors: - * Anup Patel - */ - -#ifndef __PLATFORM_OVERRIDE_H__ -#define __PLATFORM_OVERRIDE_H__ - -#include - -struct platform_override { - const struct fdt_match *match_table; - u64 (*features)(const struct fdt_match *match); - u64 (*tlbr_flush_limit)(const struct fdt_match *match); - int (*early_init)(bool cold_boot, const struct fdt_match *match); - int (*final_init)(bool cold_boot, const struct fdt_match *match); - void (*early_exit)(const struct fdt_match *match); - void (*final_exit)(const struct fdt_match *match); - int (*system_reset)(u32 reset_type, const struct fdt_match *match); - int (*fdt_fixup)(void *fdt, const struct fdt_match *match); -}; - -#endif +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __PLATFORM_OVERRIDE_H__ +#define __PLATFORM_OVERRIDE_H__ + +#include + +struct platform_override { + const struct fdt_match *match_table; + u64 (*features)(const struct fdt_match *match); + u64 (*tlbr_flush_limit)(const struct fdt_match *match); + int (*early_init)(bool cold_boot, const struct fdt_match *match); + int (*final_init)(bool cold_boot, const struct fdt_match *match); + void (*early_exit)(const struct fdt_match *match); + void (*final_exit)(const struct fdt_match *match); + int (*system_reset_check)(u32 reset_type, u32 reset_reason, + const struct fdt_match *match); + void (*system_reset)(u32 reset_type, u32 reset_reason, + const struct fdt_match *match); + int (*fdt_fixup)(void *fdt, const struct fdt_match *match); +}; + +#endif diff --git a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h = b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h index f81ea06b05b0..66a87cb8c38f 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h @@ -16,6 +16,7 @@ #include #include #include +#include =20 // // EDK2 OpenSBI Firmware extension. diff --git a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h b/Silicon/R= ISC-V/ProcessorPkg/Include/OpensbiTypes.h index 00c374f24a85..bbf74e2a82fe 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h @@ -49,6 +49,7 @@ typedef UINT64 physical_size_t; =20 #define __packed __attribute__((packed)) #define __noreturn __attribute__((noreturn)) +#define __aligned(x) __attribute__((aligned(x))) =20 #if defined(__GNUC__) || defined(__clang__) #define likely(x) __builtin_expect((x), 1) diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Pla= tform.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platfo= rm.c index e78d811f4c3d..b7e39d19c16f 100644 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c @@ -14,31 +14,38 @@ #include =20 const struct sbi_platform_operations platform_ops =3D { - .pmp_region_count =3D NULL, - .pmp_region_info =3D NULL, + .early_init =3D NULL, .final_init =3D NULL, + .early_exit =3D NULL, + .final_exit =3D NULL, + .domains_root_regions =3D NULL, + .domains_init =3D NULL, .console_putc =3D NULL, .console_getc =3D NULL, .console_init =3D NULL, .irqchip_init =3D NULL, + .irqchip_exit =3D NULL, .ipi_send =3D NULL, .ipi_clear =3D NULL, .ipi_init =3D NULL, + .ipi_exit =3D NULL, + .get_tlbr_flush_limit =3D NULL, .timer_value =3D NULL, .timer_event_stop =3D NULL, .timer_event_start =3D NULL, .timer_init =3D NULL, - .system_reboot =3D NULL, - .system_shutdown =3D NULL + .timer_exit =3D NULL, + .system_reset_check =3D NULL, + .system_reset =3D NULL, }; =20 -const struct sbi_platform platform =3D { - .opensbi_version =3D OPENSBI_VERSION, // The O= penSBI version this platform table is built bassed on. - .platform_version =3D SBI_PLATFORM_VERSION(0x0000, 0x0000), // SBI P= latform version 1.0 - .name =3D "NULL platform", +struct sbi_platform platform =3D { + .opensbi_version =3D OPENSBI_VERSION, + .platform_version =3D SBI_PLATFORM_VERSION(0x0, 0x01), + .name =3D "NULL Platform", .features =3D 0, .hart_count =3D 0, + .hart_index2id =3D 0, .hart_stack_size =3D 0, - .disabled_hart_mask =3D 0, - .platform_ops_addr =3D 0 + .platform_ops_addr =3D 0, }; diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform= /RISC-V/PlatformPkg/Universal/Sec/SecMain.c index 0af0b4bac831..e9f030f35280 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c @@ -21,6 +21,7 @@ #include // Reference to header file in opensbi #include // Reference to header file in opensbi #include // Reference to header file in opensbi +#include // Reference to header file in opensbi =20 // // Indicates the boot hart (PcdBootHartId) OpenSBI initialization is done. @@ -434,7 +435,7 @@ EFI_STATUS EFIAPI TemporaryRamDone ( STATIC int SbiEcallFirmwareHandler ( IN unsigned long ExtId, IN unsigned long FuncId, - IN unsigned long *Args, + IN CONST struct sbi_trap_regs *TrapRegs, OUT unsigned long *OutVal, OUT struct sbi_trap_info *OutTrap ) @@ -446,7 +447,7 @@ STATIC int SbiEcallFirmwareHandler ( *OutVal =3D (unsigned long) sbi_scratch_thishart_ptr(); break; case SBI_EXT_FW_MSCRATCH_HARTID_FUNC: - *OutVal =3D (unsigned long) sbi_hartid_to_scratch (Args[0]); + *OutVal =3D (unsigned long) sbi_hartid_to_scratch (TrapRegs->a0); break; default: Ret =3D SBI_ENOTSUPP; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/Open= sbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Boa= rd/Library/OpensbiPlatformLib/Platform.c index ed4b1550bca9..b346eccaf0c8 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlat= formLib/Platform.c +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlat= formLib/Platform.c @@ -111,30 +111,6 @@ static int U500_final_init(bool cold_boot) return 0; } =20 -static u32 U500_pmp_region_count(u32 hartid) -{ - return 1; -} - -static int U500_pmp_region_info(u32 hartid, u32 index, - ulong *prot, ulong *addr, ulong *log2size) -{ - int ret =3D 0; - - switch (index) { - case 0: - *prot =3D PMP_R | PMP_W | PMP_X; - *addr =3D 0; - *log2size =3D __riscv_xlen; - break; - default: - ret =3D -1; - break; - }; - - return ret; -} - static int U500_console_init(void) { unsigned long peri_in_freq; @@ -196,15 +172,12 @@ static int U500_timer_init(bool cold_boot) */ static u32 u500_hart_index2id[U500_BOOTABLE_HART_COUNT] =3D {0, 1, 2, 3}; =20 -static int U500_system_reset(u32 type) +static void U500_system_reset(u32 type, u32 second_param) { /* For now nothing to do. */ - return 0; } =20 const struct sbi_platform_operations platform_ops =3D { - .pmp_region_count =3D U500_pmp_region_count, - .pmp_region_info =3D U500_pmp_region_info, .final_init =3D U500_final_init, .console_putc =3D sifive_uart_putc, .console_getc =3D sifive_uart_getc, diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU5= 40HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c index fe6e2a8c943a..ac76f073ab53 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include #include @@ -71,7 +73,7 @@ unsigned long fw_platform_init(unsigned long arg0, unsign= ed long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { - const char *model, *mmu_type; + const char *model; void *fdt =3D (void *)arg1; u32 hartid, hart_count =3D 0; int rc, root_offset, cpus_offset, cpu_offset, len; @@ -101,10 +103,6 @@ unsigned long fw_platform_init(unsigned long arg0, uns= igned long arg1, if (SBI_HARTMASK_MAX_BITS <=3D hartid) continue; =20 - mmu_type =3D fdt_getprop(fdt, cpu_offset, "mmu-type", &len); - if (!mmu_type || !len) - hartid =3D -1U; - generic_hart_index2id[hart_count++] =3D hartid; } =20 @@ -152,6 +150,7 @@ static int generic_final_init(bool cold_boot) =20 fdt_cpu_fixup(fdt); fdt_fixups(fdt); + fdt_domain_fixup(fdt); =20 if (generic_plat && generic_plat->fdt_fixup) { rc =3D generic_plat->fdt_fixup(fdt, generic_plat_match); @@ -174,6 +173,11 @@ static void generic_final_exit(void) generic_plat->final_exit(generic_plat_match); } =20 +static int generic_domains_init(void) +{ + return fdt_domains_populate(sbi_scratch_thishart_arg1_ptr()); +} + static u64 generic_tlbr_flush_limit(void) { if (generic_plat && generic_plat->tlbr_flush_limit) @@ -181,35 +185,20 @@ static u64 generic_tlbr_flush_limit(void) return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT; } =20 -static int generic_system_reset(u32 reset_type) -{ - if (generic_plat && generic_plat->system_reset) - return generic_plat->system_reset(reset_type, - generic_plat_match); - return fdt_system_reset(reset_type); -} - const struct sbi_platform_operations platform_ops =3D { .early_init =3D generic_early_init, .final_init =3D generic_final_init, .early_exit =3D generic_early_exit, .final_exit =3D generic_final_exit, - .console_putc =3D fdt_serial_putc, - .console_getc =3D fdt_serial_getc, + .domains_init =3D generic_domains_init, .console_init =3D fdt_serial_init, .irqchip_init =3D fdt_irqchip_init, .irqchip_exit =3D fdt_irqchip_exit, - .ipi_send =3D fdt_ipi_send, - .ipi_clear =3D fdt_ipi_clear, .ipi_init =3D fdt_ipi_init, .ipi_exit =3D fdt_ipi_exit, .get_tlbr_flush_limit =3D generic_tlbr_flush_limit, - .timer_value =3D fdt_timer_value, - .timer_event_stop =3D fdt_timer_event_stop, - .timer_event_start =3D fdt_timer_event_start, .timer_init =3D fdt_timer_init, .timer_exit =3D fdt_timer_exit, - .system_reset =3D generic_system_reset, }; =20 struct sbi_platform platform =3D { diff --git a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.= c b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c index e98c8523a3f3..7bc73a0b82de 100644 --- a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c +++ b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c @@ -19,6 +19,21 @@ #define UART_REG_IP 5 #define UART_IP_RXWM 0x02 =20 + +#define UART_REG_TXFIFO 0 +#define UART_REG_RXFIFO 1 +#define UART_REG_TXCTRL 2 +#define UART_REG_RXCTRL 3 +#define UART_REG_IE 4 +#define UART_REG_IP 5 +#define UART_REG_DIV 6 + +#define UART_TXFIFO_FULL 0x80000000 +#define UART_RXFIFO_EMPTY 0x80000000 +#define UART_RXFIFO_DATA 0x000000ff +#define UART_TXCTRL_TXEN 0x1 +#define UART_RXCTRL_RXEN 0x1 + //--------------------------------------------- // UART Settings //--------------------------------------------- @@ -28,6 +43,68 @@ =20 BOOLEAN Initiated =3D FALSE; =20 +/** + Get value from serial port register. + + @param RegIndex Register index + + @retval Vale returned from from serial port. + +**/ +UINT32 GetReg ( + IN UINT32 RegIndex + ) +{ + return MmioRead32 (FixedPcdGet32(PcdU5UartBase) + (RegIndex * 0x4)); +} + +/** + Set serial port register. + + @param RegIndex Register index + @param Value Value write to Register + +**/ +VOID SetReg ( + IN UINT32 RegIndex, + IN UINT32 Value + ) +{ + MmioWrite32 (Value, FixedPcdGet32(PcdU5UartBase) + (RegIndex * 0x4)); +} + +/** + Character output to serial port. + + @param Ch The character to serial port. + +**/ +VOID SifiveUartPutChar ( + IN UINT8 Ch + ) +{ + while (GetReg (UART_REG_TXFIFO) & UART_TXFIFO_FULL); + + SetReg (UART_REG_TXFIFO, Ch); +} + +/** + Get character from serial port. + + @retval character The character from serial port. + +**/ +UINT32 SifiveUartGetChar (VOID) +{ + UINT32 Ret; + + Ret =3D GetReg (UART_REG_RXFIFO); + if (!(Ret & UART_RXFIFO_EMPTY)) { + return Ret & UART_RXFIFO_DATA; + } + return -1; +} + /** Initialize the serial device hardware. =20 @@ -88,7 +165,7 @@ SerialPortWrite ( } =20 for(Index =3D 0; Index < NumberOfBytes; Index ++) { - sifive_uart_putc (Buffer [Index]); + SifiveUartPutChar (Buffer [Index]); } =20 return Index; @@ -119,7 +196,7 @@ SerialPortRead ( } =20 for (Index =3D 0; Index < NumberOfBytes; Index ++) { - Buffer [Index] =3D (UINT8)sifive_uart_getc (); + Buffer [Index] =3D (UINT8)SifiveUartGetChar (); } =20 return Index; diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S b= /Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S index 0e3940180d44..a8157c896e6f 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S @@ -21,6 +21,8 @@ .text .align 3 =20 + .globl _start_warm + ASM_FUNC (_ModuleEntryPoint) /* * Jump to warm-boot if this is not the selected core booting, --=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 (#82278): https://edk2.groups.io/g/devel/message/82278 Mute This Topic: https://groups.io/mt/86432330/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- From nobody Tue May 7 05:34:20 2024 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+82282+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+82282+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 1634615456904324.89096022237095; Mon, 18 Oct 2021 20:50:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ncL5YY1788612xJucxgBkh1n; Mon, 18 Oct 2021 20:50:56 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.5140.1634615450454460452 for ; Mon, 18 Oct 2021 20:50:55 -0700 X-Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J1WKVn006476; Tue, 19 Oct 2021 03:50:50 GMT X-Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0a-002e3701.pphosted.com with ESMTP id 3bs5guyn0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:49 +0000 X-Received: from G1W8108.americas.hpqcorp.net (g1w8108.austin.hp.com [16.193.72.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 5850DC6; Tue, 19 Oct 2021 03:50:49 +0000 (UTC) X-Received: from G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) by G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:49 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.10) by G9W8456.americas.hpqcorp.net (16.216.161.95) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLPxeq9IEZ4n0yOATYO7K8ttxZYtRzKrmRaSm69BuMR72NBw2o4KvDnoO+UTEksBz2XWAJykbp+nX5QyuAXzdzLokLlEMR8/mcE+048v7SYs+80k+h6yeL2RIBfflVhpSPABpED/Xk88ii4UnhVlzPvpQ8kjOUTcmLBHEL6+luAOVs8kaTVV9vCPyDLrRdOSYKyg9XupvCQt3UkPjnkVTx8w/WnoKN/w5dH4ut9L+ARsIozN/xaVV9u4jDrSkjx7b+cGPxaMiYxpTIo+Dnz8zlax9IOPFukburLmVMhl5O7vhSGsI8bkdkg36wKTq74zf8YU3tLXQNf7qIiajJpt7Q== 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=/jrPqnVvZ+6fTJPPs6SzBBxmC3stWpKfZxGoMc0/A+I=; b=ac1UIwKtESWHHXSfO0PL5ghyp4vBr9MDPY+k74vN0sxp5fC/PyRsE5JJdSIH2pAq3avzxElKeb4l6T+JPkmTh8jlAo42dIaAzF1XcwKoHJcz5UcUZ9JebAt8aD10pHFrbUixpjCdwbCR8fzRCXEiHFzTwlV4WwWUAAVPz6qfat2uc7ZFsaisri+T3kadaVWumQWpD7B70pUH4Lr/i2GQzJChhBIaFoZ0t9NGdWMJmIl1lj7e6kkJFIeahm9dGHzQtoNqNr/gPB60lvXJ2eL8vn5epeN1zg3QYiYNWVnNkZoy45dfR3qVFRgAYDYNYnqbCpSwy0ddAahc8Hgk2hXWLg== 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:47 +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:47 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 13/14] RISC-V: Implement ResetSystem RT call Date: Tue, 19 Oct 2021 11:48:48 +0800 Message-ID: <20211019034849.16847-14-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:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26b8d0f1-8f49-4b50-b60c-08d992b3a27b X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:174; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: n7CkJONq2LwBDVmi/13CxbvwbRCj0QAT/W6l2SR0iyyS7g3LdiEEe2woS0CcgXOKlPhfq99lVSlfzwvBqMV/QC/jSS1HOPNR3Iskj5KAgvnUXukShYUoLlMX7emsbDOF1awgXwRKfK3POtspaxii1+6nD552aa+KsodMSmoqxTg/7G1w8hE6eVd43gmnWZKYDL5aBr2Qf3xIVZZgJSVArw/ESa43piik9hhVm1ax1YCTPW2yAiNasIOeCwcZLrxVVtdxOjq5bCfTdP5p42ojQa6M8TSuctczosNJ1jJJ5uO9vflAuGYfcqVfNVytUPv/+k+XWOm0Tfyg6A8QNQaZKsFTI/q6fGcioG9m2DmG/bdnz8I1cM9QPEGNLlRvpb3G4bSCi+5zDP46rK45Uyrxz+XMfFaDSVZxI8Xiz+wwaQ7B2VeY52gENw0H6JKk5MU3H3cUORr6cklWnVoZb0zcqElcznrg4PW3nvoKa+gVocT6maenXIsiqYqw0ie8HIWwKQVokbP0fKapeeRtqxEahBIAaA1lY09UvIf8yjWxx8ldmKzitzEL5W/UypX15R679a3a3fykbElnJZiliFBg8GtvzQO8Q7dgnvXK8gGB+09tDFW5Qknb4C4LOMywqXOuV7vyktI0Hb14hq9/tWOKxRjKgkMfGXX82bQHroH8ZZ09wzB/WxMAp1egKLTjJrDq4tqHpZgpiukr6GpinZBzHQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JWurnslLsSX/gwkWxwvru2SXDNM5xJxoHiZdQ4cUU9vul72Z08eI02ataP43?= =?us-ascii?Q?AIxRhZQgxdVv54FN2BlSoc3C2xCwyWWTG6dMcrSwbjLV0xm5wNQa2sOtYwvF?= =?us-ascii?Q?PeFbenkaXrbuZMavvbvTfVcIIPbPBNfvQd9aGOvDMSErcgDqvZwNK2LhusYZ?= =?us-ascii?Q?tr5iV6dWhTNtxoeWgRcsnPEMMtb1YrsLbOJ7ef8Fo9DOnHgfN7P5nB6DJd2X?= =?us-ascii?Q?QfoyjdWowsq9lJV6EY2/wcBnEE/rFDDg3puiBW8S6ga7MrBeFANg88BycBcJ?= =?us-ascii?Q?jixwX6MZe6uG8H2m6zq8hWDcKoPjd7xo830DB0qyYHmJi+llvFILZXYpeElV?= =?us-ascii?Q?WymIP67NSveAHhg9BPM6jvg76bevGTPVvewLcWFsA36+yKJ+t8surf3NzLk7?= =?us-ascii?Q?KRmdfCXxCctISSkhy4PPwijX5JeBvvEcn8Hq6JqX8mgrQtXqURiupYIuo0qk?= =?us-ascii?Q?vsjcIf/MXmeuPioN0ST37hZBiJLUqk0wBowq7oqgQrqXXhBySK35xgnfzNea?= =?us-ascii?Q?HtJNsOo/lWyZ+xGquMFafXQ76H5QWSVmOBDXGLvaj5cr/aJdpYvhtHqbUoOt?= =?us-ascii?Q?tYzzjPeAPbbFhBYD12e/73VsDOTfexd/aZUfAI1hk8FTRYGsTLyNudDbC6E+?= =?us-ascii?Q?Ee/ysM01XAsE0+rihIwiJA4/QEMnezNNiCVxIoxc0EGJSVUhBYWPaRV9tO7L?= =?us-ascii?Q?NEe7VtavKUtrz/CLM4uJxh/Z0JJaXrnssSfaoLA6/MxGFrUMpy7xrMsyPNF0?= =?us-ascii?Q?RxvNUmcrjr/+5a35AFXOHx40yWLQWBvRqR0EvFssltxS3LuX4Hn+NaMCmcSd?= =?us-ascii?Q?79fgc00hbN62WNablZNhlykYn52MyTGXxsFWYdaRJnL2q2yIJJ+dOdR2/sJH?= =?us-ascii?Q?CKjzJdTRYwWnQYt0xHqtZf8JXahsberd6ic+wuLQNUyRZBQ+4yFaRWUOhplu?= =?us-ascii?Q?qywjsp4VPW63veM/cZ7nxDhe5Oi33jbXFz0NcJcxh7YEZcmwEpT5WqoAvDnd?= =?us-ascii?Q?7jbOasRlD+cmrBDRA1exnmTL8zgmPH3JxQOgy4R41MBs4LibaaUfCkhds0E8?= =?us-ascii?Q?ZQDggiP/1LmD0oTX0q9QuSkxlRdzD3brqvKUCvoqLdQdMlOW4qUdpm1hb/0T?= =?us-ascii?Q?y/6eipEWbeHtlR2Dab6lLof+nNC/AyoPpO63P1QRXT/VMVpTyqE/taHP+cyS?= =?us-ascii?Q?gHPd11ShcnonlC4qgVbsx2o7PAUisYJyGvziaRw8fnIxrykNaVqVh8Bj1rkc?= =?us-ascii?Q?dHPVB+Y6mQRBheNvoNrj6HIyMCyb3rTMIkveg2AIF3bwaWqsDunUnd/xA2n4?= =?us-ascii?Q?GueqkeqW19LLQd4EkvXPLOzl?= X-MS-Exchange-CrossTenant-Network-Message-Id: 26b8d0f1-8f49-4b50-b60c-08d992b3a27b 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:47.5142 (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: k2E3jh+X/20eijGdKghvPcD4iZctpZvOu3l2ndROI5Sj58gQztoncLrq5tNN9IN5Yt/6YiTr3Ew/tU6+392yjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: Lp-6kBmLqELUF_MWjS4o8ta6jGAj4E0P X-Proofpoint-GUID: Lp-6kBmLqELUF_MWjS4o8ta6jGAj4E0P 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: sf2NCaDNLN9s4o9iwIKrcMPSx1787277AA= 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=7o65t3w5e9E3FDank7FlEZl1YITEbDCAt84smU9Q+ac=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=SWcYBE2QPX7wdU1XHBnNkP05Dggna4I5wCDZG4MNyzkeN2uAtk19ZZbFm4Ee8isH/uw X3HbKR/C+GYYJuIZYfW0gmM1ToAJTwND9QW6KVg9zoVTWfzcozpBuTvB6Gnz8yyOHXsgE Tb5hbgtw1pA0c340eC2PddpFM99SUaw0a2I= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615457784100004 Content-Type: text/plain; charset="utf-8" Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc | 1= 2 +- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 1= 2 +- Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.inf | 3= 3 +++++ Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h | 3= 8 +++++- Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c | 12= 8 ++++++++++++++++++++ Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c | 4= 4 ++++++- Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi | = 2 +- 7 files changed, 256 insertions(+), 13 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc b/P= latform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc index 1dc6405a20f0..f14511120e89 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc @@ -237,12 +237,13 @@ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf -!ifdef $(DEBUG_ON_SERIAL_PORT) - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf -!else - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf -!endif + ResetSystemLib|Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetS= ystemLib.inf UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!endif !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf !endif @@ -452,6 +453,7 @@ # Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf =20 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index cc62ad05212a..18a482aba611 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -244,12 +244,13 @@ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf -!ifdef $(DEBUG_ON_SERIAL_PORT) - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf -!else - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf -!endif + ResetSystemLib|Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetS= ystemLib.inf UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!endif !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf !endif @@ -458,6 +459,7 @@ # Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf =20 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystem= Lib.inf b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib= .inf new file mode 100644 index 000000000000..f876ae20560b --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -0,0 +1,33 @@ +## @file +# Library instance for ResetSystem library class for RISC-V using SBI eca= lls +# +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D ResetSystemLib + FILE_GUID =3D 3eff6057-1116-4dcb-837e-c0ef1a120ab1 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ResetSystemLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D RISCV64 +# + +[Sources] + ResetSystemLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec + +[LibraryClasses] + DebugLib + RiscVEdk2SbiLib diff --git a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h = b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h index 66a87cb8c38f..88d957f002eb 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h @@ -1,7 +1,7 @@ /** @file Library to call the RISC-V SBI ecalls =20 - Copyright (c) 2020, Hewlett Packard Development LP. All rights reserved.=
+ Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -474,6 +474,42 @@ SbiRemoteHfenceVvma ( IN UINTN Size ); =20 +/// +/// Firmware System Reset (SRST) Extension +/// + +/** + Reset the system + + The System Reset Extension provides a function that allow the supervisor + software to request system-level reboot or shutdown. The term "system" r= efers + to the world-view of supervisor software and the underlying SBI + implementation could be machine mode firmware or hypervisor. + + Valid parameters for ResetType and ResetReason are defined in sbi_ecall_= interface.h + + #define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0 + #define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1 + #define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2 + + #define SBI_SRST_RESET_REASON_NONE 0x0 + #define SBI_SRST_RESET_REASON_SYSFAIL 0x1 + + When the call is successful, it will not return. + + @param[in] ResetType Typ of reset: Shutdown, cold-, or warm-= reset. + @param[in] ResetReason Why the system resets. No reason or sys= tem failure. + @retval EFI_INVALID_PARAMETER Either ResetType or ResetReason is inva= lid. + @retval EFI_UNSUPPORTED ResetType is valid but not implemented = on the platform. + @retval EFI_DEVICE_ERROR Unknown error. +**/ +EFI_STATUS +EFIAPI +SbiSystemReset ( + IN UINTN ResetType, + IN UINTN ResetReason + ); + /// /// Vendor Specific extension space: Extension Ids 0x09000000 through 0x09= FFFFFF /// diff --git a/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystem= Lib.c b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c new file mode 100644 index 000000000000..67e40151d171 --- /dev/null +++ b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -0,0 +1,128 @@ +/** @file + Reset System Library functions for RISC-V + + Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +/** + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type = of reset + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold= reset. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ) +{ + // Warm Reset via SBI ecall + SbiSystemReset (SBI_SRST_RESET_TYPE_COLD_REBOOT, SBI_SRST_RESET_REASON_N= ONE); +} + +/** + This function causes a system-wide initialization (warm reset), in which= all processors + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm= reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ) +{ + // Warm Reset via SBI ecall + SbiSystemReset (SBI_SRST_RESET_TYPE_WARM_REBOOT, SBI_SRST_RESET_REASON_N= ONE); +} + +/** + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shut= down reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + // Shut down via SBI ecall + SbiSystemReset (SBI_SRST_RESET_TYPE_SHUTDOWN, SBI_SRST_RESET_REASON_NONE= ); +} + +/** + This function causes a systemwide reset. The exact type of the reset is + defined by the EFI_GUID that follows the Null-terminated Unicode string = passed + into ResetData. If the platform does not recognize the EFI_GUID in Reset= Data + the platform must pick a supported reset type to perform. The platform m= ay + optionally log the parameters from any non-normal reset that occurs. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated str= ing, + followed by the EFI_GUID. +**/ +VOID +EFIAPI +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData + ) +{ + // + // Can map to OpenSBI vendor or platform specific reset type. + // + return; +} + +/** + The ResetSystem function resets the entire platform. + + @param[in] ResetType The type of reset to perform. + @param[in] ResetStatus The status code for the reset. + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm,= or EfiResetShutdown + the data buffer starts with a Null-terminated = string, optionally + followed by additional binary data. The string= is a description + that the caller may use to further indicate th= e reason for the + system reset. +**/ +VOID +EFIAPI +ResetSystem ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ) +{ + switch (ResetType) { + case EfiResetWarm: + ResetWarm (); + break; + + case EfiResetCold: + ResetCold (); + break; + + case EfiResetShutdown: + ResetShutdown (); + return; + + case EfiResetPlatformSpecific: + ResetPlatformSpecific (DataSize, ResetData); + return; + + default: + return; + } +} diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2S= biLib.c b/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiL= ib.c index 9bbeaaec3f7a..319526ed8f9f 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c @@ -15,7 +15,7 @@ - SbiLegacyRemoteSfenceVmaAsid -> Use SbiRemoteSfenceVmaAsid - SbiLegacyShutdown -> Wait for new System Reset extension =20 - Copyright (c) 2020, Hewlett Packard Development LP. All rights reserved.=
+ Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Revision Reference: @@ -715,6 +715,48 @@ SbiRemoteHFenceVvma ( return TranslateError (Ret.Error); } =20 +/** + Reset the system + + The System Reset Extension provides a function that allow the supervisor + software to request system-level reboot or shutdown. The term "system" r= efers + to the world-view of supervisor software and the underlying SBI + implementation could be machine mode firmware or hypervisor. + + Valid parameters for ResetType and ResetReason are defined in sbi_ecall_= interface.h + + #define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0 + #define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1 + #define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2 + + #define SBI_SRST_RESET_REASON_NONE 0x0 + #define SBI_SRST_RESET_REASON_SYSFAIL 0x1 + + When the call is successful, it will not return. + + @param[in] ResetType Typ of reset: Shutdown, cold-, or warm-= reset. + @param[in] ResetReason Why the system resets. No reason or sys= tem failure. + @retval EFI_INVALID_PARAMETER Either ResetType or ResetReason is inva= lid. + @retval EFI_UNSUPPORTED ResetType is valid but not implemented = on the platform. + @retval EFI_DEVICE_ERROR Unknown error. +**/ +EFI_STATUS +EFIAPI +SbiSystemReset ( + IN UINTN ResetType, + IN UINTN ResetReason + ) +{ + SbiRet Ret =3D SbiCall ( + SBI_EXT_SRST, + SBI_EXT_SRST_RESET, + 2, + ResetType, + ResetReason + ); + return TranslateError (Ret.Error); +} + // // SBI interface function for the vendor extension // diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi b/= Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi index a731c7e36988..937caee08331 160000 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi @@ -1 +1 @@ -Subproject commit a731c7e36988c3308e1978ecde491f2f6182d490 +Subproject commit 937caee0833115f69d697ca190001ba0aa5c7368 --=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 (#82282): https://edk2.groups.io/g/devel/message/82282 Mute This Topic: https://groups.io/mt/86432336/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- From nobody Tue May 7 05:34:20 2024 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+82280+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+82280+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 1634615454161319.8536689286783; Mon, 18 Oct 2021 20:50:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id R8eEYY1788612xA01CzJ0Vwf; Mon, 18 Oct 2021 20:50:53 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.5001.1634615452765701274 for ; Mon, 18 Oct 2021 20:50:52 -0700 X-Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ILhX5G013341; Tue, 19 Oct 2021 03:50:52 GMT X-Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsd6x3c98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:52 +0000 X-Received: from G9W8453.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.160.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 8E31BC6; Tue, 19 Oct 2021 03:50:51 +0000 (UTC) X-Received: from G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) by G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:51 +0000 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.13) 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:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RR2fEo4YFcCEqDvUym2aTlcmLNaDcmsjzS1BtaHuj3C9qy65xj3Ff+z4ViMzBbG4wEaQI9pKOZA7AiN/huDQPmYYzyD6qTiXSxkD7slZrPxII4zYaUMAYMTSImPUYPC0oZf5qcEfTbgUaYWLt4kbWL00kYdwPxFddF8FjYCm+j0SzlnvQzdxbQiWkAQuR0i9z6rBJrXsLzb+MVUjlTcD1GxPbkMx2RMAobLlZWWw14X2kRvhjuE0xnkV7WhdzVN9c4Wb4u32n5V7PDlQQJCqjPeeFr3wnVtQ/Uqm77+r6RNPZQBVBRGouriiaWBj5lZPHmk43zqiAgdGU7OTA+kAbA== 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=/lNQ2OF1XFr9BoW7DU60Rbs6I/CQ2Q8A/y+kvae00v4=; b=Nk+d76jPP4na30fqyagYL0GKtM0yd3pn/wmFNba4l6i1FdPIGGLqba3Hv1mfyltVKJJLcmx0r0bL6+m/X53DHlyKfhKItmlpskCCimQi8NA0qoAIqlbdadvr7C0D7fRGTY88Ax5E6EdYH3xezdSm/0BejlKD+HExVTfjId7jsaFhgmjw5kE/wYkMOADn2Nj7iXmXSXMTneD+kuEVglfiD5jNPd0K2oRL7kwKAt9Hv0aN8AgtQtQe0RSAiQiH7BBvIdQKHV6yzl+a2OcDhykQVZzPxPkDhUK2dE/0iplw7k1s0UbJa5H05Vgur23+p/0lnA+N4KY6uB+yd4vbfSR71A== 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:50 +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:50 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-devel] [edk2-platforms] [PATCH v3 14/14] Move OpenSbiPlatformLib to RISC-V/PlatformPkg Date: Tue, 19 Oct 2021 11:48:49 +0800 Message-ID: <20211019034849.16847-15-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:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77819aa9-5baf-425c-db85-08d992b3a401 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: lBmE3Lg2jFhH1Iq5nUFhxJryNgEltDCg7OTRYJIdN+iSKvBOw1URcXJ/dXn2RMWGok9eXw/BU28+5jwsbAuZV4oJWyqhEsETO/lQphcH6OkaXotWUF35zdilMyYSaxZrSPzxQXRaYeRT3SYP9llU+ClmwipTCzQMObq66/e5cjsI8U+yyQdsPRQrLkEO6ZLBpMvrEdIra5O2dEqtqObv0qMNDexSG+TlBlb7AbRliIz4LurrufPW4CrdbGmCZpDtpIY1hVDBsX2YPiV//D3xTpd7gjpinYinuTolx2P8gQXJlEp40QnhJEE7iWOjyZOKXKQxtl/k0975vg22Q/WxBTly4Tn+BfF9xWGSk0WfpWx5k8I1jeE2SEzbC9pgWCAOqFpXugKKjKWt2pXNUbuWstVW7pIA8Ts8I66iXRgL+ddkIilL8+Px0ZTlrHDykSqJPMeWPANK00Vi5U2Wc9+hZDZahG/ltv7RRwhl82kAYn3Fu5ihzcZX6l9ppz707bjokXh8oeV0ikxJ+HUWRbp1x9DenCYMV3M+AaUvZ70835CrmsOysYDcRtwo3S41KPdulSHoymgodmQN+X10DeVDmxgdgdethAbfWR1/StZGryRC2M9U8lHh6PrNoMv34iIvRVIeV2IxuBLyxfPXxacONc72XdrO5/yEEo0m+RPqCBhrHLe4695cUCEcVIz/B8P0+7PfGyNLHec1GZhRmxJitA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ACWRTXdUwdNRUwvNeDfcFmgH3GwUAZMIPOOFNu8HcqwXFYV5NR3dLghRM2r7?= =?us-ascii?Q?xG3wRvHeaehkPmjghk3etNBuIldIcMvly2t764q9XbwLNNfDFzLz+nIeib0O?= =?us-ascii?Q?2RFTOc2gfLVYXfsRC9aPxSTH2h8mZ0cfKIatUnpZPyJnKvQYO7aILAQJ0cRA?= =?us-ascii?Q?/8+uvpnEU7KPmmanq0VYW2qRPsdE0Bebj02hFpFrsvwIN2iH6BKXX1L6TYe8?= =?us-ascii?Q?RsT7T/vMVHQ4XKWYPXZu+S8xJNUMc/GijRqbE2V4mOyBbqq6a75UkHk9QFSZ?= =?us-ascii?Q?VoFEW/sTMRE8y9hpxJEFdzEoR+y25rEX2UZqObaaqa3JOIXE32SSFUuy+Ff3?= =?us-ascii?Q?2owkhU/ELDc5zdmf193miOSTT4PTHw6UoKCcJeXQiveOw1EiB3mqYOURFz3J?= =?us-ascii?Q?F55vPQ2nksPpNm/VWaubnG/VqYXNm0KE9P00+a0OeTePP6iddWXOnYwJN2kv?= =?us-ascii?Q?URtgsn/Az7kGWQ9YgHfHpFGC0ThtO1V886kW7RhNuA5h6C8mrdhjCcz9OCbX?= =?us-ascii?Q?gv7WDdi8y1C3McOkglVxiYUTQTRc7zutPKRa6e7VJNJokFwGhDEdGI5kGTj5?= =?us-ascii?Q?dyMK4eBRxYZ2C/6QAFtbQn/slPNJrThCkl565GPoIgrEy1tXXGxi3G65RUZv?= =?us-ascii?Q?jFEXBqH03ERy4F4E+U1m1+4NdQpIS6Cdg7b2HG71ryQ1j2TSBxHV0M83EF37?= =?us-ascii?Q?X4gVtdnxPlJdN9TytfZ4I7KcHtR5Z3qtHyinL8uveVIR5iXQSMmK9NVhJdKR?= =?us-ascii?Q?MRT9LXyKKgBd9x9DwIRwS4XJ9PIhPZktkO0DVE/Fxhr1OiOqA5HNFy5kOk2+?= =?us-ascii?Q?XOtiQY8bzu3+CQer6Gy059e4Csb4xIDfdoT4kqZeRz0Z99A1bBUx8VgzMODd?= =?us-ascii?Q?ylSb6h/oyHgrKCLK4OmoFP877sRMztvMalbDOsX34QBDG7Z4IZSXtVEGV8+p?= =?us-ascii?Q?Txw25ikc6P1nxuRCmfVopQCSDv7j01mlS9gg+k1YROeIxQgrlzNHbJwfJ+pU?= =?us-ascii?Q?+UpQluXAR/MI6vwoVcID69H7demz4EgZS2b0BjZX2T1U565OjTJikN+JwHgZ?= =?us-ascii?Q?F4N1RsaJ16krt/WB6nPlOoa/Ju928mmwr5s2OzbRjU6AidZMxhh+1eBTJPU6?= =?us-ascii?Q?BHbACP/N2xPhwenNXqd3p+/3O0c9LdX98vrE+F+libK1nto2axjfAOKvTwrh?= =?us-ascii?Q?jwrQH83iAiNFd/xUq39JqmDTFbnAVWb3hAzmgszad/IlrS1vc3mX1Gvbf9Vy?= =?us-ascii?Q?N5/Z9vH6xZkMU4uhy6CuUfBNxt8G2OCy3HOKxMmbOK9DZ2//52TuXRUFkOoJ?= =?us-ascii?Q?S/uD7+kUrzV4zByv5+bAtMeN?= X-MS-Exchange-CrossTenant-Network-Message-Id: 77819aa9-5baf-425c-db85-08d992b3a401 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:49.9961 (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: iTafXe6Ryq3ZOfEu342l8rxZPewLGJ6IXXnYloobb3Xbo/xSkNtn+Oe7dIZyC5WDqe/Td29XA4UaK1gXH/nHuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: 5MqAWPOsHXWzB2ZxSiKPfJtPi5eyh8WY X-Proofpoint-ORIG-GUID: 5MqAWPOsHXWzB2ZxSiKPfJtPi5eyh8WY 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: 3ChxjF88qwlsE6OTFRrfFDCnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634615453; bh=gIq7MdM6xB4munab40aIAp3M/6TyWZLSxFDd2bObd6M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=eSdYVVGiUQwau/JNQLvcvYsQsq3jVcPZxSuLxvxj0AViVAtM2UDwxlBTlndnjv89duk lJVIOJusorJ6pXihD8fQTU8I29hIsUdx7jaZ8b3dlBwa0HzHV/Mvjl/vZiIk5c67uWDHu pUq4RQ2NZm1bUboB67nqX1I7Fvg0IEtxKB4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634615455582100009 Content-Type: text/plain; charset="utf-8" It's a generic platform file. Only the device tree decides what happens. 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 +- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf | 0 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/PlatformOverride.h | 0 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/Platform.c | 13 ++++++++= ++++- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/SifiveFu540.c | 0 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 18a482aba611..5d2ccafacaf3 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -173,7 +173,7 @@ # # OpenSBi Platform Library # - RiscVOpensbiPlatformLib|Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnl= eashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf + RiscVOpensbiPlatformLib|Platform/RISC-V/PlatformPkg/Library/OpensbiPlatf= ormLib/OpensbiPlatformLib.inf =20 [LibraryClasses.common.PEI_CORE] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/RISC-V/PlatformP= kg/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/OpensbiPlatformLib.inf rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPla= tformLib.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/PlatformOverride.h b/Platform/RISC-V/PlatformPkg/L= ibrary/OpensbiPlatformLib/PlatformOverride.h similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/PlatformOverride.h rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/PlatformOv= erride.h diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/Platform.c b/Platform/RISC-V/PlatformPkg/Library/O= pensbiPlatformLib/Platform.c similarity index 88% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/Platform.c rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c index ac76f073ab53..c4cf6782bd1f 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c @@ -201,13 +201,24 @@ const struct sbi_platform_operations platform_ops =3D= { .timer_exit =3D fdt_timer_exit, }; =20 +#if FixedPcdGet32(PcdBootableHartNumber) =3D=3D 4 +#define U540_BOOTABLE_HART_COUNT FixedPcdGet32(PcdBootableHartNumber) +static u32 U540_hart_index2id[U540_BOOTABLE_HART_COUNT] =3D {1, 2, 3, 4}; +#endif + struct sbi_platform platform =3D { .opensbi_version =3D OPENSBI_VERSION, .platform_version =3D SBI_PLATFORM_VERSION(0x0, 0x01), .name =3D "Generic", .features =3D SBI_PLATFORM_DEFAULT_FEATURES, .hart_count =3D SBI_HARTMASK_MAX_BITS, +// TODO: Workaround for U540. Not sure why we need this. OpenSBI doesn't n= eed it. +#if FixedPcdGet32(PcdBootableHartNumber) =3D=3D 4 + .hart_index2id =3D U540_hart_index2id, +#else .hart_index2id =3D generic_hart_index2id, - .hart_stack_size =3D SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, +#endif + // TODO: Any reason why it shouldn't just be SBI_PLATFORM_DEFAULT_HART_S= TACK_SIZE? + .hart_stack_size =3D FixedPcdGet32(PcdOpenSbiStackSize), .platform_ops_addr =3D (unsigned long)&platform_ops }; diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/SifiveFu540.c b/Platform/RISC-V/PlatformPkg/Librar= y/OpensbiPlatformLib/SifiveFu540.c similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/SifiveFu540.c rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu54= 0.c --=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 (#82280): https://edk2.groups.io/g/devel/message/82280 Mute This Topic: https://groups.io/mt/86432332/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-