public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
@ 2022-09-14  9:41 Chao Li
  2022-09-23  6:32 ` Chao Li
  2022-09-23 15:46 ` [edk2-devel] " Michael D Kinney
  0 siblings, 2 replies; 10+ 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

Add LoongArch processor related definitions.

For the Http boot and PXE boot types seeing this URL section "Processor
Architecture Type" for the LOONGARCH values:
https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml

For definitions of PE/COFF and LOONGARCH relocation types, see the
"Machine Types" and "Basic Relocation Types" sections of this URL for
LOONGARCH values:
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format

For the register definitions of exceptions context, see the UEFI V2.10
18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
definitions:
https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html

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/Include/IndustryStandard/PeImage.h |   9 ++
 MdePkg/Include/Protocol/DebugSupport.h    | 107 ++++++++++++++++++++--
 MdePkg/Include/Protocol/PxeBaseCode.h     |   3 +
 MdePkg/Include/Uefi/UefiBaseType.h        |  14 +++
 MdePkg/Include/Uefi/UefiSpec.h            |  16 ++--
 5 files changed, 136 insertions(+), 13 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
index 3109dc20f8..dd4cc25483 100644
--- a/MdePkg/Include/IndustryStandard/PeImage.h
+++ b/MdePkg/Include/IndustryStandard/PeImage.h
@@ -10,6 +10,7 @@
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 Portions Copyright (c) 2016 - 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
 
@@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define IMAGE_FILE_MACHINE_RISCV32         0x5032
 #define IMAGE_FILE_MACHINE_RISCV64         0x5064
 #define IMAGE_FILE_MACHINE_RISCV128        0x5128
+#define IMAGE_FILE_MACHINE_LOONGARCH32     0x6232
+#define IMAGE_FILE_MACHINE_LOONGARCH64     0x6264
 
 //
 // EXE file formats
