From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.94]) by mx.groups.io with SMTP id smtpd.web12.9719.1637167842194444383 for ; Wed, 17 Nov 2021 08:50:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=VKDQkd78; spf=pass (domain: os.amperecomputing.com, ip: 40.107.220.94, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hJr2oRoeCy8SYAqCuhyuljZzCL9n/UB6vwS1Zz4SDxuAh0t5xcKIajeLz0bLeXopFCp7fdpz5OxY1frEAsr9yvUpeQiHPv4kWZ1sZePdea/vS7HXQ0Ap3TkpmxAON33dEPgCq3PwcOWH6mA8ZKTlIHeJsEjmIbA0pBJ8wh1/EDDqrLd8/Zb/g9S1sHs0RrMHDJZd0gYGP1NRnboZDmZkj2XKUlqMG7hVhkZa+v/kMqM24+8vfczn+WH91Hr0mKbD0OJ8gQe+9+9MIxIeku10v/5DUW4bIaKCspkkqAsgWJn5Ifo0Alfkn+NQQ5dFUGefpgV57daYj9rcpE2EhY9cPQ== 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=esSI/ua7cPEA5mv8OHPRPS+Tc+yKSEdZ99JNT2YWlxc=; b=Wc3135KJmydScbe0gJehnfgi4ipFQP0NvZQOQBg6UFkcxvZYaXKkd5ObWy3qP1ENbU3bE8a5d2HSO+3sCGRBQoR42xBxS2mWj/SC8ws+QtMrj1l97bDKV8KiqLpIMy1Et4CIR8gaf3X//Z6SfMizeXshH+H/hdSl+doQu3ZPN6duiJaps38Y50PXBKSnh7wQUtRNPEBx8vnPvLI1X3lNrxD9vK7/hx/ty6ytyC2s7Jqvo52cTo2TatkMyi9cLoSfV4zm/9qLpkOiKcJh76Rku26gdbVWGnFuwFwyQUN1y8sEALaUADJ1LZ3we7G97aO3bh31xvPrrSnkGtcbbQsNZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=esSI/ua7cPEA5mv8OHPRPS+Tc+yKSEdZ99JNT2YWlxc=; b=VKDQkd7818ryUnnKIJsFe/kw+kjZ/e5wLnpFUH7yo0AgeLamkr1lnJTHB294s6f/KX+FiRyFLm0jqR2zp1bJA9QygKspr9PZLnEoIowlty5ABxH9beqM8YZLlNrtjfLD9EMM6h2tHytQGywT18LGzeq6M7en5FAwZnEzeFpiUG8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:50:40 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:40 +0000 From: "Nhi Pham" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-platforms][PATCH v5 20/30] AmpereAltraPkg: Add Random Number Generator Support Date: Wed, 17 Nov 2021 23:47:17 +0700 Message-ID: <20211117164727.10922-21-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b520804-f526-412e-9aac-08d9a9ea630e X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: 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: BCL:0; X-Microsoft-Antispam-Message-Info: tGYvSQlDBe9PoWvU+3Ps9v0zz6OA8yvJ8CqDXVGrRPdQTkwx2x6N0SpXSoZD0y6UUlNCVd4uwjRX01KjRz2Vl7TQogJceYxsJJmOUqKhJB4z9TRCFbQWsATWp8zkyybqhumQbm1QrAFdtVDN2fu6+naJFBrcVDkFNWPtMWA9OChZ2zawA5Z9DoBaGiWIwPtYCdFfv3kSgBcLkPP1sWAYD6tbGrcXmVuqh3rhqeJIlspFQRbspvk1yMfIIsutOIo7q5fM3SA5D02dQIg8qGY3NtfVHO9e11WXqz7Y/ZjWhNL4T4BCJ4WHqOnCTMSzN5kfPqKyCHt3+9ZrZngy1mRWORiQRRkEkcxnKzdFXaplzyCNaYtDKXNkFW+38MdORv+mnexvNCIgg7ID2GsAhQEVVWTqMRap4nRj2/QO+2YiZ6K2CnCTBLE4eF5S5y9ruyd527n5QU88hht11vx6XTbOYOa0ZTirJvKQuGwV5CPSfIdcMzBdWeIiVV4dYyToIn7eW9I+G0xj3xQtOKhU5sVBVCWvJGuwboC0Sylc09GMlFkfqV7V89T2kYpepM5Je6b1U3qDUXPjzbY8epsXcRLpKuKjJh6CmosSY8XDUi6i8D2dAy/WNywgmUDp44qvL82n0iYYo9xJyqFhyzb0nSzT7OOOeVY+juLYZzW3KF5K0zfWesbUfdi7U3BORBNvFbgMKzLpxF/TkIICe2iCkzSS34sgXTUp5Jumn/CwicmjArT15ImZ0w45WRU+Qi3OpOgkWj89IvneVJzWYL5Q5OivrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(956004)(508600001)(186003)(38100700002)(6666004)(83380400001)(6486002)(52116002)(66476007)(66946007)(2616005)(66556008)(1076003)(54906003)(8676002)(38350700002)(4326008)(316002)(6512007)(8936002)(2906002)(6916009)(5660300002)(6506007)(86362001)(26005)(44824005)(14943795004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?X2eCDGgFYUzn+OfKb6HsFpY3XvQCnVQZj90ngMyFJI+6yHkgEEtvyJoFNpLV?= =?us-ascii?Q?3A31l8w9BSP/HVO48hkWPpbR/grQnu1l5CCoQ1PIirvisUTvqLxVuiKzOZGp?= =?us-ascii?Q?cHetDy4vYnoTvP+nhDT80ttGNfb/EuR7x6cMOW0Jl2pqObx6KuzCfNV/kaKt?= =?us-ascii?Q?aZhX4FNWngmuyIFXdNXyJbrEZJAe4SKLyH37dlgnA5j5kht6SyGNjRHZtWNH?= =?us-ascii?Q?I6DDXE4eZxEtBTZpCYSdu9y4qpkDb37wnpthX6l3O6NnTbTxt25kIbS1dqQt?= =?us-ascii?Q?g0Fljdug3BcgLI/B8x9IcdH0bVqJ2TiTJdFOHovSqi0J/2zGRibwxdlcLF95?= =?us-ascii?Q?lFBq7v+mLWtZVtqoECt6QEZYwkN1b54qKHeKeEMWf8O+rbp2KlbSspTx5Dmf?= =?us-ascii?Q?vktAuas11476IuiOnxY176MPsy+CXRp8eTDPMcqqTMSMW1KnxN9GSKhNGO3y?= =?us-ascii?Q?eamdYzmfQXCVUfMl6i8TQuy4XLDqRbJtRG+QIUAfSDt/dRJwiLeqF89uTWZz?= =?us-ascii?Q?HL/32EQmblEW9nYULC1HQKdLtLeFl9s1FTTZmp9zddL5z+F5vu9lzCWJ0pof?= =?us-ascii?Q?B3+YQ0dHiaLJUN+RHVe50Ksd/+cnxlNVgCJg8zpRVPuUTzrZ4DsHwq5c0oVC?= =?us-ascii?Q?ihLzY/zHcGE/wn0C8f09WV5WTtp+smb3rsUrz47qb6gyOoUcK6NqWi83XijJ?= =?us-ascii?Q?JrfyAf642/l1t18Y8/057+36XFJ4RKF7ZRi53OphoIWVfDMADfgRIpKZisKD?= =?us-ascii?Q?EMayrz1QARO2I1yCljt5ub/0VnfaE/HzZmHgcPjc9OQU581VergG85DEDhvw?= =?us-ascii?Q?sebrGOYOAHqAPwXC9HMfJL7HyDf8bxd3c+zIQ/sZMfHmu5iOa/uf3eqqYdDN?= =?us-ascii?Q?gmJbgZ8ieu2PVQWN0OOmv6x1VYFfqjB7hwFtxPmR40rxtflb+uljY+lajIMo?= =?us-ascii?Q?qiHLJbGDSgnaSmkymj3wqsqfW2Yj0fMSAjo/0D1JDcqrhEylbtvkhfnuWlt1?= =?us-ascii?Q?FiD11yZBTqDxyBD2Fl7cOp3/MsQ/gXpnG7j1c5OM8covwScIwyvIY1tJVJ7a?= =?us-ascii?Q?6ic45IU+vSjuGIWoM7v1CMJiVSrZTf10ZVLleUcJl23PVAs/RldsO2JtIalW?= =?us-ascii?Q?Y9t7ELWD9mlZzFJ1Cl9M+FANE90tLTK2lvC8o0vXBgwnA2813DFszDCbsAiu?= =?us-ascii?Q?DZYcMbae3ufOo9OqRskbMo83TaURMeAy0gw4PYdct6CPPTk/UtUlv8QdCGYv?= =?us-ascii?Q?hrfEquwsBEUM4lNMZ9WjZibgYYkMEQppi7Rb1OQ+soNosSl6ACDEuNU2MbMi?= =?us-ascii?Q?4J1Wk8b4Kp2ZPHYpOg1LAeUE5TUnYG1zbpkah7+fzcCEK4tt+Xj76x4Fs32x?= =?us-ascii?Q?VYc6wSyTn9xpZbmyeLEqmmJ9QUwyXq7wXpa/pOhfplJI4n02ytlJZtuFZs6P?= =?us-ascii?Q?h1VSdC/imhkjnwRPwsJ3hDHeEcwxvoJDrGZDN3vvqnQhGQRXU89MUD7lzRrd?= =?us-ascii?Q?h14Q9yKQeZ41PqhELU9RPbz/KSuGmSGJbyHiBGaqyJme2YLIsh3FohmtRDTz?= =?us-ascii?Q?yvgVxoSMGwXCQTvZnlxLYOww7CUqvqRNlV7P7NsFUTXDxXvuushksF6x8Ibe?= =?us-ascii?Q?Gu7OTUBHr95YKExPiUFZn27cSy/+acwx12M5bx34c+7BCbOcHp0FPnka2TLa?= =?us-ascii?Q?J4iySwDNHUINPIJNZaHfBZsmybM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b520804-f526-412e-9aac-08d9a9ea630e X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:40.1358 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ap4P0wkRZuUOTS67VMYHQRiFXuQyaSS0qtScqh32B/tbG9Ea+AmZi5We8YQ5vklAPhU8e7Eqfo/n8MQ5rlL73u7hY3/cR9lwJVjXzajHDPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This change is to produce RNG protocol which is required by several modules. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf | 43 +++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c | 164 +++++++= +++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni | 10 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni | 9 ++ 6 files changed, 236 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 2f331e41893e..36d96ff9a63f 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -684,6 +684,11 @@ [Components.common] MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf =20 + # + # Random Number Generator Support + # + Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf + # # Bds # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index ebf7d957d70d..b527f9ce7dfa 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -302,6 +302,11 @@ [FV.FvMain] # INF Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf =20 + # + # Random Number Generator Support + # + INF Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf b/Sili= con/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf new file mode 100644 index 000000000000..c5f249e31090 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf @@ -0,0 +1,43 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RngDxe + FILE_GUID =3D 4FCC006E-C740-4027-BC97-787907C8D286 + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RngDriverEntry + MODULE_UNI_FILE =3D RngDxe.uni + +[Sources.common] + RngDxe.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + TrngLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gEfiRngAlgorithmRaw ## SOMETIMES_PRODUCES ## GUID = # Unique ID of the algorithm for RNG + +[Protocols] + gEfiRngProtocolGuid ## PRODUCES + +[UserExtensions.TianoCore."ExtraFiles"] + RngDxeExtra.uni + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c b/Silico= n/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c new file mode 100644 index 000000000000..bb8140cfeb2f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c @@ -0,0 +1,164 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +/** + Returns information about the random number generation implementation. + + @param[in] This A pointer to the EFI_RNG_PROTOCOL in= stance. + @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAl= gorithmList. + On output with a return code of EFI_= SUCCESS, the size + in bytes of the data returned in RNG= AlgorithmList. On output + with a return code of EFI_BUFFER_TOO= _SMALL, + the size of RNGAlgorithmList require= d to obtain the list. + @param[out] RNGAlgorithmList A caller-allocated memory buffer fil= led by the driver + with one EFI_RNG_ALGORITHM element f= or each supported + RNG algorithm. The list must not cha= nge across multiple + calls to the same driver. The first = algorithm in the list + is the default algorithm for the dri= ver. + + @retval EFI_SUCCESS The RNG algorithm list was returned = successfully. + @retval EFI_INVALID_PARAMETER One or more of the parameters are in= correct. + @retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too s= mall to hold the result. + +**/ +EFI_STATUS +EFIAPI +RngGetInfo ( + IN EFI_RNG_PROTOCOL *This, + IN OUT UINTN *RNGAlgorithmListSize, + OUT EFI_RNG_ALGORITHM *RNGAlgorithmList + ) +{ + if (This =3D=3D NULL || RNGAlgorithmListSize =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (*RNGAlgorithmListSize < sizeof (EFI_RNG_ALGORITHM)) { + *RNGAlgorithmListSize =3D sizeof (EFI_RNG_ALGORITHM); + return EFI_BUFFER_TOO_SMALL; + } + + if (RNGAlgorithmList =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *RNGAlgorithmListSize =3D sizeof (EFI_RNG_ALGORITHM); + CopyGuid (RNGAlgorithmList, &gEfiRngAlgorithmRaw); + + return EFI_SUCCESS; +} + +/** + Produces and returns an RNG value using either the default or specified = RNG algorithm. + + @param[in] This A pointer to the EFI_RNG_PROTOCOL in= stance. + @param[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM t= hat identifies the RNG + algorithm to use. May be NULL in whi= ch case the function will + use its default RNG algorithm. + @param[in] RNGValueLength The length in bytes of the memory bu= ffer pointed to by + RNGValue. The driver shall return ex= actly this numbers of bytes. + @param[out] RNGValue A caller-allocated memory buffer fil= led by the driver with the + resulting RNG value. + + @retval EFI_SUCCESS The RNG value was returned successfu= lly. + @retval EFI_UNSUPPORTED The algorithm specified by RNGAlgori= thm is not supported by + this driver. + @retval EFI_DEVICE_ERROR An RNG value could not be retrieved = due to a hardware or + firmware error. + @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength i= s zero. + +**/ +EFI_STATUS +EFIAPI +RngGetRNG ( + IN EFI_RNG_PROTOCOL *This, + IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL + IN UINTN RNGValueLength, + OUT UINT8 *RNGValue + ) +{ + EFI_STATUS Status; + + if (This =3D=3D NULL || RNGValueLength =3D=3D 0 || RNGValue =3D=3D NULL)= { + return EFI_INVALID_PARAMETER; + } + + // + // We only support the raw algorithm, so reject requests for anything el= se + // + if (RNGAlgorithm !=3D NULL && + !CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmRaw)) + { + return EFI_UNSUPPORTED; + } + + Status =3D GenerateRandomNumbers (RNGValue, RNGValueLength); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d Failed to generate a random number. \n", + __FUNCTION__, + __LINE__ + )); + return Status; + } + + return EFI_SUCCESS; +} + +/* + * The Random Number Generator (RNG) protocol + */ +EFI_RNG_PROTOCOL mRng =3D { + RngGetInfo, + RngGetRNG +}; + +/** + The user Entry Point for the Random Number Generator (RNG) driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval EFI_NOT_SUPPORTED Platform does not support RNG. + @retval Other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +EFIAPI +RngDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + // + // Install UEFI RNG (Random Number Generator) Protocol + // + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiRngProtocolGuid, + &mRng, + NULL + ); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni b/Sili= con/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni new file mode 100644 index 000000000000..cd9dde97a236 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni @@ -0,0 +1,10 @@ +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + + +#string STR_MODULE_ABSTRACT #language en-US "Produces UEFI Ran= dom Number Generator protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "This module will = produce UEFI Random Number Generator protocol." diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni b= /Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni new file mode 100644 index 000000000000..9a3696b25442 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni @@ -0,0 +1,9 @@ +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Ampere UEFI Random Number Generator DXE" --=20 2.17.1