Acked-by: Michael D Kinney <michael.d.kin...@intel.com> > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li > Sent: Sunday, November 5, 2023 7:27 PM > To: devel@edk2.groups.io > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Gao, Liming > <gaolim...@byosoft.com.cn>; Liu, Zhiguang <zhiguang....@intel.com> > Subject: [edk2-devel] [PATCH v2 04/30] MdePkg: Add LoongArch64 local > interrupt function set into BaseLib > > Adding LoongArch local interrupt function set, which is used to > control > the opening or closing of the local interrupt when the global > interrupt > is enabled. > > 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> > --- > MdePkg/Include/Library/BaseLib.h | 20 +++++++++++++++++ > .../BaseLib/LoongArch64/DisableInterrupts.S | 22 ++++++++++++++---- > - > .../BaseLib/LoongArch64/EnableInterrupts.S | 22 ++++++++++++++---- > - > 3 files changed, 54 insertions(+), 10 deletions(-) > > diff --git a/MdePkg/Include/Library/BaseLib.h > b/MdePkg/Include/Library/BaseLib.h > index a9a69c734c..93a014cd49 100644 > --- a/MdePkg/Include/Library/BaseLib.h > +++ b/MdePkg/Include/Library/BaseLib.h > @@ -249,6 +249,26 @@ SetTlbRebaseAddress ( > IN UINT64 > ); > > +/** > + Enables local CPU interrupts. > + > + @param Needs to enable local interrupt bit. > +**/ > +VOID > +EnableLocalInterrupts ( > + IN UINT16 > + ); > + > +/** > + Disables local CPU interrupts. > + > + @param Needs to disable local interrupt bit. > +**/ > +VOID > +DisableLocalInterrupts ( > + IN UINT16 > + ); > + > #endif // defined (MDE_CPU_LOONGARCH64) > > // > diff --git a/MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S > b/MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S > index 0f228339af..5de10e9e7a 100644 > --- a/MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S > +++ b/MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S > @@ -1,21 +1,33 @@ > #-------------------------------------------------------------------- > ---------- > # > -# LoongArch interrupt disable > +# LoongArch interrupt disable operations > # > -# Copyright (c) 2022, Loongson Technology Corporation Limited. All > rights reserved.<BR> > +# Copyright (c) 2023, Loongson Technology Corporation Limited. All > rights reserved.<BR> > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > #-------------------------------------------------------------------- > ---------- > > +#include <Base.h> > +#include <Register/LoongArch64/Csr.h> > + > +ASM_GLOBAL ASM_PFX(DisableLocalInterrupts) > ASM_GLOBAL ASM_PFX(DisableInterrupts) > > #/** > -# Disables CPU interrupts. > +# Disables local CPU interrupts. > +# > +# @param Needs to disable local interrupt bit. > #**/ > +ASM_PFX(DisableLocalInterrupts): > + csrxchg $zero, $a0, LOONGARCH_CSR_ECFG > + jirl $zero, $ra, 0 > > +#/** > +# Disables global CPU interrupts. > +#**/ > ASM_PFX(DisableInterrupts): > - li.w $t0, 0x4 > - csrxchg $zero, $t0, 0x0 > + li.w $t0, BIT2 > + csrxchg $zero, $t0, LOONGARCH_CSR_CRMD > jirl $zero, $ra, 0 > .end > diff --git a/MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S > b/MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S > index 3c34fb2cdd..73adcd7b0c 100644 > --- a/MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S > +++ b/MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S > @@ -1,21 +1,33 @@ > #-------------------------------------------------------------------- > ---------- > # > -# LoongArch interrupt enable > +# LoongArch interrupt enable operations > # > -# Copyright (c) 2022, Loongson Technology Corporation Limited. All > rights reserved.<BR> > +# Copyright (c) 2023, Loongson Technology Corporation Limited. All > rights reserved.<BR> > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > #-------------------------------------------------------------------- > ---------- > > +#include <Base.h> > +#include <Register/LoongArch64/Csr.h> > + > +ASM_GLOBAL ASM_PFX(EnableLocalInterrupts) > ASM_GLOBAL ASM_PFX(EnableInterrupts) > > #/** > -# Enables CPU interrupts. > +# Enables local CPU interrupts. > +# > +# @param Needs to enable local interrupt bit. > #**/ > +ASM_PFX(EnableLocalInterrupts): > + csrxchg $a0, $a0, LOONGARCH_CSR_ECFG > + jirl $zero, $ra, 0 > > +#/** > +# Enables global CPU interrupts. > +#**/ > ASM_PFX(EnableInterrupts): > - li.w $t0, 0x4 > - csrxchg $t0, $t0, 0x0 > + li.w $t0, BIT2 > + csrxchg $t0, $t0, LOONGARCH_CSR_CRMD > jirl $zero, $ra, 0 > .end > -- > 2.27.0 > > > > >
-=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110789): https://edk2.groups.io/g/devel/message/110789 Mute This Topic: https://groups.io/mt/102413849/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-