# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
+# Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
\r
\r
#\r
-# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64\r
+# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64\r
#\r
\r
[Sources.IA32]\r
[Sources.RISCV64]\r
RiscV/Cpu.S\r
\r
+[Sources.LOONGARCH64]\r
+ LoongArch/CpuFlushTlb.S | GCC\r
+ LoongArch/CpuSleep.S | GCC\r
+\r
[Packages]\r
MdePkg/MdePkg.dec\r
\r
// /** @file\r
// Instance of CPU Library for various architecture.\r
//\r
-// CPU Library implemented using ASM functions for IA-32, X64 and RISCV64,\r
+// CPU Library implemented using ASM functions for IA-32, X64, RISCV64 and LoongArch64,\r
// PAL CALLs for IPF, and empty functions for EBC.\r
//\r
// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
// Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
+// Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
\r
#string STR_MODULE_ABSTRACT #language en-US "Instance of CPU Library for various architectures"\r
\r
-#string STR_MODULE_DESCRIPTION #language en-US "CPU Library implemented using ASM functions for IA-32, X64 and RISCV64, PAL CALLs for IPF, and empty functions for EBC."\r
+#string STR_MODULE_DESCRIPTION #language en-US "CPU Library implemented using ASM functions for IA-32, X64, RISCV64 and LoongArch64, PAL CALLs for IPF, and empty functions for EBC."\r
\r
--- /dev/null
+#------------------------------------------------------------------------------\r
+#\r
+# CpuFlushTlb() for LoongArch64\r
+#\r
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+#------------------------------------------------------------------------------\r
+ASM_GLOBAL ASM_PFX(CpuFlushTlb)\r
+\r
+ASM_PFX(CpuFlushTlb):\r
+ tlbflush\r
+ jirl $zero, $ra, 0\r
+ .end\r
--- /dev/null
+#------------------------------------------------------------------------------\r
+#\r
+# CpuSleep() for LoongArch64\r
+#\r
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+#------------------------------------------------------------------------------\r
+ASM_GLOBAL ASM_PFX(CpuSleep)\r
+\r
+ASM_PFX(CpuSleep):\r
+ idle 0\r
+ jirl $zero, $ra, 0\r
+ .end\r