@@ -503,6 +506,12 @@ typedef struct {
 #define EFI_IMAGE_REL_BASED_RISCV_LOW12I  7
 #define EFI_IMAGE_REL_BASED_RISCV_LOW12S  8
 
+//
+// Relocation types of LoongArch processor.
+//
+#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA  8
+#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA  8
+
 ///
 /// Line number format.
 ///
diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
index ec5b92a5c5..2b0ae2d157 100644
--- a/MdePkg/Include/Protocol/DebugSupport.h
+++ b/MdePkg/Include/Protocol/DebugSupport.h
@@ -654,17 +654,110 @@ typedef struct {
   UINT64    X31;
 } EFI_SYSTEM_CONTEXT_RISCV64;
 
+//
+// LoongArch processor exception types.
+//
+#define EXCEPT_LOONGARCH_INT   0
+#define EXCEPT_LOONGARCH_PIL   1
+#define EXCEPT_LOONGARCH_PIS   2
+#define EXCEPT_LOONGARCH_PIF   3
+#define EXCEPT_LOONGARCH_PME   4
+#define EXCEPT_LOONGARCH_PNR   5
+#define EXCEPT_LOONGARCH_PNX   6
+#define EXCEPT_LOONGARCH_PPI   7
+#define EXCEPT_LOONGARCH_ADE   8
+#define EXCEPT_LOONGARCH_ALE   9
+#define EXCEPT_LOONGARCH_BCE   10
+#define EXCEPT_LOONGARCH_SYS   11
+#define EXCEPT_LOONGARCH_BRK   12
+#define EXCEPT_LOONGARCH_INE   13
+#define EXCEPT_LOONGARCH_IPE   14
+#define EXCEPT_LOONGARCH_FPD   15
+#define EXCEPT_LOONGARCH_SXD   16
+#define EXCEPT_LOONGARCH_ASXD  17
+#define EXCEPT_LOONGARCH_FPE   18
+#define EXCEPT_LOONGARCH_TBR   64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an independent exception.
+
+//
+// LoongArch processor Interrupt types.
+//
+#define EXCEPT_LOONGARCH_INT_SIP0   0
+#define EXCEPT_LOONGARCH_INT_SIP1   1
+#define EXCEPT_LOONGARCH_INT_IP0    2
+#define EXCEPT_LOONGARCH_INT_IP1    3
+#define EXCEPT_LOONGARCH_INT_IP2    4
+#define EXCEPT_LOONGARCH_INT_IP3    5
+#define EXCEPT_LOONGARCH_INT_IP4    6
+#define EXCEPT_LOONGARCH_INT_IP5    7
+#define EXCEPT_LOONGARCH_INT_IP6    8
+#define EXCEPT_LOONGARCH_INT_IP7    9
+#define EXCEPT_LOONGARCH_INT_PMC    10
+#define EXCEPT_LOONGARCH_INT_TIMER  11
+#define EXCEPT_LOONGARCH_INT_IPI    12
+
+//
+// For coding convenience, define the maximum valid
+// LoongArch interrupt.
+//
+#define MAX_LOONGARCH_INTERRUPT  14
+
+typedef struct {
+  UINT64    R0;
+  UINT64    R1;
+  UINT64    R2;
+  UINT64    R3;
+  UINT64    R4;
+  UINT64    R5;
+  UINT64    R6;
+  UINT64    R7;
+  UINT64    R8;
+  UINT64    R9;
+  UINT64    R10;
+  UINT64    R11;
+  UINT64    R12;
+  UINT64    R13;
+  UINT64    R14;
+  UINT64    R15;
+  UINT64    R16;
+  UINT64    R17;
+  UINT64    R18;
+  UINT64    R19;
+  UINT64    R20;
+  UINT64    R21;
+  UINT64    R22;
+  UINT64    R23;
+  UINT64    R24;
+  UINT64    R25;
+  UINT64    R26;
+  UINT64    R27;
+  UINT64    R28;
+  UINT64    R29;
+  UINT64    R30;
+  UINT64    R31;
+
+  UINT64    CRMD;  // CuRrent MoDe information
+  UINT64    PRMD;  // PRe-exception MoDe information
+  UINT64    EUEN;  // Extended component Unit ENable
+  UINT64    MISC;  // MISCellaneous controller
+  UINT64    ECFG;  // Exception ConFiGuration
+  UINT64    ESTAT; // Exception STATus
+  UINT64    ERA;   // Exception Return Address
+  UINT64    BADV;  // BAD Virtual address
+  UINT64    BADI;  // BAD Instruction
+} EFI_SYSTEM_CONTEXT_LOONGARCH64;
+
 ///
 /// Universal EFI_SYSTEM_CONTEXT definition.
 ///
 typedef union {
-  EFI_SYSTEM_CONTEXT_EBC        *SystemContextEbc;
-  EFI_SYSTEM_CONTEXT_IA32       *SystemContextIa32;
-  EFI_SYSTEM_CONTEXT_X64        *SystemContextX64;
-  EFI_SYSTEM_CONTEXT_IPF        *SystemContextIpf;
-  EFI_SYSTEM_CONTEXT_ARM        *SystemContextArm;
-  EFI_SYSTEM_CONTEXT_AARCH64    *SystemContextAArch64;
-  EFI_SYSTEM_CONTEXT_RISCV64    *SystemContextRiscV64;
+  EFI_SYSTEM_CONTEXT_EBC            *SystemContextEbc;
+  EFI_SYSTEM_CONTEXT_IA32           *SystemContextIa32;
+  EFI_SYSTEM_CONTEXT_X64            *SystemContextX64;
+  EFI_SYSTEM_CONTEXT_IPF            *SystemContextIpf;
+  EFI_SYSTEM_CONTEXT_ARM            *SystemContextArm;
+  EFI_SYSTEM_CONTEXT_AARCH64        *SystemContextAArch64;
+  EFI_SYSTEM_CONTEXT_RISCV64        *SystemContextRiscV64;
+  EFI_SYSTEM_CONTEXT_LOONGARCH64    *SystemContextLoongArch64;
 } EFI_SYSTEM_CONTEXT;
 
 //
diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
index 11872d602d..6787941a5d 100644
--- a/MdePkg/Include/Protocol/PxeBaseCode.h
+++ b/MdePkg/Include/Protocol/PxeBaseCode.h
@@ -4,6 +4,7 @@
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
 #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x000B
 #elif defined (MDE_CPU_RISCV64)
 #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x001B
+#elif defined (MDE_CPU_LOONGARCH64)
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x0027
 #endif
 
 ///
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
index 4a34ce8e25..83975a08eb 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -4,6 +4,7 @@
 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
 Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -246,6 +247,12 @@ typedef union {
 #define EFI_IMAGE_MACHINE_RISCV64   0x5064
 #define EFI_IMAGE_MACHINE_RISCV128  0x5128
 
+///
+/// PE32+ Machine type for LoongArch 32/64 images.
+///
+#define EFI_IMAGE_MACHINE_LOONGARCH32  0x6232
+#define EFI_IMAGE_MACHINE_LOONGARCH64  0x6264
+
 #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
   #if   defined (MDE_CPU_IA32)
 
@@ -278,6 +285,13 @@ typedef union {
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
   ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
 
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)  (FALSE)
+
+  #elif defined (MDE_CPU_LOONGARCH64)
+
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
+    ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
+
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)  (FALSE)
 
   #elif defined (MDE_CPU_EBC)
diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
index 2b38b100f6..3abebbb8d9 100644
--- a/MdePkg/Include/Uefi/UefiSpec.h
+++ b/MdePkg/Include/Uefi/UefiSpec.h
@@ -7,6 +7,7 @@
 
 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -2195,12 +2196,13 @@ typedef struct {
 //
 // EFI File location to boot from on removable media devices
 //
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32     L"\\EFI\\BOOT\\BOOTIA32.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64     L"\\EFI\\BOOT\\BOOTIA64.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64      L"\\EFI\\BOOT\\BOOTX64.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM      L"\\EFI\\BOOT\\BOOTARM.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64  L"\\EFI\\BOOT\\BOOTAA64.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64  L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32         L"\\EFI\\BOOT\\BOOTIA32.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64         L"\\EFI\\BOOT\\BOOTIA64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64          L"\\EFI\\BOOT\\BOOTX64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM          L"\\EFI\\BOOT\\BOOTARM.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64      L"\\EFI\\BOOT\\BOOTAA64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64      L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64  L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
 
 #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
   #if   defined (MDE_CPU_IA32)
@@ -2214,6 +2216,8 @@ typedef struct {
 #define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
   #elif defined (MDE_CPU_RISCV64)
 #define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
+  #elif defined (MDE_CPU_LOONGARCH64)
+#define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
   #else
     #error Unknown Processor Type
   #endif
-- 
2.27.0


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

* Re: [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-14  9:41 [PATCH v2 22/34] MdePkg/Include: LoongArch definitions Chao Li
@ 2022-09-23  6:32 ` Chao Li
  2022-09-23 15:46 ` [edk2-devel] " Michael D Kinney
  1 sibling, 0 replies; 10+ messages in thread
From: Chao Li @ 2022-09-23  6:32 UTC (permalink / raw)
  To: Michael D Kinney; +Cc: Liming Gao, Zhiguang Liu, devel@edk2.groups.io

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

Hi Mike,
In the V2, I added IANA, Microsoft and UEFI specification links in every patches that uses them. Associated patches:

0008-MdePkg-Include-Add-LOONGARCH-related-definitions-.patch
0015-BaseTools-BaseTools-changes-for-LoongArch-platfor.patch
0022-MdePkg-Include-LoongArch-definitions.patch(This patch)

Please check and review them again.

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
>
> Add LoongArch processor related definitions.
> For the Http boot and PXE boot types seeing this URL section "Processor
> Architecture Type" for the LOONGARCH values:
> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
>
> For definitions of PE/COFF and LOONGARCH relocation types, see the
> "Machine Types" and "Basic Relocation Types" sections of this URL for
> LOONGARCH values:
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
>
> For the register definitions of exceptions context, see the UEFI V2.10
> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> definitions:
> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
>
> 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/Include/IndustryStandard/PeImage.h | 9 ++
> MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> 5 files changed, 136 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..dd4cc25483 100644
> --- a/MdePkg/Include/IndustryStandard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> @@ -10,6 +10,7 @@
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> Portions Copyright (c) 2016 - 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
>
>
> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #define IMAGE_FILE_MACHINE_RISCV32 0x5032
>
> #define IMAGE_FILE_MACHINE_RISCV64 0x5064
> #define IMAGE_FILE_MACHINE_RISCV128 0x5128
> +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
> +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
>
>
> //
> // EXE file formats
> @@ -503,6 +506,12 @@ typedef struct {
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
>
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
>
>
> +//
> +// Relocation types of LoongArch processor.
> +//
> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
> +
> ///
> /// Line number format.
> ///
> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> index ec5b92a5c5..2b0ae2d157 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,110 @@ typedef struct {
> UINT64 X31;
>
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
>
> +//
> +// LoongArch processor exception types.
> +//
> +#define EXCEPT_LOONGARCH_INT 0
> +#define EXCEPT_LOONGARCH_PIL 1
> +#define EXCEPT_LOONGARCH_PIS 2
> +#define EXCEPT_LOONGARCH_PIF 3
> +#define EXCEPT_LOONGARCH_PME 4
> +#define EXCEPT_LOONGARCH_PNR 5
> +#define EXCEPT_LOONGARCH_PNX 6
> +#define EXCEPT_LOONGARCH_PPI 7
> +#define EXCEPT_LOONGARCH_ADE 8
> +#define EXCEPT_LOONGARCH_ALE 9
> +#define EXCEPT_LOONGARCH_BCE 10
> +#define EXCEPT_LOONGARCH_SYS 11
> +#define EXCEPT_LOONGARCH_BRK 12
> +#define EXCEPT_LOONGARCH_INE 13
> +#define EXCEPT_LOONGARCH_IPE 14
> +#define EXCEPT_LOONGARCH_FPD 15
> +#define EXCEPT_LOONGARCH_SXD 16
> +#define EXCEPT_LOONGARCH_ASXD 17
> +#define EXCEPT_LOONGARCH_FPE 18
> +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an independent exception.
> +
> +//
> +// LoongArch processor Interrupt types.
> +//
> +#define EXCEPT_LOONGARCH_INT_SIP0 0
> +#define EXCEPT_LOONGARCH_INT_SIP1 1
> +#define EXCEPT_LOONGARCH_INT_IP0 2
> +#define EXCEPT_LOONGARCH_INT_IP1 3
> +#define EXCEPT_LOONGARCH_INT_IP2 4
> +#define EXCEPT_LOONGARCH_INT_IP3 5
> +#define EXCEPT_LOONGARCH_INT_IP4 6
> +#define EXCEPT_LOONGARCH_INT_IP5 7
> +#define EXCEPT_LOONGARCH_INT_IP6 8
> +#define EXCEPT_LOONGARCH_INT_IP7 9
> +#define EXCEPT_LOONGARCH_INT_PMC 10
> +#define EXCEPT_LOONGARCH_INT_TIMER 11
> +#define EXCEPT_LOONGARCH_INT_IPI 12
> +
> +//
> +// For coding convenience, define the maximum valid
> +// LoongArch interrupt.
> +//
> +#define MAX_LOONGARCH_INTERRUPT 14
> +
> +typedef struct {
> + UINT64 R0;
> + UINT64 R1;
> + UINT64 R2;
> + UINT64 R3;
> + UINT64 R4;
> + UINT64 R5;
> + UINT64 R6;
> + UINT64 R7;
> + UINT64 R8;
> + UINT64 R9;
> + UINT64 R10;
> + UINT64 R11;
> + UINT64 R12;
> + UINT64 R13;
> + UINT64 R14;
> + UINT64 R15;
> + UINT64 R16;
> + UINT64 R17;
> + UINT64 R18;
> + UINT64 R19;
> + UINT64 R20;
> + UINT64 R21;
> + UINT64 R22;
> + UINT64 R23;
> + UINT64 R24;
> + UINT64 R25;
> + UINT64 R26;
> + UINT64 R27;
> + UINT64 R28;
> + UINT64 R29;
> + UINT64 R30;
> + UINT64 R31;
> +
> + UINT64 CRMD; // CuRrent MoDe information
> + UINT64 PRMD; // PRe-exception MoDe information
> + UINT64 EUEN; // Extended component Unit ENable
> + UINT64 MISC; // MISCellaneous controller
> + UINT64 ECFG; // Exception ConFiGuration
> + UINT64 ESTAT; // Exception STATus
> + UINT64 ERA; // Exception Return Address
> + UINT64 BADV; // BAD Virtual address
> + UINT64 BADI; // BAD Instruction
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
> +
> ///
> /// Universal EFI_SYSTEM_CONTEXT definition.
> ///
> typedef union {
> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
> } EFI_SYSTEM_CONTEXT;
>
>
> //
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> #elif defined (MDE_CPU_RISCV64)
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
> +#elif defined (MDE_CPU_LOONGARCH64)
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
> #endif
>
>
> ///
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
> @@ -246,6 +247,12 @@ typedef union {
> #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
>
> +///
> +/// PE32+ Machine type for LoongArch 32/64 images.
> +///
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
> +
> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> #if defined (MDE_CPU_IA32)
>
>
> @@ -278,6 +285,13 @@ typedef union {
> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
>
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
> +
> + #elif defined (MDE_CPU_LOONGARCH64)
> +
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
> +
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
>
> #elif defined (MDE_CPU_EBC)
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
>
>
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
> @@ -2195,12 +2196,13 @@ typedef struct {
> //
>
> // EFI File location to boot from on removable media devices
> //
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
>
>
> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
> #if defined (MDE_CPU_IA32)
> @@ -2214,6 +2216,8 @@ typedef struct {
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> #elif defined (MDE_CPU_RISCV64)
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> + #elif defined (MDE_CPU_LOONGARCH64)
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
> #else
> #error Unknown Processor Type
> #endif
> --
> 2.27.0
>


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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-14  9:41 [PATCH v2 22/34] MdePkg/Include: LoongArch definitions Chao Li
  2022-09-23  6:32 ` Chao Li
@ 2022-09-23 15:46 ` Michael D Kinney
  2022-09-24  2:16   ` Chao Li
  1 sibling, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2022-09-23 15:46 UTC (permalink / raw)
  To: devel@edk2.groups.io, lichao@loongson.cn, Kinney, Michael D
  Cc: Gao, Liming, Liu, Zhiguang

One comment below.

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
> Sent: Wednesday, September 14, 2022 2:41 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: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
> 
> Add LoongArch processor related definitions.
> 
> For the Http boot and PXE boot types seeing this URL section "Processor
> Architecture Type" for the LOONGARCH values:
> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
> 
> For definitions of PE/COFF and LOONGARCH relocation types, see the
> "Machine Types" and "Basic Relocation Types" sections of this URL for
> LOONGARCH values:
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
> 
> For the register definitions of exceptions context, see the UEFI V2.10
> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> definitions:
> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
> 
> 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/Include/IndustryStandard/PeImage.h |   9 ++
>  MdePkg/Include/Protocol/DebugSupport.h    | 107 ++++++++++++++++++++--
>  MdePkg/Include/Protocol/PxeBaseCode.h     |   3 +
>  MdePkg/Include/Uefi/UefiBaseType.h        |  14 +++
>  MdePkg/Include/Uefi/UefiSpec.h            |  16 ++--
>  5 files changed, 136 insertions(+), 13 deletions(-)
> 
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..dd4cc25483 100644
> --- a/MdePkg/Include/IndustryStandard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> @@ -10,6 +10,7 @@
>  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> 
>  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> 
>  Portions Copyright (c) 2016 - 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
> 
> 
> 
> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #define IMAGE_FILE_MACHINE_RISCV32         0x5032
> 
>  #define IMAGE_FILE_MACHINE_RISCV64         0x5064
> 
>  #define IMAGE_FILE_MACHINE_RISCV128        0x5128
> 
> +#define IMAGE_FILE_MACHINE_LOONGARCH32     0x6232
> 
> +#define IMAGE_FILE_MACHINE_LOONGARCH64     0x6264
> 
> 
> 
>  //
> 
>  // EXE file formats
> 
> @@ -503,6 +506,12 @@ typedef struct {
>  #define EFI_IMAGE_REL_BASED_RISCV_LOW12I  7
> 
>  #define EFI_IMAGE_REL_BASED_RISCV_LOW12S  8
> 
> 
> 
> +//
> 
> +// Relocation types of LoongArch processor.
> 
> +//
> 
> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA  8
> 
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA  8
> 
> +
> 
>  ///
> 
>  /// Line number format.
> 
>  ///
> 
> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> index ec5b92a5c5..2b0ae2d157 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,110 @@ typedef struct {
>    UINT64    X31;
> 
>  } EFI_SYSTEM_CONTEXT_RISCV64;
> 
> 
> 
> +//
> 
> +// LoongArch processor exception types.
> 
> +//
> 
> +#define EXCEPT_LOONGARCH_INT   0
> 
> +#define EXCEPT_LOONGARCH_PIL   1
> 
> +#define EXCEPT_LOONGARCH_PIS   2
> 
> +#define EXCEPT_LOONGARCH_PIF   3
> 
> +#define EXCEPT_LOONGARCH_PME   4
> 
> +#define EXCEPT_LOONGARCH_PNR   5
> 
> +#define EXCEPT_LOONGARCH_PNX   6
> 
> +#define EXCEPT_LOONGARCH_PPI   7
> 
> +#define EXCEPT_LOONGARCH_ADE   8
> 
> +#define EXCEPT_LOONGARCH_ALE   9
> 
> +#define EXCEPT_LOONGARCH_BCE   10
> 
> +#define EXCEPT_LOONGARCH_SYS   11
> 
> +#define EXCEPT_LOONGARCH_BRK   12
> 
> +#define EXCEPT_LOONGARCH_INE   13
> 
> +#define EXCEPT_LOONGARCH_IPE   14
> 
> +#define EXCEPT_LOONGARCH_FPD   15
> 
> +#define EXCEPT_LOONGARCH_SXD   16
> 
> +#define EXCEPT_LOONGARCH_ASXD  17
> 
> +#define EXCEPT_LOONGARCH_FPE   18
> 
> +#define EXCEPT_LOONGARCH_TBR   64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> independent exception.
> 
> +
> 
> +//
> 
> +// LoongArch processor Interrupt types.
> 
> +//
> 
> +#define EXCEPT_LOONGARCH_INT_SIP0   0
> 
> +#define EXCEPT_LOONGARCH_INT_SIP1   1
> 
> +#define EXCEPT_LOONGARCH_INT_IP0    2
> 
> +#define EXCEPT_LOONGARCH_INT_IP1    3
> 
> +#define EXCEPT_LOONGARCH_INT_IP2    4
> 
> +#define EXCEPT_LOONGARCH_INT_IP3    5
> 
> +#define EXCEPT_LOONGARCH_INT_IP4    6
> 
> +#define EXCEPT_LOONGARCH_INT_IP5    7
> 
> +#define EXCEPT_LOONGARCH_INT_IP6    8
> 
> +#define EXCEPT_LOONGARCH_INT_IP7    9
> 
> +#define EXCEPT_LOONGARCH_INT_PMC    10
> 
> +#define EXCEPT_LOONGARCH_INT_TIMER  11
> 
> +#define EXCEPT_LOONGARCH_INT_IPI    12
> 
> +
> 
> +//
> 
> +// For coding convenience, define the maximum valid
> 
> +// LoongArch interrupt.
> 
> +//
> 
> +#define MAX_LOONGARCH_INTERRUPT  14

Should this define be moved into the libs/modules that uses
this define?  Prefer to only see definitions from specs in
this file.

> 
> +
> 
> +typedef struct {
> 
> +  UINT64    R0;
> 
> +  UINT64    R1;
> 
> +  UINT64    R2;
> 
> +  UINT64    R3;
> 
> +  UINT64    R4;
> 
> +  UINT64    R5;
> 
> +  UINT64    R6;
> 
> +  UINT64    R7;
> 
> +  UINT64    R8;
> 
> +  UINT64    R9;
> 
> +  UINT64    R10;
> 
> +  UINT64    R11;
> 
> +  UINT64    R12;
> 
> +  UINT64    R13;
> 
> +  UINT64    R14;
> 
> +  UINT64    R15;
> 
> +  UINT64    R16;
> 
> +  UINT64    R17;
> 
> +  UINT64    R18;
> 
> +  UINT64    R19;
> 
> +  UINT64    R20;
> 
> +  UINT64    R21;
> 
> +  UINT64    R22;
> 
> +  UINT64    R23;
> 
> +  UINT64    R24;
> 
> +  UINT64    R25;
> 
> +  UINT64    R26;
> 
> +  UINT64    R27;
> 
> +  UINT64    R28;
> 
> +  UINT64    R29;
> 
> +  UINT64    R30;
> 
> +  UINT64    R31;
> 
> +
> 
> +  UINT64    CRMD;  // CuRrent MoDe information
> 
> +  UINT64    PRMD;  // PRe-exception MoDe information
> 
> +  UINT64    EUEN;  // Extended component Unit ENable
> 
> +  UINT64    MISC;  // MISCellaneous controller
> 
> +  UINT64    ECFG;  // Exception ConFiGuration
> 
> +  UINT64    ESTAT; // Exception STATus
> 
> +  UINT64    ERA;   // Exception Return Address
> 
> +  UINT64    BADV;  // BAD Virtual address
> 
> +  UINT64    BADI;  // BAD Instruction
> 
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
> 
> +
> 
>  ///
> 
>  /// Universal EFI_SYSTEM_CONTEXT definition.
> 
>  ///
> 
>  typedef union {
> 
> -  EFI_SYSTEM_CONTEXT_EBC        *SystemContextEbc;
> 
> -  EFI_SYSTEM_CONTEXT_IA32       *SystemContextIa32;
> 
> -  EFI_SYSTEM_CONTEXT_X64        *SystemContextX64;
> 
> -  EFI_SYSTEM_CONTEXT_IPF        *SystemContextIpf;
> 
> -  EFI_SYSTEM_CONTEXT_ARM        *SystemContextArm;
> 
> -  EFI_SYSTEM_CONTEXT_AARCH64    *SystemContextAArch64;
> 
> -  EFI_SYSTEM_CONTEXT_RISCV64    *SystemContextRiscV64;
> 
> +  EFI_SYSTEM_CONTEXT_EBC            *SystemContextEbc;
> 
> +  EFI_SYSTEM_CONTEXT_IA32           *SystemContextIa32;
> 
> +  EFI_SYSTEM_CONTEXT_X64            *SystemContextX64;
> 
> +  EFI_SYSTEM_CONTEXT_IPF            *SystemContextIpf;
> 
> +  EFI_SYSTEM_CONTEXT_ARM            *SystemContextArm;
> 
> +  EFI_SYSTEM_CONTEXT_AARCH64        *SystemContextAArch64;
> 
> +  EFI_SYSTEM_CONTEXT_RISCV64        *SystemContextRiscV64;
> 
> +  EFI_SYSTEM_CONTEXT_LOONGARCH64    *SystemContextLoongArch64;
> 
>  } EFI_SYSTEM_CONTEXT;
> 
> 
> 
>  //
> 
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
> 
> 
>  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> 
>  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> 
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
> 
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
>  #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x000B
> 
>  #elif defined (MDE_CPU_RISCV64)
> 
>  #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x001B
> 
> +#elif defined (MDE_CPU_LOONGARCH64)
> 
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE  0x0027
> 
>  #endif
> 
> 
> 
>  ///
> 
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
>  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
> 
>  Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
> 
>  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> 
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
> 
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
> @@ -246,6 +247,12 @@ typedef union {
>  #define EFI_IMAGE_MACHINE_RISCV64   0x5064
> 
>  #define EFI_IMAGE_MACHINE_RISCV128  0x5128
> 
> 
> 
> +///
> 
> +/// PE32+ Machine type for LoongArch 32/64 images.
> 
> +///
> 
> +#define EFI_IMAGE_MACHINE_LOONGARCH32  0x6232
> 
> +#define EFI_IMAGE_MACHINE_LOONGARCH64  0x6264
> 
> +
> 
>  #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> 
>    #if   defined (MDE_CPU_IA32)
> 
> 
> 
> @@ -278,6 +285,13 @@ typedef union {
>  #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> 
>    ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
> 
> 
> 
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)  (FALSE)
> 
> +
> 
> +  #elif defined (MDE_CPU_LOONGARCH64)
> 
> +
> 
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> 
> +    ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
> 
> +
> 
>  #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)  (FALSE)
> 
> 
> 
>    #elif defined (MDE_CPU_EBC)
> 
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
> 
> 
>  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
> 
>  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> 
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> 
> 
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
> @@ -2195,12 +2196,13 @@ typedef struct {
>  //
> 
>  // EFI File location to boot from on removable media devices
> 
>  //
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32     L"\\EFI\\BOOT\\BOOTIA32.EFI"
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64     L"\\EFI\\BOOT\\BOOTIA64.EFI"
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64      L"\\EFI\\BOOT\\BOOTX64.EFI"
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM      L"\\EFI\\BOOT\\BOOTARM.EFI"
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64  L"\\EFI\\BOOT\\BOOTAA64.EFI"
> 
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64  L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32         L"\\EFI\\BOOT\\BOOTIA32.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64         L"\\EFI\\BOOT\\BOOTIA64.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64          L"\\EFI\\BOOT\\BOOTX64.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM          L"\\EFI\\BOOT\\BOOTARM.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64      L"\\EFI\\BOOT\\BOOTAA64.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64      L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64  L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
> 
> 
> 
>  #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
> 
>    #if   defined (MDE_CPU_IA32)
> 
> @@ -2214,6 +2216,8 @@ typedef struct {
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
> 
>    #elif defined (MDE_CPU_RISCV64)
> 
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> 
> +  #elif defined (MDE_CPU_LOONGARCH64)
> 
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME  EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
> 
>    #else
> 
>      #error Unknown Processor Type
> 
>    #endif
> 
> --
> 2.27.0
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> Mute This Topic: https://groups.io/mt/93674237/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
> 


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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-23 15:46 ` [edk2-devel] " Michael D Kinney
@ 2022-09-24  2:16   ` Chao Li
  2022-09-24  2:33     ` Michael D Kinney
  0 siblings, 1 reply; 10+ messages in thread
From: Chao Li @ 2022-09-24  2:16 UTC (permalink / raw)
  To: "Kinney, Michael D"
  Cc: "devel@edk2.groups.io", "Gao, Liming",
	"Liu, Zhiguang"

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

Hi Mkie,
I responded to your comment below.

Thanks,
Chao
--------

On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com> wrote:
> One comment below.
>
> Mike
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
> > Sent: Wednesday, September 14, 2022 2:41 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: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
> >
> > Add LoongArch processor related definitions.
> >
> > For the Http boot and PXE boot types seeing this URL section "Processor
> > Architecture Type" for the LOONGARCH values:
> > https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
> >
> > For definitions of PE/COFF and LOONGARCH relocation types, see the
> > "Machine Types" and "Basic Relocation Types" sections of this URL for
> > LOONGARCH values:
> > https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
> >
> > For the register definitions of exceptions context, see the UEFI V2.10
> > 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> > definitions:
> > https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
> >
> > 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/Include/IndustryStandard/PeImage.h | 9 ++
> > MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> > MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> > MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> > MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> > 5 files changed, 136 insertions(+), 13 deletions(-)
> >
> > diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> > index 3109dc20f8..dd4cc25483 100644
> > --- a/MdePkg/Include/IndustryStandard/PeImage.h
> > +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> > @@ -10,6 +10,7 @@
> > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> >
> > Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> >
> > Portions Copyright (c) 2016 - 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
> >
> >
> >
> > @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > #define IMAGE_FILE_MACHINE_RISCV32 0x5032
> >
> > #define IMAGE_FILE_MACHINE_RISCV64 0x5064
> >
> > #define IMAGE_FILE_MACHINE_RISCV128 0x5128
> >
> > +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
> >
> > +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
> >
> >
> >
> > //
> >
> > // EXE file formats
> >
> > @@ -503,6 +506,12 @@ typedef struct {
> > #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
> >
> > #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
> >
> >
> >
> > +//
> >
> > +// Relocation types of LoongArch processor.
> >
> > +//
> >
> > +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
> >
> > +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
> >
> > +
> >
> > ///
> >
> > /// Line number format.
> >
> > ///
> >
> > diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> > index ec5b92a5c5..2b0ae2d157 100644
> > --- a/MdePkg/Include/Protocol/DebugSupport.h
> > +++ b/MdePkg/Include/Protocol/DebugSupport.h
> > @@ -654,17 +654,110 @@ typedef struct {
> > UINT64 X31;
> >
> > } EFI_SYSTEM_CONTEXT_RISCV64;
> >
> >
> >
> > +//
> >
> > +// LoongArch processor exception types.
> >
> > +//
> >
> > +#define EXCEPT_LOONGARCH_INT 0
> >
> > +#define EXCEPT_LOONGARCH_PIL 1
> >
> > +#define EXCEPT_LOONGARCH_PIS 2
> >
> > +#define EXCEPT_LOONGARCH_PIF 3
> >
> > +#define EXCEPT_LOONGARCH_PME 4
> >
> > +#define EXCEPT_LOONGARCH_PNR 5
> >
> > +#define EXCEPT_LOONGARCH_PNX 6
> >
> > +#define EXCEPT_LOONGARCH_PPI 7
> >
> > +#define EXCEPT_LOONGARCH_ADE 8
> >
> > +#define EXCEPT_LOONGARCH_ALE 9
> >
> > +#define EXCEPT_LOONGARCH_BCE 10
> >
> > +#define EXCEPT_LOONGARCH_SYS 11
> >
> > +#define EXCEPT_LOONGARCH_BRK 12
> >
> > +#define EXCEPT_LOONGARCH_INE 13
> >
> > +#define EXCEPT_LOONGARCH_IPE 14
> >
> > +#define EXCEPT_LOONGARCH_FPD 15
> >
> > +#define EXCEPT_LOONGARCH_SXD 16
> >
> > +#define EXCEPT_LOONGARCH_ASXD 17
> >
> > +#define EXCEPT_LOONGARCH_FPE 18
> >
> > +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> > independent exception.
> >
> > +
> >
> > +//
> >
> > +// LoongArch processor Interrupt types.
> >
> > +//
> >
> > +#define EXCEPT_LOONGARCH_INT_SIP0 0
> >
> > +#define EXCEPT_LOONGARCH_INT_SIP1 1
> >
> > +#define EXCEPT_LOONGARCH_INT_IP0 2
> >
> > +#define EXCEPT_LOONGARCH_INT_IP1 3
> >
> > +#define EXCEPT_LOONGARCH_INT_IP2 4
> >
> > +#define EXCEPT_LOONGARCH_INT_IP3 5
> >
> > +#define EXCEPT_LOONGARCH_INT_IP4 6
> >
> > +#define EXCEPT_LOONGARCH_INT_IP5 7
> >
> > +#define EXCEPT_LOONGARCH_INT_IP6 8
> >
> > +#define EXCEPT_LOONGARCH_INT_IP7 9
> >
> > +#define EXCEPT_LOONGARCH_INT_PMC 10
> >
> > +#define EXCEPT_LOONGARCH_INT_TIMER 11
> >
> > +#define EXCEPT_LOONGARCH_INT_IPI 12
> >
> > +
> >
> > +//
> >
> > +// For coding convenience, define the maximum valid
> >
> > +// LoongArch interrupt.
> >
> > +//
> >
> > +#define MAX_LOONGARCH_INTERRUPT 14
>
> Should this define be moved into the libs/modules that uses
> this define? Prefer to only see definitions from specs in
> this file.
>

Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
If you insist on your opinion, I can remove it in this file. So what's your opinion now?

>
> +
>
> +typedef struct {
>
> + UINT64 R0;
>
> + UINT64 R1;
>
> + UINT64 R2;
>
> + UINT64 R3;
>
> + UINT64 R4;
>
> + UINT64 R5;
>
> + UINT64 R6;
>
> + UINT64 R7;
>
> + UINT64 R8;
>
> + UINT64 R9;
>
> + UINT64 R10;
>
> + UINT64 R11;
>
> + UINT64 R12;
>
> + UINT64 R13;
>
> + UINT64 R14;
>
> + UINT64 R15;
>
> + UINT64 R16;
>
> + UINT64 R17;
>
> + UINT64 R18;
>
> + UINT64 R19;
>
> + UINT64 R20;
>
> + UINT64 R21;
>
> + UINT64 R22;
>
> + UINT64 R23;
>
> + UINT64 R24;
>
> + UINT64 R25;
>
> + UINT64 R26;
>
> + UINT64 R27;
>
> + UINT64 R28;
>
> + UINT64 R29;
>
> + UINT64 R30;
>
> + UINT64 R31;
>
> +
>
> + UINT64 CRMD; // CuRrent MoDe information
>
> + UINT64 PRMD; // PRe-exception MoDe information
>
> + UINT64 EUEN; // Extended component Unit ENable
>
> + UINT64 MISC; // MISCellaneous controller
>
> + UINT64 ECFG; // Exception ConFiGuration
>
> + UINT64 ESTAT; // Exception STATus
>
> + UINT64 ERA; // Exception Return Address
>
> + UINT64 BADV; // BAD Virtual address
>
> + UINT64 BADI; // BAD Instruction
>
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
>
> +
>
> ///
>
> /// Universal EFI_SYSTEM_CONTEXT definition.
>
> ///
>
> typedef union {
>
> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
>
> } EFI_SYSTEM_CONTEXT;
>
>
>
> //
>
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
>
> +#elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
>
> #endif
>
>
>
> ///
>
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -246,6 +247,12 @@ typedef union {
> #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
>
>
> +///
>
> +/// PE32+ Machine type for LoongArch 32/64 images.
>
> +///
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
>
> +
>
> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>
> #if defined (MDE_CPU_IA32)
>
>
>
> @@ -278,6 +285,13 @@ typedef union {
> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
>
>
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> +
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +
>
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
>
> +
>
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
>
>
> #elif defined (MDE_CPU_EBC)
>
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
>
>
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -2195,12 +2196,13 @@ typedef struct {
> //
>
> // EFI File location to boot from on removable media devices
>
> //
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
>
>
>
> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
>
> #if defined (MDE_CPU_IA32)
>
> @@ -2214,6 +2216,8 @@ typedef struct {
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
>
> #else
>
> #error Unknown Processor Type
>
> #endif
>
> --
> 2.27.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> Mute This Topic: https://groups.io/mt/93674237/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>


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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-24  2:16   ` Chao Li
@ 2022-09-24  2:33     ` Michael D Kinney
  2022-09-24  2:46       ` Chao Li
  0 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2022-09-24  2:33 UTC (permalink / raw)
  To: chao li, Kinney, Michael D
  Cc: "devel@edk2.groups.io", Gao, Liming, Liu, Zhiguang

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

If it is in spec, then the comment about “coding convenience” is not required.

Mike

From: chao li <lichao@loongson.cn>
Sent: Friday, September 23, 2022 7:17 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

Hi Mkie,
I responded to your comment below.


Thanks,
Chao
--------
On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>> wrote:
One comment below.

Mike

> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Chao Li
> Sent: Wednesday, September 14, 2022 2:41 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
> Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
>
> Add LoongArch processor related definitions.
>
> For the Http boot and PXE boot types seeing this URL section "Processor
> Architecture Type" for the LOONGARCH values:
> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
>
> For definitions of PE/COFF and LOONGARCH relocation types, see the
> "Machine Types" and "Basic Relocation Types" sections of this URL for
> LOONGARCH values:
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
>
> For the register definitions of exceptions context, see the UEFI V2.10
> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> definitions:
> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
>
> Signed-off-by: Chao Li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
> ---
> MdePkg/Include/IndustryStandard/PeImage.h | 9 ++
> MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> 5 files changed, 136 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..dd4cc25483 100644
> --- a/MdePkg/Include/IndustryStandard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> @@ -10,6 +10,7 @@
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>
> Portions Copyright (c) 2016 - 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
>
>
>
> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #define IMAGE_FILE_MACHINE_RISCV32 0x5032
>
> #define IMAGE_FILE_MACHINE_RISCV64 0x5064
>
> #define IMAGE_FILE_MACHINE_RISCV128 0x5128
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
>
>
>
> //
>
> // EXE file formats
>
> @@ -503,6 +506,12 @@ typedef struct {
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
>
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
>
>
>
> +//
>
> +// Relocation types of LoongArch processor.
>
> +//
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
>
> +
>
> ///
>
> /// Line number format.
>
> ///
>
> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> index ec5b92a5c5..2b0ae2d157 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,110 @@ typedef struct {
> UINT64 X31;
>
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
>
>
> +//
>
> +// LoongArch processor exception types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT 0
>
> +#define EXCEPT_LOONGARCH_PIL 1
>
> +#define EXCEPT_LOONGARCH_PIS 2
>
> +#define EXCEPT_LOONGARCH_PIF 3
>
> +#define EXCEPT_LOONGARCH_PME 4
>
> +#define EXCEPT_LOONGARCH_PNR 5
>
> +#define EXCEPT_LOONGARCH_PNX 6
>
> +#define EXCEPT_LOONGARCH_PPI 7
>
> +#define EXCEPT_LOONGARCH_ADE 8
>
> +#define EXCEPT_LOONGARCH_ALE 9
>
> +#define EXCEPT_LOONGARCH_BCE 10
>
> +#define EXCEPT_LOONGARCH_SYS 11
>
> +#define EXCEPT_LOONGARCH_BRK 12
>
> +#define EXCEPT_LOONGARCH_INE 13
>
> +#define EXCEPT_LOONGARCH_IPE 14
>
> +#define EXCEPT_LOONGARCH_FPD 15
>
> +#define EXCEPT_LOONGARCH_SXD 16
>
> +#define EXCEPT_LOONGARCH_ASXD 17
>
> +#define EXCEPT_LOONGARCH_FPE 18
>
> +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> independent exception.
>
> +
>
> +//
>
> +// LoongArch processor Interrupt types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT_SIP0 0
>
> +#define EXCEPT_LOONGARCH_INT_SIP1 1
>
> +#define EXCEPT_LOONGARCH_INT_IP0 2
>
> +#define EXCEPT_LOONGARCH_INT_IP1 3
>
> +#define EXCEPT_LOONGARCH_INT_IP2 4
>
> +#define EXCEPT_LOONGARCH_INT_IP3 5
>
> +#define EXCEPT_LOONGARCH_INT_IP4 6
>
> +#define EXCEPT_LOONGARCH_INT_IP5 7
>
> +#define EXCEPT_LOONGARCH_INT_IP6 8
>
> +#define EXCEPT_LOONGARCH_INT_IP7 9
>
> +#define EXCEPT_LOONGARCH_INT_PMC 10
>
> +#define EXCEPT_LOONGARCH_INT_TIMER 11
>
> +#define EXCEPT_LOONGARCH_INT_IPI 12
>
> +
>
> +//
>
> +// For coding convenience, define the maximum valid
>
> +// LoongArch interrupt.
>
> +//
>
> +#define MAX_LOONGARCH_INTERRUPT 14

Should this define be moved into the libs/modules that uses
this define? Prefer to only see definitions from specs in
this file.
Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
If you insist on your opinion, I can remove it in this file. So what's your opinion now?

>
> +
>
> +typedef struct {
>
> + UINT64 R0;
>
> + UINT64 R1;
>
> + UINT64 R2;
>
> + UINT64 R3;
>
> + UINT64 R4;
>
> + UINT64 R5;
>
> + UINT64 R6;
>
> + UINT64 R7;
>
> + UINT64 R8;
>
> + UINT64 R9;
>
> + UINT64 R10;
>
> + UINT64 R11;
>
> + UINT64 R12;
>
> + UINT64 R13;
>
> + UINT64 R14;
>
> + UINT64 R15;
>
> + UINT64 R16;
>
> + UINT64 R17;
>
> + UINT64 R18;
>
> + UINT64 R19;
>
> + UINT64 R20;
>
> + UINT64 R21;
>
> + UINT64 R22;
>
> + UINT64 R23;
>
> + UINT64 R24;
>
> + UINT64 R25;
>
> + UINT64 R26;
>
> + UINT64 R27;
>
> + UINT64 R28;
>
> + UINT64 R29;
>
> + UINT64 R30;
>
> + UINT64 R31;
>
> +
>
> + UINT64 CRMD; // CuRrent MoDe information
>
> + UINT64 PRMD; // PRe-exception MoDe information
>
> + UINT64 EUEN; // Extended component Unit ENable
>
> + UINT64 MISC; // MISCellaneous controller
>
> + UINT64 ECFG; // Exception ConFiGuration
>
> + UINT64 ESTAT; // Exception STATus
>
> + UINT64 ERA; // Exception Return Address
>
> + UINT64 BADV; // BAD Virtual address
>
> + UINT64 BADI; // BAD Instruction
>
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
>
> +
>
> ///
>
> /// Universal EFI_SYSTEM_CONTEXT definition.
>
> ///
>
> typedef union {
>
> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
>
> } EFI_SYSTEM_CONTEXT;
>
>
>
> //
>
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
>
> +#elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
>
> #endif
>
>
>
> ///
>
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -246,6 +247,12 @@ typedef union {
> #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
>
>
> +///
>
> +/// PE32+ Machine type for LoongArch 32/64 images.
>
> +///
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
>
> +
>
> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>
> #if defined (MDE_CPU_IA32)
>
>
>
> @@ -278,6 +285,13 @@ typedef union {
> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
>
>
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> +
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +
>
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
>
> +
>
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
>
>
> #elif defined (MDE_CPU_EBC)
>
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
>
>
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -2195,12 +2196,13 @@ typedef struct {
> //
>
> // EFI File location to boot from on removable media devices
>
> //
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI<file://EFI/BOOT/BOOTLOONGARCH64.EFI>"
>
>
>
> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
>
> #if defined (MDE_CPU_IA32)
>
> @@ -2214,6 +2216,8 @@ typedef struct {
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
>
> #else
>
> #error Unknown Processor Type
>
> #endif
>
> --
> 2.27.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> Mute This Topic: https://groups.io/mt/93674237/1643496
> Group Owner: devel+owner@edk2.groups.io<mailto:devel+owner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>

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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-24  2:33     ` Michael D Kinney
@ 2022-09-24  2:46       ` Chao Li
  2022-09-24 15:07         ` Michael D Kinney
  0 siblings, 1 reply; 10+ messages in thread
From: Chao Li @ 2022-09-24  2:46 UTC (permalink / raw)
  To: "Kinney, Michael D"
  Cc: "\"devel@edk2.groups.io\"", "Gao, Liming",
	"Liu, Zhiguang"

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

Mike,
Do you mean patches 0001 and 0002? If yes, I have tried removing both the two patches, but the Azure CI always produces the ECC errors, I have no idea how to fix them, so modify the CI YAM file to fix them, and Liming also recommends this way.

Thanks,
Chao
--------

On 9月 24 2022, at 10:33 上午, "Kinney, Michael D" <michael.d.kinney@intel.com> wrote:
>
> If it is in spec, then the comment about “coding convenience” is not required.
>
>
> Mike
>
> From: chao li <lichao@loongson.cn>
> Sent: Friday, September 23, 2022 7:17 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>
> Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
>
>
>
>
> Hi Mkie,
> I responded to your comment below.
>
>
>
>
> Thanks,
> Chao
> --------
>
>
> On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)> wrote:
>
> > One comment below.
> >
> >
> >
> > Mike
> >
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io (mailto:devel@edk2.groups.io) <devel@edk2.groups.io (mailto:devel@edk2.groups.io)> On Behalf Of Chao Li
> >
> > > Sent: Wednesday, September 14, 2022 2:41 AM
> >
> > > To: devel@edk2.groups.io (mailto:devel@edk2.groups.io)
> >
> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>; Gao, Liming <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>; Liu, Zhiguang <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> >
> > > Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
> >
> > >
> >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
> >
> > >
> >
> > > Add LoongArch processor related definitions.
> >
> > >
> >
> > > For the Http boot and PXE boot types seeing this URL section "Processor
> >
> > > Architecture Type" for the LOONGARCH values:
> >
> > > https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
> >
> > >
> >
> > > For definitions of PE/COFF and LOONGARCH relocation types, see the
> >
> > > "Machine Types" and "Basic Relocation Types" sections of this URL for
> >
> > > LOONGARCH values:
> >
> > > https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
> >
> > >
> >
> > > For the register definitions of exceptions context, see the UEFI V2.10
> >
> > > 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> >
> > > definitions:
> >
> > > https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
> >
> > >
> >
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>
> >
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>
> >
> > > Cc: Zhiguang Liu <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> >
> > >
> >
> > > Signed-off-by: Chao Li <lichao@loongson.cn (mailto:lichao@loongson.cn)>
> >
> > > ---
> >
> > > MdePkg/Include/IndustryStandard/PeImage.h | 9 ++
> >
> > > MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> >
> > > MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> >
> > > MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> >
> > > MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> >
> > > 5 files changed, 136 insertions(+), 13 deletions(-)
> >
> > >
> >
> > > diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> >
> > > index 3109dc20f8..dd4cc25483 100644
> >
> > > --- a/MdePkg/Include/IndustryStandard/PeImage.h
> >
> > > +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> >
> > > @@ -10,6 +10,7 @@
> >
> > > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> >
> > >
> >
> > > Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> >
> > >
> >
> > > Portions Copyright (c) 2016 - 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
> >
> > >
> >
> > >
> >
> > >
> >
> > > @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> > > #define IMAGE_FILE_MACHINE_RISCV32 0x5032
> >
> > >
> >
> > > #define IMAGE_FILE_MACHINE_RISCV64 0x5064
> >
> > >
> >
> > > #define IMAGE_FILE_MACHINE_RISCV128 0x5128
> >
> > >
> >
> > > +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
> >
> > >
> >
> > > +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
> >
> > >
> >
> > >
> >
> > >
> >
> > > //
> >
> > >
> >
> > > // EXE file formats
> >
> > >
> >
> > > @@ -503,6 +506,12 @@ typedef struct {
> >
> > > #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
> >
> > >
> >
> > > #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
> >
> > >
> >
> > >
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +// Relocation types of LoongArch processor.
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
> >
> > >
> >
> > > +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
> >
> > >
> >
> > > +
> >
> > >
> >
> > > ///
> >
> > >
> >
> > > /// Line number format.
> >
> > >
> >
> > > ///
> >
> > >
> >
> > > diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> >
> > > index ec5b92a5c5..2b0ae2d157 100644
> >
> > > --- a/MdePkg/Include/Protocol/DebugSupport.h
> >
> > > +++ b/MdePkg/Include/Protocol/DebugSupport.h
> >
> > > @@ -654,17 +654,110 @@ typedef struct {
> >
> > > UINT64 X31;
> >
> > >
> >
> > > } EFI_SYSTEM_CONTEXT_RISCV64;
> >
> > >
> >
> > >
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +// LoongArch processor exception types.
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT 0
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PIL 1
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PIS 2
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PIF 3
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PME 4
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PNR 5
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PNX 6
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_PPI 7
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_ADE 8
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_ALE 9
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_BCE 10
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_SYS 11
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_BRK 12
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INE 13
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_IPE 14
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_FPD 15
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_SXD 16
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_ASXD 17
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_FPE 18
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> >
> > > independent exception.
> >
> > >
> >
> > > +
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +// LoongArch processor Interrupt types.
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_SIP0 0
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_SIP1 1
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP0 2
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP1 3
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP2 4
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP3 5
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP4 6
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP5 7
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP6 8
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IP7 9
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_PMC 10
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_TIMER 11
> >
> > >
> >
> > > +#define EXCEPT_LOONGARCH_INT_IPI 12
> >
> > >
> >
> > > +
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +// For coding convenience, define the maximum valid
> >
> > >
> >
> > > +// LoongArch interrupt.
> >
> > >
> >
> > > +//
> >
> > >
> >
> > > +#define MAX_LOONGARCH_INTERRUPT 14
> >
> >
> >
> > Should this define be moved into the libs/modules that uses
> > this define? Prefer to only see definitions from specs in
> >
> > this file.
> >
> >
>
> Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
>
> If you insist on your opinion, I can remove it in this file. So what's your opinion now?
>
>
>
> >
> > +
>
> >
>
> > +typedef struct {
>
> >
>
> > + UINT64 R0;
>
> >
>
> > + UINT64 R1;
>
> >
>
> > + UINT64 R2;
>
> >
>
> > + UINT64 R3;
>
> >
>
> > + UINT64 R4;
>
> >
>
> > + UINT64 R5;
>
> >
>
> > + UINT64 R6;
>
> >
>
> > + UINT64 R7;
>
> >
>
> > + UINT64 R8;
>
> >
>
> > + UINT64 R9;
>
> >
>
> > + UINT64 R10;
>
> >
>
> > + UINT64 R11;
>
> >
>
> > + UINT64 R12;
>
> >
>
> > + UINT64 R13;
>
> >
>
> > + UINT64 R14;
>
> >
>
> > + UINT64 R15;
>
> >
>
> > + UINT64 R16;
>
> >
>
> > + UINT64 R17;
>
> >
>
> > + UINT64 R18;
>
> >
>
> > + UINT64 R19;
>
> >
>
> > + UINT64 R20;
>
> >
>
> > + UINT64 R21;
>
> >
>
> > + UINT64 R22;
>
> >
>
> > + UINT64 R23;
>
> >
>
> > + UINT64 R24;
>
> >
>
> > + UINT64 R25;
>
> >
>
> > + UINT64 R26;
>
> >
>
> > + UINT64 R27;
>
> >
>
> > + UINT64 R28;
>
> >
>
> > + UINT64 R29;
>
> >
>
> > + UINT64 R30;
>
> >
>
> > + UINT64 R31;
>
> >
>
> > +
>
> >
>
> > + UINT64 CRMD; // CuRrent MoDe information
>
> >
>
> > + UINT64 PRMD; // PRe-exception MoDe information
>
> >
>
> > + UINT64 EUEN; // Extended component Unit ENable
>
> >
>
> > + UINT64 MISC; // MISCellaneous controller
>
> >
>
> > + UINT64 ECFG; // Exception ConFiGuration
>
> >
>
> > + UINT64 ESTAT; // Exception STATus
>
> >
>
> > + UINT64 ERA; // Exception Return Address
>
> >
>
> > + UINT64 BADV; // BAD Virtual address
>
> >
>
> > + UINT64 BADI; // BAD Instruction
>
> >
>
> > +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
>
> >
>
> > +
>
> >
>
> > ///
>
> >
>
> > /// Universal EFI_SYSTEM_CONTEXT definition.
>
> >
>
> > ///
>
> >
>
> > typedef union {
>
> >
>
> > - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> >
>
> > - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> >
>
> > + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
>
> >
>
> > } EFI_SYSTEM_CONTEXT;
>
> >
>
> >
>
> >
>
> > //
>
> >
>
> > diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
>
> > index 11872d602d..6787941a5d 100644
>
> > --- a/MdePkg/Include/Protocol/PxeBaseCode.h
>
> > +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
>
> > @@ -4,6 +4,7 @@
>
> >
>
> >
>
> > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> >
>
> > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> >
>
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
> >
>
> >
>
> >
>
> > SPDX-License-Identifier: BSD-2-Clause-Patent
>
> >
>
> >
>
> >
>
> > @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
>
> > #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> >
>
> > #elif defined (MDE_CPU_RISCV64)
>
> >
>
> > #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
>
> >
>
> > +#elif defined (MDE_CPU_LOONGARCH64)
>
> >
>
> > +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
>
> >
>
> > #endif
>
> >
>
> >
>
> >
>
> > ///
>
> >
>
> > diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
>
> > index 4a34ce8e25..83975a08eb 100644
>
> > --- a/MdePkg/Include/Uefi/UefiBaseType.h
>
> > +++ b/MdePkg/Include/Uefi/UefiBaseType.h
>
> > @@ -4,6 +4,7 @@
>
> > Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> >
>
> > Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>
> >
>
> > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> >
>
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
> >
>
> >
>
> >
>
> > SPDX-License-Identifier: BSD-2-Clause-Patent
>
> >
>
> >
>
> >
>
> > @@ -246,6 +247,12 @@ typedef union {
>
> > #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> >
>
> > #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
> >
>
> >
>
> >
>
> > +///
>
> >
>
> > +/// PE32+ Machine type for LoongArch 32/64 images.
>
> >
>
> > +///
>
> >
>
> > +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
>
> >
>
> > +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
>
> >
>
> > +
>
> >
>
> > #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>
> >
>
> > #if defined (MDE_CPU_IA32)
>
> >
>
> >
>
> >
>
> > @@ -278,6 +285,13 @@ typedef union {
>
> > #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> >
>
> > ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
> >
>
> >
>
> >
>
> > +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> >
>
> > +
>
> >
>
> > + #elif defined (MDE_CPU_LOONGARCH64)
>
> >
>
> > +
>
> >
>
> > +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> >
>
> > + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
>
> >
>
> > +
>
> >
>
> > #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> >
>
> >
>
> >
>
> > #elif defined (MDE_CPU_EBC)
>
> >
>
> > diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
>
> > index 2b38b100f6..3abebbb8d9 100644
>
> > --- a/MdePkg/Include/Uefi/UefiSpec.h
>
> > +++ b/MdePkg/Include/Uefi/UefiSpec.h
>
> > @@ -7,6 +7,7 @@
>
> >
>
> >
>
> > Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> >
>
> > Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> >
>
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
> >
>
> >
>
> >
>
> > SPDX-License-Identifier: BSD-2-Clause-Patent
>
> >
>
> >
>
> >
>
> > @@ -2195,12 +2196,13 @@ typedef struct {
>
> > //
>
> >
>
> > // EFI File location to boot from on removable media devices
>
> >
>
> > //
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
>
> >
>
> > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
>
> >
>
> >
>
> >
>
> > #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
>
> >
>
> > #if defined (MDE_CPU_IA32)
>
> >
>
> > @@ -2214,6 +2216,8 @@ typedef struct {
>
> > #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> >
>
> > #elif defined (MDE_CPU_RISCV64)
>
> >
>
> > #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
>
> >
>
> > + #elif defined (MDE_CPU_LOONGARCH64)
>
> >
>
> > +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
>
> >
>
> > #else
>
> >
>
> > #error Unknown Processor Type
>
> >
>
> > #endif
>
> >
>
> > --
>
> > 2.27.0
>
> >
>
> >
>
> >
>
> > -=-=-=-=-=-=
>
> > Groups.io Links: You receive all messages sent to this group.
>
> > View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
>
> > Mute This Topic: https://groups.io/mt/93674237/1643496
>
> > Group Owner: devel+owner@edk2.groups.io (mailto:devel+owner@edk2.groups.io)
>
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
>
> > -=-=-=-=-=-=
>
> >
>
>
>
>


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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-24  2:46       ` Chao Li
@ 2022-09-24 15:07         ` Michael D Kinney
  2022-09-27  0:55           ` 回复: " gaoliming
  0 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2022-09-24 15:07 UTC (permalink / raw)
  To: chao li, Kinney, Michael D
  Cc: "\"devel@edk2.groups.io\"", Gao, Liming,
	Liu, Zhiguang

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

I am referring to this code comment.

> +//
>
> +// For coding convenience, define the maximum valid
>
> +// LoongArch interrupt.
>
> +//
>
> +#define MAX_LOONGARCH_INTERRUPT 14

Mike


From: chao li <lichao@loongson.cn>
Sent: Friday, September 23, 2022 7:46 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>
Cc: "\"devel@edk2.groups.io\"" <devel@edk2.groups.io>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

Mike,
Do you mean patches 0001 and 0002? If yes, I have tried removing both the two patches, but the Azure CI always produces the ECC errors, I have no idea how to fix them, so modify the CI YAM file to fix them, and Liming also recommends this way.


Thanks,
Chao
--------
On 9月 24 2022, at 10:33 上午, "Kinney, Michael D" <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>> wrote:

If it is in spec, then the comment about “coding convenience” is not required.



Mike



From: chao li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
Sent: Friday, September 23, 2022 7:17 PM
To: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: "devel@edk2.groups.io<mailto:devel@edk2.groups.io>" <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.


Hi Mkie,
I responded to your comment below.



Thanks,
Chao
--------
On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>> wrote:
One comment below.


Mike


> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Chao Li
> Sent: Wednesday, September 14, 2022 2:41 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
> Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
>
> Add LoongArch processor related definitions.
>
> For the Http boot and PXE boot types seeing this URL section "Processor
> Architecture Type" for the LOONGARCH values:
> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
>
> For definitions of PE/COFF and LOONGARCH relocation types, see the
> "Machine Types" and "Basic Relocation Types" sections of this URL for
> LOONGARCH values:
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
>
> For the register definitions of exceptions context, see the UEFI V2.10
> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> definitions:
> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
>
> Signed-off-by: Chao Li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
> ---
> MdePkg/Include/IndustryStandard/PeImage.h | 9 ++
> MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> 5 files changed, 136 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..dd4cc25483 100644
> --- a/MdePkg/Include/IndustryStandard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> @@ -10,6 +10,7 @@
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>
> Portions Copyright (c) 2016 - 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
>
>
>
> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #define IMAGE_FILE_MACHINE_RISCV32 0x5032
>
> #define IMAGE_FILE_MACHINE_RISCV64 0x5064
>
> #define IMAGE_FILE_MACHINE_RISCV128 0x5128
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
>
>
>
> //
>
> // EXE file formats
>
> @@ -503,6 +506,12 @@ typedef struct {
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
>
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
>
>
>
> +//
>
> +// Relocation types of LoongArch processor.
>
> +//
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
>
> +
>
> ///
>
> /// Line number format.
>
> ///
>
> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> index ec5b92a5c5..2b0ae2d157 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,110 @@ typedef struct {
> UINT64 X31;
>
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
>
>
> +//
>
> +// LoongArch processor exception types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT 0
>
> +#define EXCEPT_LOONGARCH_PIL 1
>
> +#define EXCEPT_LOONGARCH_PIS 2
>
> +#define EXCEPT_LOONGARCH_PIF 3
>
> +#define EXCEPT_LOONGARCH_PME 4
>
> +#define EXCEPT_LOONGARCH_PNR 5
>
> +#define EXCEPT_LOONGARCH_PNX 6
>
> +#define EXCEPT_LOONGARCH_PPI 7
>
> +#define EXCEPT_LOONGARCH_ADE 8
>
> +#define EXCEPT_LOONGARCH_ALE 9
>
> +#define EXCEPT_LOONGARCH_BCE 10
>
> +#define EXCEPT_LOONGARCH_SYS 11
>
> +#define EXCEPT_LOONGARCH_BRK 12
>
> +#define EXCEPT_LOONGARCH_INE 13
>
> +#define EXCEPT_LOONGARCH_IPE 14
>
> +#define EXCEPT_LOONGARCH_FPD 15
>
> +#define EXCEPT_LOONGARCH_SXD 16
>
> +#define EXCEPT_LOONGARCH_ASXD 17
>
> +#define EXCEPT_LOONGARCH_FPE 18
>
> +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> independent exception.
>
> +
>
> +//
>
> +// LoongArch processor Interrupt types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT_SIP0 0
>
> +#define EXCEPT_LOONGARCH_INT_SIP1 1
>
> +#define EXCEPT_LOONGARCH_INT_IP0 2
>
> +#define EXCEPT_LOONGARCH_INT_IP1 3
>
> +#define EXCEPT_LOONGARCH_INT_IP2 4
>
> +#define EXCEPT_LOONGARCH_INT_IP3 5
>
> +#define EXCEPT_LOONGARCH_INT_IP4 6
>
> +#define EXCEPT_LOONGARCH_INT_IP5 7
>
> +#define EXCEPT_LOONGARCH_INT_IP6 8
>
> +#define EXCEPT_LOONGARCH_INT_IP7 9
>
> +#define EXCEPT_LOONGARCH_INT_PMC 10
>
> +#define EXCEPT_LOONGARCH_INT_TIMER 11
>
> +#define EXCEPT_LOONGARCH_INT_IPI 12
>
> +
>
> +//
>
> +// For coding convenience, define the maximum valid
>
> +// LoongArch interrupt.
>
> +//
>
> +#define MAX_LOONGARCH_INTERRUPT 14


Should this define be moved into the libs/modules that uses
this define? Prefer to only see definitions from specs in
this file.
Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
If you insist on your opinion, I can remove it in this file. So what's your opinion now?


>
> +
>
> +typedef struct {
>
> + UINT64 R0;
>
> + UINT64 R1;
>
> + UINT64 R2;
>
> + UINT64 R3;
>
> + UINT64 R4;
>
> + UINT64 R5;
>
> + UINT64 R6;
>
> + UINT64 R7;
>
> + UINT64 R8;
>
> + UINT64 R9;
>
> + UINT64 R10;
>
> + UINT64 R11;
>
> + UINT64 R12;
>
> + UINT64 R13;
>
> + UINT64 R14;
>
> + UINT64 R15;
>
> + UINT64 R16;
>
> + UINT64 R17;
>
> + UINT64 R18;
>
> + UINT64 R19;
>
> + UINT64 R20;
>
> + UINT64 R21;
>
> + UINT64 R22;
>
> + UINT64 R23;
>
> + UINT64 R24;
>
> + UINT64 R25;
>
> + UINT64 R26;
>
> + UINT64 R27;
>
> + UINT64 R28;
>
> + UINT64 R29;
>
> + UINT64 R30;
>
> + UINT64 R31;
>
> +
>
> + UINT64 CRMD; // CuRrent MoDe information
>
> + UINT64 PRMD; // PRe-exception MoDe information
>
> + UINT64 EUEN; // Extended component Unit ENable
>
> + UINT64 MISC; // MISCellaneous controller
>
> + UINT64 ECFG; // Exception ConFiGuration
>
> + UINT64 ESTAT; // Exception STATus
>
> + UINT64 ERA; // Exception Return Address
>
> + UINT64 BADV; // BAD Virtual address
>
> + UINT64 BADI; // BAD Instruction
>
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
>
> +
>
> ///
>
> /// Universal EFI_SYSTEM_CONTEXT definition.
>
> ///
>
> typedef union {
>
> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
>
> } EFI_SYSTEM_CONTEXT;
>
>
>
> //
>
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
>
> +#elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
>
> #endif
>
>
>
> ///
>
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -246,6 +247,12 @@ typedef union {
> #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
>
>
> +///
>
> +/// PE32+ Machine type for LoongArch 32/64 images.
>
> +///
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
>
> +
>
> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>
> #if defined (MDE_CPU_IA32)
>
>
>
> @@ -278,6 +285,13 @@ typedef union {
> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
>
>
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> +
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +
>
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
>
> +
>
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
>
>
> #elif defined (MDE_CPU_EBC)
>
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
>
>
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -2195,12 +2196,13 @@ typedef struct {
> //
>
> // EFI File location to boot from on removable media devices
>
> //
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI<file://EFI/BOOT/BOOTLOONGARCH64.EFI>"
>
>
>
> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
>
> #if defined (MDE_CPU_IA32)
>
> @@ -2214,6 +2216,8 @@ typedef struct {
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
>
> #else
>
> #error Unknown Processor Type
>
> #endif
>
> --
> 2.27.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> Mute This Topic: https://groups.io/mt/93674237/1643496
> Group Owner: devel+owner@edk2.groups.io<mailto:devel+owner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>

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

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

* 回复: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-24 15:07         ` Michael D Kinney
@ 2022-09-27  0:55           ` gaoliming
  2022-09-27  1:01             ` Michael D Kinney
  0 siblings, 1 reply; 10+ messages in thread
From: gaoliming @ 2022-09-27  0:55 UTC (permalink / raw)
  To: devel, michael.d.kinney, 'chao li'; +Cc: 'Liu, Zhiguang'

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

Mike:

 The comment “For coding convenience, define the maximum valid LoonArch interrupt.” is also defined in UEFI2.10 spec 18.2.5 EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback().

 

  So, I think it is fine to keep this comment in MdePkg Include header file. 

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Michael D Kinney
发送时间: 2022年9月24日 23:08
收件人: chao li <lichao@loongson.cn>; Kinney, Michael D <michael.d.kinney@intel.com>
抄送: "\"devel@edk2.groups.io\"" <devel@edk2.groups.io>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
主题: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

 

I am referring to this code comment.

 

> +//

> 

> +// For coding convenience, define the maximum valid

> 

> +// LoongArch interrupt.

> 

> +//

> 

> +#define MAX_LOONGARCH_INTERRUPT 14

 

Mike

 

 

From: chao li <lichao@loongson.cn <mailto:lichao@loongson.cn> > 
Sent: Friday, September 23, 2022 7:46 PM
To: Kinney, Michael D <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Cc: "\"devel@edk2.groups.io\"" <devel@edk2.groups.io <mailto:devel@edk2.groups.io> >; Gao, Liming <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Liu, Zhiguang <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

 

Mike,

Do you mean patches 0001 and 0002? If yes, I have tried removing both the two patches, but the Azure CI always produces the ECC errors, I have no idea how to fix them, so modify the CI YAM file to fix them, and Liming also recommends this way.

 


Thanks,
Chao
--------

On 9月 24 2022, at 10:33 上午, "Kinney, Michael D" <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> > wrote:

    

If it is in spec, then the comment about “coding convenience” is not required.

 

 

 

Mike

 

 

 

From: chao li <lichao@loongson.cn <mailto:lichao@loongson.cn> >

Sent: Friday, September 23, 2022 7:17 PM

To: Kinney, Michael D <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >

Cc: "devel@edk2.groups.io <mailto:devel@edk2.groups.io> " <devel@edk2.groups.io <mailto:devel@edk2.groups.io> >; Gao, Liming <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Liu, Zhiguang <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >

Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

 

 

Hi Mkie,

I responded to your comment below.

 

 

 

Thanks,

Chao

--------

On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> > wrote:

One comment below.

 

 

Mike

 

 

> -----Original Message-----

> From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Chao Li

> Sent: Wednesday, September 14, 2022 2:41 AM

> To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> 

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

> Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

> 

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

> 

> Add LoongArch processor related definitions.

> 

> For the Http boot and PXE boot types seeing this URL section "Processor

> Architecture Type" for the LOONGARCH values:

> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml

> 

> For definitions of PE/COFF and LOONGARCH relocation types, see the

> "Machine Types" and "Basic Relocation Types" sections of this URL for

> LOONGARCH values:

> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format

> 

> For the register definitions of exceptions context, see the UEFI V2.10

> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH

> definitions:

> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html

> 

> Cc: Michael D Kinney <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >

> Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >

> Cc: Zhiguang Liu <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >

> 

> Signed-off-by: Chao Li <lichao@loongson.cn <mailto:lichao@loongson.cn> >

> ---

> MdePkg/Include/IndustryStandard/PeImage.h | 9 ++

> MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--

> MdePkg/Include/Protocol/PxeBaseCode.h | 3 +

> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++

> MdePkg/Include/Uefi/UefiSpec.h | 16 ++--

> 5 files changed, 136 insertions(+), 13 deletions(-)

> 

> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h

> index 3109dc20f8..dd4cc25483 100644

> --- a/MdePkg/Include/IndustryStandard/PeImage.h

> +++ b/MdePkg/Include/IndustryStandard/PeImage.h

> @@ -10,6 +10,7 @@

> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>

> 

> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

> 

> Portions Copyright (c) 2016 - 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

> 

> 

> 

> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

> #define IMAGE_FILE_MACHINE_RISCV32 0x5032

> 

> #define IMAGE_FILE_MACHINE_RISCV64 0x5064

> 

> #define IMAGE_FILE_MACHINE_RISCV128 0x5128

> 

> +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232

> 

> +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264

> 

> 

> 

> //

> 

> // EXE file formats

> 

> @@ -503,6 +506,12 @@ typedef struct {

> #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7

> 

> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8

> 

> 

> 

> +//

> 

> +// Relocation types of LoongArch processor.

> 

> +//

> 

> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8

> 

> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8

> 

> +

> 

> ///

> 

> /// Line number format.

> 

> ///

> 

> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h

> index ec5b92a5c5..2b0ae2d157 100644

> --- a/MdePkg/Include/Protocol/DebugSupport.h

> +++ b/MdePkg/Include/Protocol/DebugSupport.h

> @@ -654,17 +654,110 @@ typedef struct {

> UINT64 X31;

> 

> } EFI_SYSTEM_CONTEXT_RISCV64;

> 

> 

> 

> +//

> 

> +// LoongArch processor exception types.

> 

> +//

> 

> +#define EXCEPT_LOONGARCH_INT 0

> 

> +#define EXCEPT_LOONGARCH_PIL 1

> 

> +#define EXCEPT_LOONGARCH_PIS 2

> 

> +#define EXCEPT_LOONGARCH_PIF 3

> 

> +#define EXCEPT_LOONGARCH_PME 4

> 

> +#define EXCEPT_LOONGARCH_PNR 5

> 

> +#define EXCEPT_LOONGARCH_PNX 6

> 

> +#define EXCEPT_LOONGARCH_PPI 7

> 

> +#define EXCEPT_LOONGARCH_ADE 8

> 

> +#define EXCEPT_LOONGARCH_ALE 9

> 

> +#define EXCEPT_LOONGARCH_BCE 10

> 

> +#define EXCEPT_LOONGARCH_SYS 11

> 

> +#define EXCEPT_LOONGARCH_BRK 12

> 

> +#define EXCEPT_LOONGARCH_INE 13

> 

> +#define EXCEPT_LOONGARCH_IPE 14

> 

> +#define EXCEPT_LOONGARCH_FPD 15

> 

> +#define EXCEPT_LOONGARCH_SXD 16

> 

> +#define EXCEPT_LOONGARCH_ASXD 17

> 

> +#define EXCEPT_LOONGARCH_FPE 18

> 

> +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an

> independent exception.

> 

> +

> 

> +//

> 

> +// LoongArch processor Interrupt types.

> 

> +//

> 

> +#define EXCEPT_LOONGARCH_INT_SIP0 0

> 

> +#define EXCEPT_LOONGARCH_INT_SIP1 1

> 

> +#define EXCEPT_LOONGARCH_INT_IP0 2

> 

> +#define EXCEPT_LOONGARCH_INT_IP1 3

> 

> +#define EXCEPT_LOONGARCH_INT_IP2 4

> 

> +#define EXCEPT_LOONGARCH_INT_IP3 5

> 

> +#define EXCEPT_LOONGARCH_INT_IP4 6

> 

> +#define EXCEPT_LOONGARCH_INT_IP5 7

> 

> +#define EXCEPT_LOONGARCH_INT_IP6 8

> 

> +#define EXCEPT_LOONGARCH_INT_IP7 9

> 

> +#define EXCEPT_LOONGARCH_INT_PMC 10

> 

> +#define EXCEPT_LOONGARCH_INT_TIMER 11

> 

> +#define EXCEPT_LOONGARCH_INT_IPI 12

> 

> +

> 

> +//

> 

> +// For coding convenience, define the maximum valid

> 

> +// LoongArch interrupt.

> 

> +//

> 

> +#define MAX_LOONGARCH_INTERRUPT 14

 

 

Should this define be moved into the libs/modules that uses

this define? Prefer to only see definitions from specs in

this file.

Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.

If you insist on your opinion, I can remove it in this file. So what's your opinion now?

 

 

> 

> +

> 

> +typedef struct {

> 

> + UINT64 R0;

> 

> + UINT64 R1;

> 

> + UINT64 R2;

> 

> + UINT64 R3;

> 

> + UINT64 R4;

> 

> + UINT64 R5;

> 

> + UINT64 R6;

> 

> + UINT64 R7;

> 

> + UINT64 R8;

> 

> + UINT64 R9;

> 

> + UINT64 R10;

> 

> + UINT64 R11;

> 

> + UINT64 R12;

> 

> + UINT64 R13;

> 

> + UINT64 R14;

> 

> + UINT64 R15;

> 

> + UINT64 R16;

> 

> + UINT64 R17;

> 

> + UINT64 R18;

> 

> + UINT64 R19;

> 

> + UINT64 R20;

> 

> + UINT64 R21;

> 

> + UINT64 R22;

> 

> + UINT64 R23;

> 

> + UINT64 R24;

> 

> + UINT64 R25;

> 

> + UINT64 R26;

> 

> + UINT64 R27;

> 

> + UINT64 R28;

> 

> + UINT64 R29;

> 

> + UINT64 R30;

> 

> + UINT64 R31;

> 

> +

> 

> + UINT64 CRMD; // CuRrent MoDe information

> 

> + UINT64 PRMD; // PRe-exception MoDe information

> 

> + UINT64 EUEN; // Extended component Unit ENable

> 

> + UINT64 MISC; // MISCellaneous controller

> 

> + UINT64 ECFG; // Exception ConFiGuration

> 

> + UINT64 ESTAT; // Exception STATus

> 

> + UINT64 ERA; // Exception Return Address

> 

> + UINT64 BADV; // BAD Virtual address

> 

> + UINT64 BADI; // BAD Instruction

> 

> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;

> 

> +

> 

> ///

> 

> /// Universal EFI_SYSTEM_CONTEXT definition.

> 

> ///

> 

> typedef union {

> 

> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;

> 

> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;

> 

> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;

> 

> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;

> 

> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;

> 

> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;

> 

> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;

> 

> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;

> 

> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;

> 

> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;

> 

> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;

> 

> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;

> 

> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;

> 

> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;

> 

> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;

> 

> } EFI_SYSTEM_CONTEXT;

> 

> 

> 

> //

> 

> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h

> index 11872d602d..6787941a5d 100644

> --- a/MdePkg/Include/Protocol/PxeBaseCode.h

> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h

> @@ -4,6 +4,7 @@

> 

> 

> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>

> 

> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>

> 

> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>

> 

> 

> 

> SPDX-License-Identifier: BSD-2-Clause-Patent

> 

> 

> 

> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;

> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B

> 

> #elif defined (MDE_CPU_RISCV64)

> 

> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B

> 

> +#elif defined (MDE_CPU_LOONGARCH64)

> 

> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027

> 

> #endif

> 

> 

> 

> ///

> 

> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h

> index 4a34ce8e25..83975a08eb 100644

> --- a/MdePkg/Include/Uefi/UefiBaseType.h

> +++ b/MdePkg/Include/Uefi/UefiBaseType.h

> @@ -4,6 +4,7 @@

> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>

> 

> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>

> 

> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>

> 

> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>

> 

> 

> 

> SPDX-License-Identifier: BSD-2-Clause-Patent

> 

> 

> 

> @@ -246,6 +247,12 @@ typedef union {

> #define EFI_IMAGE_MACHINE_RISCV64 0x5064

> 

> #define EFI_IMAGE_MACHINE_RISCV128 0x5128

> 

> 

> 

> +///

> 

> +/// PE32+ Machine type for LoongArch 32/64 images.

> 

> +///

> 

> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232

> 

> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264

> 

> +

> 

> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)

> 

> #if defined (MDE_CPU_IA32)

> 

> 

> 

> @@ -278,6 +285,13 @@ typedef union {

> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \

> 

> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)

> 

> 

> 

> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)

> 

> +

> 

> + #elif defined (MDE_CPU_LOONGARCH64)

> 

> +

> 

> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \

> 

> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)

> 

> +

> 

> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)

> 

> 

> 

> #elif defined (MDE_CPU_EBC)

> 

> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h

> index 2b38b100f6..3abebbb8d9 100644

> --- a/MdePkg/Include/Uefi/UefiSpec.h

> +++ b/MdePkg/Include/Uefi/UefiSpec.h

> @@ -7,6 +7,7 @@

> 

> 

> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>

> 

> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>

> 

> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>

> 

> 

> 

> SPDX-License-Identifier: BSD-2-Clause-Patent

> 

> 

> 

> @@ -2195,12 +2196,13 @@ typedef struct {

> //

> 

> // EFI File location to boot from on removable media devices

> 

> //

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI <file://EFI/BOOT/BOOTIA32.EFI> "

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI <file://EFI/BOOT/BOOTIA64.EFI> "

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI <file://EFI/BOOT/BOOTX64.EFI> "

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI <file://EFI/BOOT/BOOTARM.EFI> "

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI <file://EFI/BOOT/BOOTAA64.EFI> "

> 

> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI <file://EFI/BOOT/BOOTRISCV64.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI <file://EFI/BOOT/BOOTIA32.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI <file://EFI/BOOT/BOOTIA64.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI <file://EFI/BOOT/BOOTX64.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI <file://EFI/BOOT/BOOTARM.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI <file://EFI/BOOT/BOOTAA64.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI <file://EFI/BOOT/BOOTRISCV64.EFI> "

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI <file://EFI/BOOT/BOOTLOONGARCH64.EFI> "

> 

> 

> 

> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)

> 

> #if defined (MDE_CPU_IA32)

> 

> @@ -2214,6 +2216,8 @@ typedef struct {

> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64

> 

> #elif defined (MDE_CPU_RISCV64)

> 

> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64

> 

> + #elif defined (MDE_CPU_LOONGARCH64)

> 

> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64

> 

> #else

> 

> #error Unknown Processor Type

> 

> #endif

> 

> --

> 2.27.0

> 

> 

> 

> -=-=-=-=-=-=

> Groups.io Links: You receive all messages sent to this group.

> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766

> Mute This Topic: https://groups.io/mt/93674237/1643496

> Group Owner: devel+owner@edk2.groups.io <mailto:devel+owner@edk2.groups.io> 

> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]

> -=-=-=-=-=-=

> 




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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-27  0:55           ` 回复: " gaoliming
@ 2022-09-27  1:01             ` Michael D Kinney
  2022-09-27  1:48               ` Chao Li
  0 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2022-09-27  1:01 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, 'chao li',
	Kinney, Michael D
  Cc: Liu, Zhiguang

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

Ok

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

Mike

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming via groups.io
Sent: Monday, September 26, 2022 5:55 PM
To: devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>; 'chao li' <lichao@loongson.cn>
Cc: Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: 回复: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

Mike:
 The comment “For coding convenience, define the maximum valid LoonArch interrupt.” is also defined in UEFI2.10 spec 18.2.5 EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback().

  So, I think it is fine to keep this comment in MdePkg Include header file.

Thanks
Liming
发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> 代表 Michael D Kinney
发送时间: 2022年9月24日 23:08
收件人: chao li <lichao@loongson.cn<mailto:lichao@loongson.cn>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
抄送: "\"devel@edk2.groups.io\<mailto:devel@edk2.groups.io\>"" <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
主题: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

I am referring to this code comment.

> +//
>
> +// For coding convenience, define the maximum valid
>
> +// LoongArch interrupt.
>
> +//
>
> +#define MAX_LOONGARCH_INTERRUPT 14

Mike


From: chao li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
Sent: Friday, September 23, 2022 7:46 PM
To: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: "\"devel@edk2.groups.io\<mailto:devel@edk2.groups.io\>"" <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.

Mike,
Do you mean patches 0001 and 0002? If yes, I have tried removing both the two patches, but the Azure CI always produces the ECC errors, I have no idea how to fix them, so modify the CI YAM file to fix them, and Liming also recommends this way.


Thanks,
Chao
--------
On 9月 24 2022, at 10:33 上午, "Kinney, Michael D" <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>> wrote:

If it is in spec, then the comment about “coding convenience” is not required.



Mike



From: chao li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
Sent: Friday, September 23, 2022 7:17 PM
To: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: "devel@edk2.groups.io<mailto:devel@edk2.groups.io>" <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.


Hi Mkie,
I responded to your comment below.



Thanks,
Chao
--------
On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>> wrote:
One comment below.


Mike


> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Chao Li
> Sent: Wednesday, September 14, 2022 2:41 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
> Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
>
> Add LoongArch processor related definitions.
>
> For the Http boot and PXE boot types seeing this URL section "Processor
> Architecture Type" for the LOONGARCH values:
> https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
>
> For definitions of PE/COFF and LOONGARCH relocation types, see the
> "Machine Types" and "Basic Relocation Types" sections of this URL for
> LOONGARCH values:
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
>
> For the register definitions of exceptions context, see the UEFI V2.10
> 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> definitions:
> https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
>
> Signed-off-by: Chao Li <lichao@loongson.cn<mailto:lichao@loongson.cn>>
> ---
> MdePkg/Include/IndustryStandard/PeImage.h | 9 ++
> MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> 5 files changed, 136 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..dd4cc25483 100644
> --- a/MdePkg/Include/IndustryStandard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> @@ -10,6 +10,7 @@
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>
> Portions Copyright (c) 2016 - 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
>
>
>
> @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #define IMAGE_FILE_MACHINE_RISCV32 0x5032
>
> #define IMAGE_FILE_MACHINE_RISCV64 0x5064
>
> #define IMAGE_FILE_MACHINE_RISCV128 0x5128
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
>
> +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
>
>
>
> //
>
> // EXE file formats
>
> @@ -503,6 +506,12 @@ typedef struct {
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
>
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
>
>
>
> +//
>
> +// Relocation types of LoongArch processor.
>
> +//
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
>
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
>
> +
>
> ///
>
> /// Line number format.
>
> ///
>
> diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> index ec5b92a5c5..2b0ae2d157 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,110 @@ typedef struct {
> UINT64 X31;
>
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
>
>
> +//
>
> +// LoongArch processor exception types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT 0
>
> +#define EXCEPT_LOONGARCH_PIL 1
>
> +#define EXCEPT_LOONGARCH_PIS 2
>
> +#define EXCEPT_LOONGARCH_PIF 3
>
> +#define EXCEPT_LOONGARCH_PME 4
>
> +#define EXCEPT_LOONGARCH_PNR 5
>
> +#define EXCEPT_LOONGARCH_PNX 6
>
> +#define EXCEPT_LOONGARCH_PPI 7
>
> +#define EXCEPT_LOONGARCH_ADE 8
>
> +#define EXCEPT_LOONGARCH_ALE 9
>
> +#define EXCEPT_LOONGARCH_BCE 10
>
> +#define EXCEPT_LOONGARCH_SYS 11
>
> +#define EXCEPT_LOONGARCH_BRK 12
>
> +#define EXCEPT_LOONGARCH_INE 13
>
> +#define EXCEPT_LOONGARCH_IPE 14
>
> +#define EXCEPT_LOONGARCH_FPD 15
>
> +#define EXCEPT_LOONGARCH_SXD 16
>
> +#define EXCEPT_LOONGARCH_ASXD 17
>
> +#define EXCEPT_LOONGARCH_FPE 18
>
> +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> independent exception.
>
> +
>
> +//
>
> +// LoongArch processor Interrupt types.
>
> +//
>
> +#define EXCEPT_LOONGARCH_INT_SIP0 0
>
> +#define EXCEPT_LOONGARCH_INT_SIP1 1
>
> +#define EXCEPT_LOONGARCH_INT_IP0 2
>
> +#define EXCEPT_LOONGARCH_INT_IP1 3
>
> +#define EXCEPT_LOONGARCH_INT_IP2 4
>
> +#define EXCEPT_LOONGARCH_INT_IP3 5
>
> +#define EXCEPT_LOONGARCH_INT_IP4 6
>
> +#define EXCEPT_LOONGARCH_INT_IP5 7
>
> +#define EXCEPT_LOONGARCH_INT_IP6 8
>
> +#define EXCEPT_LOONGARCH_INT_IP7 9
>
> +#define EXCEPT_LOONGARCH_INT_PMC 10
>
> +#define EXCEPT_LOONGARCH_INT_TIMER 11
>
> +#define EXCEPT_LOONGARCH_INT_IPI 12
>
> +
>
> +//
>
> +// For coding convenience, define the maximum valid
>
> +// LoongArch interrupt.
>
> +//
>
> +#define MAX_LOONGARCH_INTERRUPT 14


Should this define be moved into the libs/modules that uses
this define? Prefer to only see definitions from specs in
this file.
Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
If you insist on your opinion, I can remove it in this file. So what's your opinion now?


>
> +
>
> +typedef struct {
>
> + UINT64 R0;
>
> + UINT64 R1;
>
> + UINT64 R2;
>
> + UINT64 R3;
>
> + UINT64 R4;
>
> + UINT64 R5;
>
> + UINT64 R6;
>
> + UINT64 R7;
>
> + UINT64 R8;
>
> + UINT64 R9;
>
> + UINT64 R10;
>
> + UINT64 R11;
>
> + UINT64 R12;
>
> + UINT64 R13;
>
> + UINT64 R14;
>
> + UINT64 R15;
>
> + UINT64 R16;
>
> + UINT64 R17;
>
> + UINT64 R18;
>
> + UINT64 R19;
>
> + UINT64 R20;
>
> + UINT64 R21;
>
> + UINT64 R22;
>
> + UINT64 R23;
>
> + UINT64 R24;
>
> + UINT64 R25;
>
> + UINT64 R26;
>
> + UINT64 R27;
>
> + UINT64 R28;
>
> + UINT64 R29;
>
> + UINT64 R30;
>
> + UINT64 R31;
>
> +
>
> + UINT64 CRMD; // CuRrent MoDe information
>
> + UINT64 PRMD; // PRe-exception MoDe information
>
> + UINT64 EUEN; // Extended component Unit ENable
>
> + UINT64 MISC; // MISCellaneous controller
>
> + UINT64 ECFG; // Exception ConFiGuration
>
> + UINT64 ESTAT; // Exception STATus
>
> + UINT64 ERA; // Exception Return Address
>
> + UINT64 BADV; // BAD Virtual address
>
> + UINT64 BADI; // BAD Instruction
>
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
>
> +
>
> ///
>
> /// Universal EFI_SYSTEM_CONTEXT definition.
>
> ///
>
> typedef union {
>
> - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
>
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
>
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
>
> + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
>
> + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
>
> + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
>
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
>
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
>
> } EFI_SYSTEM_CONTEXT;
>
>
>
> //
>
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 11872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
>
> +#elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
>
> #endif
>
>
>
> ///
>
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..83975a08eb 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -4,6 +4,7 @@
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>
> Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -246,6 +247,12 @@ typedef union {
> #define EFI_IMAGE_MACHINE_RISCV64 0x5064
>
> #define EFI_IMAGE_MACHINE_RISCV128 0x5128
>
>
>
> +///
>
> +/// PE32+ Machine type for LoongArch 32/64 images.
>
> +///
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
>
> +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
>
> +
>
> #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>
> #if defined (MDE_CPU_IA32)
>
>
>
> @@ -278,6 +285,13 @@ typedef union {
> #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
>
>
>
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
> +
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +
>
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
>
> + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
>
> +
>
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
>
>
>
> #elif defined (MDE_CPU_EBC)
>
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b38b100f6..3abebbb8d9 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -7,6 +7,7 @@
>
>
> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>
> +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>
>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -2195,12 +2196,13 @@ typedef struct {
> //
>
> // EFI File location to boot from on removable media devices
>
> //
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI<file://EFI/BOOT/BOOTIA32.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI<file://EFI/BOOT/BOOTIA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI<file://EFI/BOOT/BOOTX64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI<file://EFI/BOOT/BOOTARM.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI<file://EFI/BOOT/BOOTAA64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI<file://EFI/BOOT/BOOTRISCV64.EFI>"
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI<file://EFI/BOOT/BOOTLOONGARCH64.EFI>"
>
>
>
> #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
>
> #if defined (MDE_CPU_IA32)
>
> @@ -2214,6 +2216,8 @@ typedef struct {
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
>
> #elif defined (MDE_CPU_RISCV64)
>
> #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
>
> + #elif defined (MDE_CPU_LOONGARCH64)
>
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
>
> #else
>
> #error Unknown Processor Type
>
> #endif
>
> --
> 2.27.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> Mute This Topic: https://groups.io/mt/93674237/1643496
> Group Owner: devel+owner@edk2.groups.io<mailto:devel+owner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>


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

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

* Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
  2022-09-27  1:01             ` Michael D Kinney
@ 2022-09-27  1:48               ` Chao Li
  0 siblings, 0 replies; 10+ messages in thread
From: Chao Li @ 2022-09-27  1:48 UTC (permalink / raw)
  To: devel@edk2.groups.io, michael.d.kinney@intel.com
  Cc: "devel@edk2.groups.io", "Gao, Liming",
	"Liu, Zhiguang"

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

Thanks Liming and Mike!

Thanks,
Chao
--------

On 9月 27 2022, at 9:01 上午, "Michael D Kinney" <michael.d.kinney@intel.com> wrote:
>
> Ok
>
>
> Reviewed-by: Michael D Kinney michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)
>
> Mike
>
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming via groups.io
> Sent: Monday, September 26, 2022 5:55 PM
> To: devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>; 'chao li' <lichao@loongson.cn>
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: 回复: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
>
>
>
>
> Mike:
> The comment “For coding convenience, define the maximum valid LoonArch interrupt.” is also defined in UEFI2.10 spec 18.2.5 EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback().
>
> So, I think it is fine to keep this comment in MdePkg Include header file.
>
> Thanks
> Liming
> 发件人: devel@edk2.groups.io (mailto:devel@edk2.groups.io) <devel@edk2.groups.io (mailto:devel@edk2.groups.io)> 代表 Michael D Kinney
> 发送时间: 2022年9月24日 23:08
> 收件人: chao li <lichao@loongson.cn (mailto:lichao@loongson.cn)>; Kinney, Michael D <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>
> 抄送: "\"devel@edk2.groups.io\ (mailto:devel@edk2.groups.io/)"" <devel@edk2.groups.io (mailto:devel@edk2.groups.io)>; Gao, Liming <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>; Liu, Zhiguang <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> 主题: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
>
>
>
>
> I am referring to this code comment.
>
> > +//
> >
> > +// For coding convenience, define the maximum valid
> >
> > +// LoongArch interrupt.
> >
> > +//
> >
> > +#define MAX_LOONGARCH_INTERRUPT 14
>
> Mike
>
>
> From: chao li <lichao@loongson.cn (mailto:lichao@loongson.cn)>
> Sent: Friday, September 23, 2022 7:46 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>
> Cc: "\"devel@edk2.groups.io\ (mailto:devel@edk2.groups.io/)"" <devel@edk2.groups.io (mailto:devel@edk2.groups.io)>; Gao, Liming <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>; Liu, Zhiguang <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
>
>
>
>
>
> Mike,
> Do you mean patches 0001 and 0002? If yes, I have tried removing both the two patches, but the Azure CI always produces the ECC errors, I have no idea how to fix them, so modify the CI YAM file to fix them, and Liming also recommends this way.
>
>
>
>
> Thanks,
> Chao
> --------
>
>
> On 9月 24 2022, at 10:33 上午, "Kinney, Michael D" <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)> wrote:
>
> >
> >
> > If it is in spec, then the comment about “coding convenience” is not required.
> >
> >
> >
> >
> > Mike
> >
> >
> >
> > From: chao li <lichao@loongson.cn (mailto:lichao@loongson.cn)>
> > Sent: Friday, September 23, 2022 7:17 PM
> >
> > To: Kinney, Michael D <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>
> >
> > Cc: "devel@edk2.groups.io (mailto:devel@edk2.groups.io)" <devel@edk2.groups.io (mailto:devel@edk2.groups.io)>; Gao, Liming <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>; Liu, Zhiguang <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> >
> > Subject: Re: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi Mkie,
> > I responded to your comment below.
> >
> >
> >
> >
> >
> >
> >
> > Thanks,
> > Chao
> >
> > --------
> >
> >
> >
> > On 9月 23 2022, at 11:46 晚上, "Kinney, Michael D" <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)> wrote:
> >
> >
> > > One comment below.
> > >
> > >
> > >
> > >
> > >
> > >
> > > Mike
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: devel@edk2.groups.io (mailto:devel@edk2.groups.io) <devel@edk2.groups.io (mailto:devel@edk2.groups.io)> On Behalf Of Chao Li
> > >
> > >
> > > > Sent: Wednesday, September 14, 2022 2:41 AM
> > >
> > >
> > > > To: devel@edk2.groups.io (mailto:devel@edk2.groups.io)
> > >
> > >
> > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>; Gao, Liming <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>; Liu, Zhiguang <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> > >
> > >
> > > > Subject: [edk2-devel] [PATCH v2 22/34] MdePkg/Include: LoongArch definitions.
> > >
> > >
> > > >
> > >
> > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053
> > >
> > >
> > > >
> > >
> > >
> > > > Add LoongArch processor related definitions.
> > >
> > >
> > > >
> > >
> > >
> > > > For the Http boot and PXE boot types seeing this URL section "Processor
> > >
> > >
> > > > Architecture Type" for the LOONGARCH values:
> > >
> > >
> > > > https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml
> > >
> > >
> > > >
> > >
> > >
> > > > For definitions of PE/COFF and LOONGARCH relocation types, see the
> > >
> > >
> > > > "Machine Types" and "Basic Relocation Types" sections of this URL for
> > >
> > >
> > > > LOONGARCH values:
> > >
> > >
> > > > https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
> > >
> > >
> > > >
> > >
> > >
> > > > For the register definitions of exceptions context, see the UEFI V2.10
> > >
> > >
> > > > 18.2.2, 18.2.4 and 18.2.5 sections of this URL for LOONGARCH
> > >
> > >
> > > > definitions:
> > >
> > >
> > > > https://uefi.org/specs/UEFI/2.10/18_Protocols_Debugger_Support.html
> > >
> > >
> > > >
> > >
> > >
> > > > Cc: Michael D Kinney <michael.d.kinney@intel.com (mailto:michael.d.kinney@intel.com)>
> > >
> > >
> > > > Cc: Liming Gao <gaoliming@byosoft.com.cn (mailto:gaoliming@byosoft.com.cn)>
> > >
> > >
> > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com (mailto:zhiguang.liu@intel.com)>
> > >
> > >
> > > >
> > >
> > >
> > > > Signed-off-by: Chao Li <lichao@loongson.cn (mailto:lichao@loongson.cn)>
> > >
> > >
> > > > ---
> > >
> > >
> > > > MdePkg/Include/IndustryStandard/PeImage.h | 9 ++
> > >
> > >
> > > > MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++++++++++++++++--
> > >
> > >
> > > > MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
> > >
> > >
> > > > MdePkg/Include/Uefi/UefiBaseType.h | 14 +++
> > >
> > >
> > > > MdePkg/Include/Uefi/UefiSpec.h | 16 ++--
> > >
> > >
> > > > 5 files changed, 136 insertions(+), 13 deletions(-)
> > >
> > >
> > > >
> > >
> > >
> > > > diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
> > >
> > >
> > > > index 3109dc20f8..dd4cc25483 100644
> > >
> > >
> > > > --- a/MdePkg/Include/IndustryStandard/PeImage.h
> > >
> > >
> > > > +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> > >
> > >
> > > > @@ -10,6 +10,7 @@
> > >
> > >
> > > > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> > >
> > >
> > > >
> > >
> > >
> > > > Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
> > >
> > >
> > > >
> > >
> > >
> > > > Portions Copyright (c) 2016 - 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
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > > @@ -38,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
> > >
> > > > #define IMAGE_FILE_MACHINE_RISCV32 0x5032
> > >
> > >
> > > >
> > >
> > >
> > > > #define IMAGE_FILE_MACHINE_RISCV64 0x5064
> > >
> > >
> > > >
> > >
> > >
> > > > #define IMAGE_FILE_MACHINE_RISCV128 0x5128
> > >
> > >
> > > >
> > >
> > >
> > > > +#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
> > >
> > >
> > > >
> > >
> > >
> > > > +#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > > //
> > >
> > >
> > > >
> > >
> > >
> > > > // EXE file formats
> > >
> > >
> > > >
> > >
> > >
> > > > @@ -503,6 +506,12 @@ typedef struct {
> > >
> > >
> > > > #define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
> > >
> > >
> > > >
> > >
> > >
> > > > #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +// Relocation types of LoongArch processor.
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
> > >
> > >
> > > >
> > >
> > >
> > > > +
> > >
> > >
> > > >
> > >
> > >
> > > > ///
> > >
> > >
> > > >
> > >
> > >
> > > > /// Line number format.
> > >
> > >
> > > >
> > >
> > >
> > > > ///
> > >
> > >
> > > >
> > >
> > >
> > > > diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
> > >
> > >
> > > > index ec5b92a5c5..2b0ae2d157 100644
> > >
> > >
> > > > --- a/MdePkg/Include/Protocol/DebugSupport.h
> > >
> > >
> > > > +++ b/MdePkg/Include/Protocol/DebugSupport.h
> > >
> > >
> > > > @@ -654,17 +654,110 @@ typedef struct {
> > >
> > >
> > > > UINT64 X31;
> > >
> > >
> > > >
> > >
> > >
> > > > } EFI_SYSTEM_CONTEXT_RISCV64;
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +// LoongArch processor exception types.
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT 0
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PIL 1
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PIS 2
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PIF 3
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PME 4
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PNR 5
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PNX 6
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_PPI 7
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_ADE 8
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_ALE 9
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_BCE 10
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_SYS 11
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_BRK 12
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INE 13
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_IPE 14
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_FPD 15
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_SXD 16
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_ASXD 17
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_FPE 18
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_TBR 64 // For code only, there is no such type in the ISA spec, the TLB refill is defined for an
> > >
> > >
> > > > independent exception.
> > >
> > >
> > > >
> > >
> > >
> > > > +
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +// LoongArch processor Interrupt types.
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_SIP0 0
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_SIP1 1
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP0 2
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP1 3
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP2 4
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP3 5
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP4 6
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP5 7
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP6 8
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IP7 9
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_PMC 10
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_TIMER 11
> > >
> > >
> > > >
> > >
> > >
> > > > +#define EXCEPT_LOONGARCH_INT_IPI 12
> > >
> > >
> > > >
> > >
> > >
> > > > +
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +// For coding convenience, define the maximum valid
> > >
> > >
> > > >
> > >
> > >
> > > > +// LoongArch interrupt.
> > >
> > >
> > > >
> > >
> > >
> > > > +//
> > >
> > >
> > > >
> > >
> > >
> > > > +#define MAX_LOONGARCH_INTERRUPT 14
> > >
> > >
> > >
> > >
> > >
> > >
> > > Should this define be moved into the libs/modules that uses
> > > this define? Prefer to only see definitions from specs in
> > >
> > >
> > > this file.
> > >
> > >
> > >
> >
> > Chao Li: Yes, this macro is defined in the UEFI Spec V2.10 section 18.2.5.
> >
> >
> > If you insist on your opinion, I can remove it in this file. So what's your opinion now?
> >
> >
> >
> >
> >
> >
> > >
> > > +
> >
> >
> > >
> >
> >
> > > +typedef struct {
> >
> >
> > >
> >
> >
> > > + UINT64 R0;
> >
> >
> > >
> >
> >
> > > + UINT64 R1;
> >
> >
> > >
> >
> >
> > > + UINT64 R2;
> >
> >
> > >
> >
> >
> > > + UINT64 R3;
> >
> >
> > >
> >
> >
> > > + UINT64 R4;
> >
> >
> > >
> >
> >
> > > + UINT64 R5;
> >
> >
> > >
> >
> >
> > > + UINT64 R6;
> >
> >
> > >
> >
> >
> > > + UINT64 R7;
> >
> >
> > >
> >
> >
> > > + UINT64 R8;
> >
> >
> > >
> >
> >
> > > + UINT64 R9;
> >
> >
> > >
> >
> >
> > > + UINT64 R10;
> >
> >
> > >
> >
> >
> > > + UINT64 R11;
> >
> >
> > >
> >
> >
> > > + UINT64 R12;
> >
> >
> > >
> >
> >
> > > + UINT64 R13;
> >
> >
> > >
> >
> >
> > > + UINT64 R14;
> >
> >
> > >
> >
> >
> > > + UINT64 R15;
> >
> >
> > >
> >
> >
> > > + UINT64 R16;
> >
> >
> > >
> >
> >
> > > + UINT64 R17;
> >
> >
> > >
> >
> >
> > > + UINT64 R18;
> >
> >
> > >
> >
> >
> > > + UINT64 R19;
> >
> >
> > >
> >
> >
> > > + UINT64 R20;
> >
> >
> > >
> >
> >
> > > + UINT64 R21;
> >
> >
> > >
> >
> >
> > > + UINT64 R22;
> >
> >
> > >
> >
> >
> > > + UINT64 R23;
> >
> >
> > >
> >
> >
> > > + UINT64 R24;
> >
> >
> > >
> >
> >
> > > + UINT64 R25;
> >
> >
> > >
> >
> >
> > > + UINT64 R26;
> >
> >
> > >
> >
> >
> > > + UINT64 R27;
> >
> >
> > >
> >
> >
> > > + UINT64 R28;
> >
> >
> > >
> >
> >
> > > + UINT64 R29;
> >
> >
> > >
> >
> >
> > > + UINT64 R30;
> >
> >
> > >
> >
> >
> > > + UINT64 R31;
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > + UINT64 CRMD; // CuRrent MoDe information
> >
> >
> > >
> >
> >
> > > + UINT64 PRMD; // PRe-exception MoDe information
> >
> >
> > >
> >
> >
> > > + UINT64 EUEN; // Extended component Unit ENable
> >
> >
> > >
> >
> >
> > > + UINT64 MISC; // MISCellaneous controller
> >
> >
> > >
> >
> >
> > > + UINT64 ECFG; // Exception ConFiGuration
> >
> >
> > >
> >
> >
> > > + UINT64 ESTAT; // Exception STATus
> >
> >
> > >
> >
> >
> > > + UINT64 ERA; // Exception Return Address
> >
> >
> > >
> >
> >
> > > + UINT64 BADV; // BAD Virtual address
> >
> >
> > >
> >
> >
> > > + UINT64 BADI; // BAD Instruction
> >
> >
> > >
> >
> >
> > > +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > ///
> >
> >
> > >
> >
> >
> > > /// Universal EFI_SYSTEM_CONTEXT definition.
> >
> >
> > >
> >
> >
> > > ///
> >
> >
> > >
> >
> >
> > > typedef union {
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
> >
> >
> > >
> >
> >
> > > - EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_RISCV64 *SystemContextRiscV64;
> >
> >
> > >
> >
> >
> > > + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextLoongArch64;
> >
> >
> > >
> >
> >
> > > } EFI_SYSTEM_CONTEXT;
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > //
> >
> >
> > >
> >
> >
> > > diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
> >
> >
> > > index 11872d602d..6787941a5d 100644
> >
> >
> > > --- a/MdePkg/Include/Protocol/PxeBaseCode.h
> >
> >
> > > +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> >
> >
> > > @@ -4,6 +4,7 @@
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > @@ -158,6 +159,8 @@ typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
> >
> >
> > > #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
> >
> >
> > >
> >
> >
> > > #elif defined (MDE_CPU_RISCV64)
> >
> >
> > >
> >
> >
> > > #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
> >
> >
> > >
> >
> >
> > > +#elif defined (MDE_CPU_LOONGARCH64)
> >
> >
> > >
> >
> >
> > > +#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0027
> >
> >
> > >
> >
> >
> > > #endif
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > ///
> >
> >
> > >
> >
> >
> > > diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
> >
> >
> > > index 4a34ce8e25..83975a08eb 100644
> >
> >
> > > --- a/MdePkg/Include/Uefi/UefiBaseType.h
> >
> >
> > > +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> >
> >
> > > @@ -4,6 +4,7 @@
> >
> >
> > > Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > @@ -246,6 +247,12 @@ typedef union {
> >
> >
> > > #define EFI_IMAGE_MACHINE_RISCV64 0x5064
> >
> >
> > >
> >
> >
> > > #define EFI_IMAGE_MACHINE_RISCV128 0x5128
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > +///
> >
> >
> > >
> >
> >
> > > +/// PE32+ Machine type for LoongArch 32/64 images.
> >
> >
> > >
> >
> >
> > > +///
> >
> >
> > >
> >
> >
> > > +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
> >
> >
> > >
> >
> >
> > > +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > #if !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> >
> >
> > >
> >
> >
> > > #if defined (MDE_CPU_IA32)
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > @@ -278,6 +285,13 @@ typedef union {
> >
> >
> > > #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> >
> >
> > >
> >
> >
> > > ((Machine) == EFI_IMAGE_MACHINE_RISCV64)
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > + #elif defined (MDE_CPU_LOONGARCH64)
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> >
> >
> > >
> >
> >
> > > + ((Machine) == EFI_IMAGE_MACHINE_LOONGARCH64)
> >
> >
> > >
> >
> >
> > > +
> >
> >
> > >
> >
> >
> > > #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > #elif defined (MDE_CPU_EBC)
> >
> >
> > >
> >
> >
> > > diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
> >
> >
> > > index 2b38b100f6..3abebbb8d9 100644
> >
> >
> > > --- a/MdePkg/Include/Uefi/UefiSpec.h
> >
> >
> > > +++ b/MdePkg/Include/Uefi/UefiSpec.h
> >
> >
> > > @@ -7,6 +7,7 @@
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > > +Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > @@ -2195,12 +2196,13 @@ typedef struct {
> >
> >
> > > //
> >
> >
> > >
> >
> >
> > > // EFI File location to boot from on removable media devices
> >
> >
> > >
> >
> >
> > > //
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
> >
> >
> > >
> >
> >
> > > -#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
> >
> >
> > >
> >
> >
> > > #if defined (MDE_CPU_IA32)
> >
> >
> > >
> >
> >
> > > @@ -2214,6 +2216,8 @@ typedef struct {
> >
> >
> > > #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
> >
> >
> > >
> >
> >
> > > #elif defined (MDE_CPU_RISCV64)
> >
> >
> > >
> >
> >
> > > #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> >
> >
> > >
> >
> >
> > > + #elif defined (MDE_CPU_LOONGARCH64)
> >
> >
> > >
> >
> >
> > > +#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
> >
> >
> > >
> >
> >
> > > #else
> >
> >
> > >
> >
> >
> > > #error Unknown Processor Type
> >
> >
> > >
> >
> >
> > > #endif
> >
> >
> > >
> >
> >
> > > --
> >
> >
> > > 2.27.0
> >
> >
> > >
> >
> >
> > >
> >
> >
> > >
> >
> >
> > > -=-=-=-=-=-=
> >
> >
> > > Groups.io Links: You receive all messages sent to this group.
> >
> >
> > > View/Reply Online (#93766): https://edk2.groups.io/g/devel/message/93766
> >
> >
> > > Mute This Topic: https://groups.io/mt/93674237/1643496
> >
> >
> > > Group Owner: devel+owner@edk2.groups.io (mailto:devel+owner@edk2.groups.io)
> >
> >
> > > Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> >
> >
> > > -=-=-=-=-=-=
> >
> >
> > >
> >
> >
> >
> >
> >
>
>
>
> 

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

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

end of thread, other threads:[~2022-09-27  1:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-14  9:41 [PATCH v2 22/34] MdePkg/Include: LoongArch definitions Chao Li
2022-09-23  6:32 ` Chao Li
2022-09-23 15:46 ` [edk2-devel] " Michael D Kinney
2022-09-24  2:16   ` Chao Li
2022-09-24  2:33     ` Michael D Kinney
2022-09-24  2:46       ` Chao Li
2022-09-24 15:07         ` Michael D Kinney
2022-09-27  0:55           ` 回复: " gaoliming
2022-09-27  1:01             ` Michael D Kinney
2022-09-27  1:48               ` Chao Li

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