public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation.
@ 2022-09-14  9:41 Chao Li
  2022-09-23  7:20 ` Chao Li
  2022-09-23 15:50 ` Michael D Kinney
  0 siblings, 2 replies; 3+ messages in thread
From: Chao Li @ 2022-09-14  9:41 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053

Implement LoongArch CPU related functions in BaseCpuLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Chao Li <lichao@loongson.cn>
---
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf          |  7 ++++++-
 MdePkg/Library/BaseCpuLib/BaseCpuLib.uni          |  5 +++--
 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S | 15 +++++++++++++++
 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S    | 15 +++++++++++++++
 4 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S

diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index c4cd29a783..6b230f6e6d 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -8,6 +8,7 @@
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+#  Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -25,7 +26,7 @@
 
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
+#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64
 #
 
 [Sources.IA32]
@@ -61,6 +62,10 @@
 [Sources.RISCV64]
   RiscV/Cpu.S
 
+[Sources.LOONGARCH64]
+  LoongArch/CpuFlushTlb.S | GCC
+  LoongArch/CpuSleep.S    | GCC
+
 [Packages]
   MdePkg/MdePkg.dec
 
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
index 80dc495786..7c5c8dfb37 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
@@ -1,13 +1,14 @@
 // /** @file
 // Instance of CPU Library for various architecture.
 //
-// CPU Library implemented using ASM functions for IA-32, X64 and RISCV64,
+// CPU Library implemented using ASM functions for IA-32, X64, RISCV64 and LoongArch64,
 // PAL CALLs for IPF, and empty functions for EBC.
 //
 // Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 // Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 // Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 // Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+// Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 //
 // SPDX-License-Identifier: BSD-2-Clause-Patent
 //
@@ -16,5 +17,5 @@
 
 #string STR_MODULE_ABSTRACT             #language en-US "Instance of CPU Library for various architectures"
 
-#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."
+#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."
 
diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
new file mode 100644
index 0000000000..8b792f0a37
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
@@ -0,0 +1,15 @@
+#------------------------------------------------------------------------------
+#
+# CpuFlushTlb() for LoongArch64
+#
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(CpuFlushTlb)
+
+ASM_PFX(CpuFlushTlb):
+  tlbflush
+  jirl $zero, $ra, 0
+  .end
diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
new file mode 100644
index 0000000000..eb31b10714
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
@@ -0,0 +1,15 @@
+#------------------------------------------------------------------------------
+#
+# CpuSleep() for LoongArch64
+#
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(CpuSleep)
+
+ASM_PFX(CpuSleep):
+  idle 0
+  jirl $zero, $ra, 0
+  .end
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation.
  2022-09-14  9:41 [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation Chao Li
@ 2022-09-23  7:20 ` Chao Li
  2022-09-23 15:50 ` Michael D Kinney
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Li @ 2022-09-23  7:20 UTC (permalink / raw)
  To: Michael D Kinney, Liming Gao, Zhiguang Liu; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 5114 bytes --]

Hi Mike, Liming and Zhiguang,
This patch has not been reviewed, would you please review it?

Thanks,
Chao
--------

On 9月 14 2022, at 5:41 下午, Chao Li <lichao@loongson.cn> wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
>
> Implement LoongArch CPU related functions in BaseCpuLib.
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>
> Signed-off-by: Chao Li <lichao@loongson.cn>
> ---
> MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 7 ++++++-
> MdePkg/Library/BaseCpuLib/BaseCpuLib.uni | 5 +++--
> MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S | 15 +++++++++++++++
> MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S | 15 +++++++++++++++
> 4 files changed, 39 insertions(+), 3 deletions(-)
> create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
> create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
>
> diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> index c4cd29a783..6b230f6e6d 100644
> --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> @@ -8,6 +8,7 @@
> # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>
> # Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
> # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> +# Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> #
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> #
> @@ -25,7 +26,7 @@
>
>
>
> #
> -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64
> +# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64
> #
>
>
> [Sources.IA32]
> @@ -61,6 +62,10 @@
> [Sources.RISCV64]
>
> RiscV/Cpu.S
>
>
> +[Sources.LOONGARCH64]
> + LoongArch/CpuFlushTlb.S | GCC
> + LoongArch/CpuSleep.S | GCC
> +
> [Packages]
> MdePkg/MdePkg.dec
>
>
> diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> index 80dc495786..7c5c8dfb37 100644
> --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> @@ -1,13 +1,14 @@
> // /** @file
>
> // Instance of CPU Library for various architecture.
> //
> -// CPU Library implemented using ASM functions for IA-32, X64 and RISCV64,
> +// CPU Library implemented using ASM functions for IA-32, X64, RISCV64 and LoongArch64,
> // PAL CALLs for IPF, and empty functions for EBC.
> //
> // Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
> // Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> // Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
> // Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> +// Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> //
> // SPDX-License-Identifier: BSD-2-Clause-Patent
> //
> @@ -16,5 +17,5 @@
>
> #string STR_MODULE_ABSTRACT #language en-US "Instance of CPU Library for various architectures"
>
>
> -#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."
> +#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."
>
>
> diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
> new file mode 100644
> index 0000000000..8b792f0a37
> --- /dev/null
> +++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
> @@ -0,0 +1,15 @@
> +#------------------------------------------------------------------------------
>
> +#
> +# CpuFlushTlb() for LoongArch64
> +#
> +# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#------------------------------------------------------------------------------
> +ASM_GLOBAL ASM_PFX(CpuFlushTlb)
> +
> +ASM_PFX(CpuFlushTlb):
> + tlbflush
> + jirl $zero, $ra, 0
> + .end
> diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
> new file mode 100644
> index 0000000000..eb31b10714
> --- /dev/null
> +++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
> @@ -0,0 +1,15 @@
> +#------------------------------------------------------------------------------
>
> +#
> +# CpuSleep() for LoongArch64
> +#
> +# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#------------------------------------------------------------------------------
> +ASM_GLOBAL ASM_PFX(CpuSleep)
> +
> +ASM_PFX(CpuSleep):
> + idle 0
> + jirl $zero, $ra, 0
> + .end
> --
> 2.27.0
>


