From nobody Tue Feb 10 19:50:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+110710+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110710+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1699241244; cv=none; d=zohomail.com; s=zohoarc; b=AzNGtErIst90Xt2vWNgrvVeu957yEzN6ZiZ8d12Njur9JLUEYe+GdN9UXm/vKjrHJv93xEVrzcD7nD8j3c0qj6nqC3J6Ppbdrej2HSutDdPxhU9IAn5Q+4xXVbSzsflINtIjYR1nGTo+bQF+Z8liMrLfl+Dluy8jpEdfXxT3Ry4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699241244; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=mdpnk1WWq4wdQQ+QWuIDmrkGl80arMCeOXUu7IwV/DY=; b=kr9F/IKNMGykDPKgMCznhs3NrrncGsu2jMkdBdaCiXPs1IO+EoTlWsew89IySgxIMWyX1uT6TirmRYxVFLOvLT9sOU9gM/s6/sM+u0G/cLYXgF95DvKPilgPcsnt1+kzt7AqbuxEd9IC/MMOhd7tHY0utrXb3z+nGDkJ0lLnZgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110710+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 169924124410879.27591341258221; Sun, 5 Nov 2023 19:27:24 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=H9W0XCBs7T/8dGYX9nYh0wI68TThM6x2EcVlvja5P+s=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699241243; v=1; b=oRyEppCm7xfo2tJF7MEdrIzC9JGtQ+NeBP4tPtBxo5aItR/qzqQzWDME1GqxpN8ZcF8+46Dj hFRq2cGhY+Rj+mK5LzvAD1PkplAKexsOIzM6gIxuS/o859qao4hCna8Mrc+wFhv/ZbUzWXE3Yh3 Epwyv55kJk/c9Gd+ORqbCM4g= X-Received: by 127.0.0.2 with SMTP id QUd8YY1788612xwKN3cCEg2k; Sun, 05 Nov 2023 19:27:23 -0800 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.47048.1699241242727985303 for ; Sun, 05 Nov 2023 19:27:23 -0800 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8AxJugWXUhlADc3AA--.49654S3; Mon, 06 Nov 2023 11:27:18 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dxvi8UXUhlCBI6AA--.61178S2; Mon, 06 Nov 2023 11:27:17 +0800 (CST) From: "Chao Li" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v2 06/30] MdePkg: Add read stable counter operation for LoongArch Date: Mon, 6 Nov 2023 11:27:15 +0800 Message-Id: <20231106032715.2273314-1-lichao@loongson.cn> In-Reply-To: <20231106032521.2251143-1-lichao@loongson.cn> References: <20231106032521.2251143-1-lichao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Dxvi8UXUhlCBI6AA--.61178S2 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAGCGVFqihSvgAwsx X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: fbF87XVcWA7ZvaPDo60GOcPPx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1699241244725100001 Content-Type: text/plain; charset="utf-8" Add LoongArch gets stable counter ASM function. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4584 Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Chao Li Acked-by: Michael D Kinney --- 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/Base= Lib.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 ); =20 +/** + Gets the timer count value. + + @param[] VOID + @retval timer count value. + +**/ +UINTN +AsmReadStableCounter ( + VOID + ); + #endif // defined (MDE_CPU_LOONGARCH64) =20 // diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/Ba= seLib.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 =20 [Packages] MdePkg/MdePkg.dec diff --git a/MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S b/MdePk= g/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.
+# +# 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 --=20 2.27.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110710): https://edk2.groups.io/g/devel/message/110710 Mute This Topic: https://groups.io/mt/102413854/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-