MdePkg/BaseLib: RISC-V: Add few more helper functions
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076 Few of the basic helper functions required for any RISC-V CPU were added in edk2-platforms. To support qemu virt, they need to be added in BaseLib. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Daniel Schaefer <git@danielschaefer.me> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Acked-by: Abner Chang <abner.chang@amd.com> Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
23
MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
Normal file
23
MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
Normal file
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Read CPU timer
|
||||
//
|
||||
// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <Register/RiscV64/RiscVImpl.h>
|
||||
|
||||
.data
|
||||
.align 3
|
||||
.section .text
|
||||
|
||||
//
|
||||
// Read TIME CSR.
|
||||
// @retval a0 : 64-bit timer.
|
||||
//
|
||||
ASM_FUNC (RiscVReadTimer)
|
||||
csrr a0, CSR_TIME
|
||||
ret
|
Reference in New Issue
Block a user