mirror of
https://github.com/acidanthera/audk.git
synced 2025-08-15 06:38:08 +02:00
The ratified RISC-V crypto scalar extensions provide entropy bits via the seed CSR, as exposed by the Zkr extension. The Zkr extension is ratified and provides 16 bits of entropy seed when reading the SEED CSR. Guarded by a RISCV64 Feature PCD, 64-bit random numbers can be accumulated from the `seed` CSR. This driver is based on the driver in the Linux kernel. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Co-authored-by: Tim Wawrzynczak <tim@rivosinc.com>
20 lines
501 B
ArmAsm
20 lines
501 B
ArmAsm
//------------------------------------------------------------------------------
|
|
//
|
|
// RISC-V cache operation.
|
|
//
|
|
// Copyright (c) 2024, Rivos Inc. All rights reserved.<BR>
|
|
//
|
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
//
|
|
//------------------------------------------------------------------------------
|
|
|
|
#include <Register/RiscV64/RiscVImpl.h>
|
|
|
|
.text
|
|
.p2align 4
|
|
|
|
ASM_FUNC (ReadSeed)
|
|
#The SEED CSR must only be accessed with read-write instructions
|
|
csrrw a0, CSR_SEED, x0
|
|
ret
|