[-- Attachment #2: Type: text/html, Size: 6598 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation.
  2022-09-14  9:41 [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation Chao Li
  2022-09-23  7:20 ` Chao Li
@ 2022-09-23 15:50 ` Michael D Kinney
  1 sibling, 0 replies; 3+ messages in thread
From: Michael D Kinney @ 2022-09-23 15:50 UTC (permalink / raw)
  To: Chao Li, devel@edk2.groups.io, Kinney, Michael D
  Cc: Gao, Liming, Liu, Zhiguang

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: Chao Li <lichao@loongson.cn>
> Sent: Wednesday, September 14, 2022 2:42 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
> 
> Implement LoongArch CPU related functions in BaseCpuLib.
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> 
> Signed-off-by: Chao Li <lichao@loongson.cn>
> ---
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf          |  7 ++++++-
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.uni          |  5 +++--
>  MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S | 15 +++++++++++++++
>  MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S    | 15 +++++++++++++++
>  4 files changed, 39 insertions(+), 3 deletions(-)
>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
> 
> diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> index c4cd29a783..6b230f6e6d 100644
> --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> @@ -8,6 +8,7 @@
>  #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> 
>  #  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
> 
>  #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> 
> +#  Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
>  #
> 
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  #
> 
> @@ -25,7 +26,7 @@
> 
> 
> 
> 
>  #
> 
> -#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
> 
> +#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64
> 
>  #
> 
> 
> 
>  [Sources.IA32]
> 
> @@ -61,6 +62,10 @@
>  [Sources.RISCV64]
> 
>    RiscV/Cpu.S
> 
> 
> 
> +[Sources.LOONGARCH64]
> 
> +  LoongArch/CpuFlushTlb.S | GCC
> 
> +  LoongArch/CpuSleep.S    | GCC
> 
> +
> 
>  [Packages]
> 
>    MdePkg/MdePkg.dec
> 
> 
> 
> diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> index 80dc495786..7c5c8dfb37 100644
> --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
> @@ -1,13 +1,14 @@
>  // /** @file
> 
>  // Instance of CPU Library for various architecture.
> 
>  //
> 
> -// CPU Library implemented using ASM functions for IA-32, X64 and RISCV64,
> 
> +// CPU Library implemented using ASM functions for IA-32, X64, RISCV64 and LoongArch64,
> 
>  // PAL CALLs for IPF, and empty functions for EBC.
> 
>  //
> 
>  // Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
> 
>  // Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> 
>  // Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
> 
>  // Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> 
> +// Portions Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
>  //
> 
>  // SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  //
> 
> @@ -16,5 +17,5 @@
> 
> 
>  #string STR_MODULE_ABSTRACT             #language en-US "Instance of CPU Library for various architectures"
> 
> 
> 
> -#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."
> 
> +#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."
> 
> 
> 
> diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
> new file mode 100644
> index 0000000000..8b792f0a37
> --- /dev/null
> +++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
> @@ -0,0 +1,15 @@
> +#------------------------------------------------------------------------------
> 
> +#
> 
> +# CpuFlushTlb() for LoongArch64
> 
> +#
> 
> +# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
> +#
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +#------------------------------------------------------------------------------
> 
> +ASM_GLOBAL ASM_PFX(CpuFlushTlb)
> 
> +
> 
> +ASM_PFX(CpuFlushTlb):
> 
> +  tlbflush
> 
> +  jirl $zero, $ra, 0
> 
> +  .end
> 
> diff --git a/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
> new file mode 100644
> index 0000000000..eb31b10714
> --- /dev/null
> +++ b/MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
> @@ -0,0 +1,15 @@
> +#------------------------------------------------------------------------------
> 
> +#
> 
> +# CpuSleep() for LoongArch64
> 
> +#
> 
> +# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
> +#
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +#------------------------------------------------------------------------------
> 
> +ASM_GLOBAL ASM_PFX(CpuSleep)
> 
> +
> 
> +ASM_PFX(CpuSleep):
> 
> +  idle 0
> 
> +  jirl $zero, $ra, 0
> 
> +  .end
> 
> --
> 2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-23 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-14  9:41 [PATCH v2 27/34] MdePkg/BaseCpuLib: LoongArch Base CPU library implementation Chao Li
2022-09-23  7:20 ` Chao Li
2022-09-23 15:50 ` Michael D Kinney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox