Add LoongArch gets stable counter ASM function. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang....@intel.com> Signed-off-by: Chao Li <lic...@loongson.cn> Acked-by: Michael D Kinney <michael.d.kin...@intel.com> --- MdePkg/Include/Library/BaseLib.h | 12 ++++++++++ MdePkg/Library/BaseLib/BaseLib.inf | 1 + .../BaseLib/LoongArch64/ReadStableCounter.S | 24 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 3adf4d0042..55d53c75a0 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -281,6 +281,18 @@ AsmCpucfg ( OUT UINT32 *Data ); +/** + Gets the timer count value. + + @param[] VOID + @retval timer count value. + +**/ +UINTN +AsmReadStableCounter ( + VOID + ); + #endif // defined (MDE_CPU_LOONGARCH64) // diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf index a427aa9359..aaf221822b 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -421,6 +421,7 @@ LoongArch64/SwitchStack.S | GCC LoongArch64/ExceptionBase.S | GCC LoongArch64/Cpucfg.S | GCC + LoongArch64/ReadStableCounter.S | GCC [Packages] MdePkg/MdePkg.dec diff --git a/MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S b/MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S new file mode 100644 index 0000000000..59c877211d --- /dev/null +++ b/MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S @@ -0,0 +1,24 @@ +#------------------------------------------------------------------------------ +# +# LoongArch Read Stable Counter +# +# Copyright (c) 2023, Loongson Technology Corporation Limited. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#------------------------------------------------------------------------------ + +ASM_GLOBAL ASM_PFX(AsmReadStableCounter) + +#/** +# Gets the timer count value. +# +# @param[] VOID +# @retval timer count value. +# +#**/ + +ASM_PFX(AsmReadStableCounter): + rdtime.d $a0, $zero + jirl $zero, $ra, 0 + .end -- 2.27.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112397): https://edk2.groups.io/g/devel/message/112397 Mute This Topic: https://groups.io/mt/103129077/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-