From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=JJyn7XQJ; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=092675a635=daniel.schaefer@hpe.com) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=pps0720; bh=/jrPqnVvZ+6fTJPPs6SzBBxmC3stWpKfZxGoMc0/A+I=; b=JJyn7XQJ4GEJdot7EGJ3dPZo0rM4KBMkkoWyaXcJ58DfNMc3nzs7883RR4TuTtcllJq8 84pj+kmET4aZZr5VV8Obuny32YK+luS7tE5BRMFwF4eH0Uf5su+Kw1hQnftrYXCY+mK9 I2s9+bsXvxXrvugEaxTbRzyjEdv9QouV2Br7aOFNgKbC4smMLRYGBXi4L7RyUainbQoV xvUDCOR9eGacqzDXGc593GZqVQn3g0M6WPSfA7PHFC/pKCahNfO6TFTNKec13v7nxNAx U50JCxaYhbOlLLT4T7t/pP8Qbxm4cKLI5kfF+B4rp+tHCMT8PoTPS3999Zm0nOTRMhy0 OQ== 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 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) 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 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 Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) by 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 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-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> X-Mailer: git-send-email 2.31.1 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 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: BCL: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-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(6916009)(956004)(8676002)(54906003)(26005)(66946007)(186003)(66556008)(2616005)(4326008)(30864003)(5660300002)(7696005)(316002)(83380400001)(36756003)(8936002)(6486002)(508600001)(66476007)(86362001)(52116002)(44832011)(82960400001)(2906002)(1076003)(38350700002)(38100700002);DIR:OUT;SFP:1102; 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 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_07,2021-10-18_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110190019 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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= =0D MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf=0D -!ifdef $(DEBUG_ON_SERIAL_PORT)=0D - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D -!else=0D - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D -!endif=0D + ResetSystemLib|Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetS= ystemLib.inf=0D UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D +!endif=0D !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf=0D !endif=0D @@ -452,6 +453,7 @@ #=0D Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf=0D Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf=0D + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf=0D =0D MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf=0D MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {=0D 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= =0D MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf=0D -!ifdef $(DEBUG_ON_SERIAL_PORT)=0D - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D -!else=0D - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D -!endif=0D + ResetSystemLib|Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetS= ystemLib.inf=0D UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D +!endif=0D !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf=0D !endif=0D @@ -458,6 +459,7 @@ #=0D Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe/CpuDxe.inf=0D Silicon/RISC-V/ProcessorPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf=0D + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf=0D =0D MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf=0D MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {=0D 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=0D +# Library instance for ResetSystem library class for RISC-V using SBI eca= lls=0D +#=0D +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D ResetSystemLib=0D + FILE_GUID =3D 3eff6057-1116-4dcb-837e-c0ef1a120ab1= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D ResetSystemLib=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D RISCV64=0D +#=0D +=0D +[Sources]=0D + ResetSystemLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec=0D +=0D +[LibraryClasses]=0D + DebugLib=0D + RiscVEdk2SbiLib=0D 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=0D Library to call the RISC-V SBI ecalls=0D =0D - Copyright (c) 2020, Hewlett Packard Development LP. All rights reserved.=
=0D + Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -474,6 +474,42 @@ SbiRemoteHfenceVvma ( IN UINTN Size=0D );=0D =0D +///=0D +/// Firmware System Reset (SRST) Extension=0D +///=0D +=0D +/**=0D + Reset the system=0D +=0D + The System Reset Extension provides a function that allow the supervisor= =0D + software to request system-level reboot or shutdown. The term "system" r= efers=0D + to the world-view of supervisor software and the underlying SBI=0D + implementation could be machine mode firmware or hypervisor.=0D +=0D + Valid parameters for ResetType and ResetReason are defined in sbi_ecall_= interface.h=0D +=0D + #define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0=0D + #define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1=0D + #define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2=0D +=0D + #define SBI_SRST_RESET_REASON_NONE 0x0=0D + #define SBI_SRST_RESET_REASON_SYSFAIL 0x1=0D +=0D + When the call is successful, it will not return.=0D +=0D + @param[in] ResetType Typ of reset: Shutdown, cold-, or warm-= reset.=0D + @param[in] ResetReason Why the system resets. No reason or sys= tem failure.=0D + @retval EFI_INVALID_PARAMETER Either ResetType or ResetReason is inva= lid.=0D + @retval EFI_UNSUPPORTED ResetType is valid but not implemented = on the platform.=0D + @retval EFI_DEVICE_ERROR Unknown error.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SbiSystemReset (=0D + IN UINTN ResetType,=0D + IN UINTN ResetReason=0D + );=0D +=0D ///=0D /// Vendor Specific extension space: Extension Ids 0x09000000 through 0x09= FFFFFF=0D ///=0D 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=0D + Reset System Library functions for RISC-V=0D +=0D + Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + This function causes a system-wide reset (cold reset), in which=0D + all circuitry within the system returns to its initial state. This type = of reset=0D + is asynchronous to system operation and operates without regard to=0D + cycle boundaries.=0D +=0D + If this function returns, it means that the system does not support cold= reset.=0D +**/=0D +VOID=0D +EFIAPI=0D +ResetCold (=0D + VOID=0D + )=0D +{=0D + // Warm Reset via SBI ecall=0D + SbiSystemReset (SBI_SRST_RESET_TYPE_COLD_REBOOT, SBI_SRST_RESET_REASON_N= ONE);=0D +}=0D +=0D +/**=0D + This function causes a system-wide initialization (warm reset), in which= all processors=0D + are set to their initial state. Pending cycles are not corrupted.=0D +=0D + If this function returns, it means that the system does not support warm= reset.=0D +**/=0D +VOID=0D +EFIAPI=0D +ResetWarm (=0D + VOID=0D + )=0D +{=0D + // Warm Reset via SBI ecall=0D + SbiSystemReset (SBI_SRST_RESET_TYPE_WARM_REBOOT, SBI_SRST_RESET_REASON_N= ONE);=0D +}=0D +=0D +/**=0D + This function causes the system to enter a power state equivalent=0D + to the ACPI G2/S5 or G3 states.=0D +=0D + If this function returns, it means that the system does not support shut= down reset.=0D +**/=0D +VOID=0D +EFIAPI=0D +ResetShutdown (=0D + VOID=0D + )=0D +{=0D + // Shut down via SBI ecall=0D + SbiSystemReset (SBI_SRST_RESET_TYPE_SHUTDOWN, SBI_SRST_RESET_REASON_NONE= );=0D +}=0D +=0D +/**=0D + This function causes a systemwide reset. The exact type of the reset is= =0D + defined by the EFI_GUID that follows the Null-terminated Unicode string = passed=0D + into ResetData. If the platform does not recognize the EFI_GUID in Reset= Data=0D + the platform must pick a supported reset type to perform. The platform m= ay=0D + optionally log the parameters from any non-normal reset that occurs.=0D +=0D + @param[in] DataSize The size, in bytes, of ResetData.=0D + @param[in] ResetData The data buffer starts with a Null-terminated str= ing,=0D + followed by the EFI_GUID.=0D +**/=0D +VOID=0D +EFIAPI=0D +ResetPlatformSpecific (=0D + IN UINTN DataSize,=0D + IN VOID *ResetData=0D + )=0D +{=0D + //=0D + // Can map to OpenSBI vendor or platform specific reset type.=0D + //=0D + return;=0D +}=0D +=0D +/**=0D + The ResetSystem function resets the entire platform.=0D +=0D + @param[in] ResetType The type of reset to perform.=0D + @param[in] ResetStatus The status code for the reset.=0D + @param[in] DataSize The size, in bytes, of ResetData.=0D + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm,= or EfiResetShutdown=0D + the data buffer starts with a Null-terminated = string, optionally=0D + followed by additional binary data. The string= is a description=0D + that the caller may use to further indicate th= e reason for the=0D + system reset.=0D +**/=0D +VOID=0D +EFIAPI=0D +ResetSystem (=0D + IN EFI_RESET_TYPE ResetType,=0D + IN EFI_STATUS ResetStatus,=0D + IN UINTN DataSize,=0D + IN VOID *ResetData OPTIONAL=0D + )=0D +{=0D + switch (ResetType) {=0D + case EfiResetWarm:=0D + ResetWarm ();=0D + break;=0D +=0D + case EfiResetCold:=0D + ResetCold ();=0D + break;=0D +=0D + case EfiResetShutdown:=0D + ResetShutdown ();=0D + return;=0D +=0D + case EfiResetPlatformSpecific:=0D + ResetPlatformSpecific (DataSize, ResetData);=0D + return;=0D +=0D + default:=0D + return;=0D + }=0D +}=0D 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=0D - SbiLegacyShutdown -> Wait for new System Reset extension=0D =0D - Copyright (c) 2020, Hewlett Packard Development LP. All rights reserved.=
=0D + Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.=
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @par Revision Reference:=0D @@ -715,6 +715,48 @@ SbiRemoteHFenceVvma ( return TranslateError (Ret.Error);=0D }=0D =0D +/**=0D + Reset the system=0D +=0D + The System Reset Extension provides a function that allow the supervisor= =0D + software to request system-level reboot or shutdown. The term "system" r= efers=0D + to the world-view of supervisor software and the underlying SBI=0D + implementation could be machine mode firmware or hypervisor.=0D +=0D + Valid parameters for ResetType and ResetReason are defined in sbi_ecall_= interface.h=0D +=0D + #define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0=0D + #define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1=0D + #define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2=0D +=0D + #define SBI_SRST_RESET_REASON_NONE 0x0=0D + #define SBI_SRST_RESET_REASON_SYSFAIL 0x1=0D +=0D + When the call is successful, it will not return.=0D +=0D + @param[in] ResetType Typ of reset: Shutdown, cold-, or warm-= reset.=0D + @param[in] ResetReason Why the system resets. No reason or sys= tem failure.=0D + @retval EFI_INVALID_PARAMETER Either ResetType or ResetReason is inva= lid.=0D + @retval EFI_UNSUPPORTED ResetType is valid but not implemented = on the platform.=0D + @retval EFI_DEVICE_ERROR Unknown error.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SbiSystemReset (=0D + IN UINTN ResetType,=0D + IN UINTN ResetReason=0D + )=0D +{=0D + SbiRet Ret =3D SbiCall (=0D + SBI_EXT_SRST,=0D + SBI_EXT_SRST_RESET,=0D + 2,=0D + ResetType,=0D + ResetReason=0D + );=0D + return TranslateError (Ret.Error);=0D +}=0D +=0D //=0D // SBI interface function for the vendor extension=0D //=0D 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