* [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions.
@ 2022-02-09 6:55 Chao Li
2022-04-07 14:23 ` [edk2-devel] " Abner Chang
0 siblings, 1 reply; 3+ messages in thread
From: Chao Li @ 2022-02-09 6:55 UTC (permalink / raw)
To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu
Add LoongArch processor related definitions.
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 | 65 ++++++++++++++++++++---
MdePkg/Include/Protocol/PxeBaseCode.h | 3 ++
MdePkg/Include/Uefi/UefiBaseType.h | 14 +++++
MdePkg/Include/Uefi/UefiSpec.h | 16 +++---
5 files changed, 94 insertions(+), 13 deletions(-)
diff --git a/MdePkg/Include/IndustryStandard/PeImage.h b/MdePkg/Include/IndustryStandard/PeImage.h
index 3109dc20f8..3741f21719 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..47e3a44410 100644
--- a/MdePkg/Include/Protocol/DebugSupport.h
+++ b/MdePkg/Include/Protocol/DebugSupport.h
@@ -654,17 +654,68 @@ typedef struct {
UINT64 X31;
} EFI_SYSTEM_CONTEXT_RISCV64;
+//
+// LoongArch processor exception types.
+//
+#define MAX_LOONGARCH_EXCEPTION 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..e5234fab07 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)
@@ -280,6 +287,13 @@ typedef union {
#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] 3+ messages in thread
* Re: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions.
2022-02-09 6:55 [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions Chao Li
@ 2022-04-07 14:23 ` Abner Chang
2022-04-12 9:11 ` Chao Li
0 siblings, 1 reply; 3+ messages in thread
From: Abner Chang @ 2022-04-07 14:23 UTC (permalink / raw)
To: devel@edk2.groups.io, lichao@loongson.cn
Cc: Michael D Kinney, Liming Gao, Zhiguang Liu
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
> Sent: Wednesday, February 9, 2022 2:56 PM
> To: devel@edk2.groups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33]
> MdePkg/Include: LoongArch definitions.
>
> Add LoongArch processor related definitions.
>
> 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 | 65
> ++++++++++++++++++++---
> MdePkg/Include/Protocol/PxeBaseCode.h | 3 ++
> MdePkg/Include/Uefi/UefiBaseType.h | 14 +++++
> MdePkg/Include/Uefi/UefiSpec.h | 16 +++---
> 5 files changed, 94 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/PeImage.h
> b/MdePkg/Include/IndustryStandard/PeImage.h
> index 3109dc20f8..3741f21719 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
Are those Loongarch machine types already defined in PeCoff spec? Could you please point me to the spec?
The rest looks good to me.
Acked-by: Abner Chang <abner.chang@hpe.com>
>
> //
> // 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..47e3a44410 100644
> --- a/MdePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Protocol/DebugSupport.h
> @@ -654,17 +654,68 @@ typedef struct {
> UINT64 X31;
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
> +//
> +// LoongArch processor exception types.
> +//
> +#define MAX_LOONGARCH_EXCEPTION 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..e5234fab07 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)
>
> @@ -280,6 +287,13 @@ typedef union {
>
> #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 [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions.
2022-04-07 14:23 ` [edk2-devel] " Abner Chang
@ 2022-04-12 9:11 ` Chao Li
0 siblings, 0 replies; 3+ messages in thread
From: Chao Li @ 2022-04-12 9:11 UTC (permalink / raw)
To: "Chang, Abner (HPS SW/FW Technologist)"
Cc: "devel@edk2.groups.io", Michael D Kinney, Liming Gao,
Zhiguang Liu
[-- Attachment #1: Type: text/plain, Size: 10597 bytes --]
Hi Abner,
Yes, the PE/COFF has been adapted to LoongArch32 and LoongArch64, please refer to: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format (https://link.getmailspring.com/link/9A61F0C8-A7FA-41AD-B0F6-769EC7687654@getmailspring.com/0?redirect=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fdebug%2Fpe-format&recipient=ZGV2ZWxAZWRrMi5ncm91cHMuaW8%3D) and search "LoongArch" for more information.
--
Thanks,
Chao
------------------------
On 4月 7 2022, at 10:23 晚上, "Chang, Abner (HPS SW/FW Technologist)" <abner.chang@hpe.com> wrote:
>
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
> > Sent: Wednesday, February 9, 2022 2:56 PM
> > To: devel@edk2.groups.io
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>
> > Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33]
> > MdePkg/Include: LoongArch definitions.
> >
> > Add LoongArch processor related definitions.
> >
> > 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 | 65
> > ++++++++++++++++++++---
> > MdePkg/Include/Protocol/PxeBaseCode.h | 3 ++
> > MdePkg/Include/Uefi/UefiBaseType.h | 14 +++++
> > MdePkg/Include/Uefi/UefiSpec.h | 16 +++---
> > 5 files changed, 94 insertions(+), 13 deletions(-)
> >
> > diff --git a/MdePkg/Include/IndustryStandard/PeImage.h
> > b/MdePkg/Include/IndustryStandard/PeImage.h
> > index 3109dc20f8..3741f21719 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
>
> Are those Loongarch machine types already defined in PeCoff spec? Could you please point me to the spec?
> The rest looks good to me.
> Acked-by: Abner Chang <abner.chang@hpe.com>
> >
> > //
> > // 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..47e3a44410 100644
> > --- a/MdePkg/Include/Protocol/DebugSupport.h
> > +++ b/MdePkg/Include/Protocol/DebugSupport.h
> > @@ -654,17 +654,68 @@ typedef struct {
> > UINT64 X31;
> > } EFI_SYSTEM_CONTEXT_RISCV64;
> >
> > +//
> > +// LoongArch processor exception types.
> > +//
> > +#define MAX_LOONGARCH_EXCEPTION 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..e5234fab07 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)
> >
> > @@ -280,6 +287,13 @@ typedef union {
> >
> > #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: 14473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-12 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 6:55 [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions Chao Li
2022-04-07 14:23 ` [edk2-devel] " Abner Chang
2022-04-12 9:11 ` Chao Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox