From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from loongson.cn (loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.8591.1649754708944294985 for ; Tue, 12 Apr 2022 02:11:49 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lichao@loongson.cn) Received: from lichao-PC (unknown [10.40.24.65]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxfxFSQlVizCwgAA--.11301S2; Tue, 12 Apr 2022 17:11:46 +0800 (CST) Date: Tue, 12 Apr 2022 17:11:42 +0800 From: "Chao Li" To: "=?utf-8?Q?=22Chang=2C_Abner_(HPS_SW/FW_Technologist)=22?=" Cc: "=?utf-8?Q?=22devel=40edk2.groups.io=22?=" , Michael D Kinney , Liming Gao , Zhiguang Liu Message-ID: <9A61F0C8-A7FA-41AD-B0F6-769EC7687654@getmailspring.com> In-Reply-To: References: Subject: Re: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33] MdePkg/Include: LoongArch definitions. X-Mailer: Mailspring MIME-Version: 1.0 X-CM-TRANSID: AQAAf9DxfxFSQlVizCwgAA--.11301S2 X-Coremail-Antispam: 1UD129KBjvJXoWfJF4rAFWxWw1xAFyUCw1fCrg_yoWDtFW3pF 10ka9Fq3W7tr97uw18GF18Wr92yws7KryUGan8uw48CF4vy3yvgr4YgFs7GrWDZr45K34r Xw1Yk34xWF4Ut3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUQvb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVAYj202 j2C_Jr0_Gr1l5I8CrVACY4xI64kE6c02F40Ex7xfMc02F40Ew4AK048IF2xKxVW8JVW5Jw Aqx4xG6I80eVA0xI0YY7vIx2IE14AGzxvEb7x7McIj6xIIjxv20xvE14v26r1q6rW5McIj 6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l74 80Y4vEI4kI2Ix0rVAqx4xJMxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE 7xkEbVWUJVW8JwCFI7km07C267AKxVWUAVWUtwC20s026c02F40E14v26r106r1rMI8I3I 0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAI cVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcV CF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07bwIDcUUUUU= X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAOCF3QvPKQVwACsB Content-Type: multipart/alternative; boundary="6255424e_1065ea8_6697" --6255424e_1065ea8_6697 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Abner, Yes, the PE/COFF has been adapted to LoongArch32 and LoongArch64, please re= fer to: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format (htt= ps://link.getmailspring.com/link/9A61F0C8-A7FA-41AD-B0F6-769EC7687654@getma= ilspring.com/0?redirect=3Dhttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindow= s%2Fwin32%2Fdebug%2Fpe-format&recipient=3DZGV2ZWxAZWRrMi5ncm91cHMuaW8%3D) a= nd search "LoongArch" for more information. -- Thanks, Chao ------------------------ On 4=E6=9C=88 7 2022, at 10:23 =E6=99=9A=E4=B8=8A, "Chang, Abner (HPS SW/FW= Technologist)" wrote: > > > > -----Original Message----- > > From: 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 ; Liming Gao > > ; Zhiguang Liu > > Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 20/33] > > MdePkg/Include: LoongArch definitions. > > > > Add LoongArch processor related definitions. > > > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Zhiguang Liu > > > > Signed-off-by: Chao Li > > --- > > 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.
> > Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> > Portions Copyright (c) 2016 - 2020, Hewlett Packard Enterprise Developm= ent > > LP. All rights reserved.
> > +Portions Copyright (c) 2022, Loongson Technology Corporation Limited. = All > > rights reserved.
> > > > 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 y= ou please point me to the spec? > The rest looks good to me. > Acked-by: Abner Chang > > > > // > > // 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.
> > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts > > reserved.
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All right= s > > reserved.
> > > > 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.
> > Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
> > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts > > reserved.
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All right= s > > reserved.
> > > > 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) =3D=3D 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.
> > Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP.= All > > rights reserved.
> > +Copyright (c) 2022, Loongson Technology Corporation Limited. All right= s > > reserved.
> > > > 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 > > > > > > > >=20 > > > --6255424e_1065ea8_6697 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi Abner,
Yes, the PE/COFF has been adapted to LoongArch32 a= nd LoongArch64, please refer to: https://docs.microsoft.com/= en-us/windows/win32/debug/pe-format and search "LoongArch" for mor= e information.

--
Thanks,
Chao
------------------------

=
= On 4=E6=9C=88 7 2022, at 10:23 =E6=99=9A=E4=B8=8A, "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.gro= ups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com&g= t;; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Li= u <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [stag= ing/LoongArch RESEND PATCH v1 20/33]
> MdePkg/Include: LoongAr= ch definitions.
>
> Add LoongArch processor relat= ed definitions.
>
> Cc: Michael D Kinney <mich= ael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byos= oft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com&g= t;
>
> Signed-off-by: Chao Li <lichao@loongson= .cn>
> ---
> MdePkg/Include/IndustryStandard/P= eImage.h | 9 ++++
> MdePkg/Include/Protocol/DebugSupport.h | 6= 5
> ++++++++++++++++++++---
> MdePkg/Include/Prot= ocol/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/Industry= Standard/PeImage.h
> +++ b/MdePkg/Include/IndustryStandard/PeI= mage.h
> @@ -10,6 +10,7 @@
> Copyright (c) 2006 -= 2018, Intel Corporation. All rights reserved.<BR>
> Por= tions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR><= /div>
> Portions Copyright (c) 2016 - 2020, Hewlett Packard Enterpri= se 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_RISC= V128 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_LOW= 12I 7
> #define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
&= gt;
> +//
> +// Relocation types of LoongArch pro= cessor.
> +//
> +#define EFI_IMAGE_REL_BASED_LOON= GARCH32_MARK_LA 8
> +#define EFI_IMAGE_REL_BASED_LOONGARCH64_M= ARK_LA 8
> +
> ///
> /// Line number= format.
> ///
> diff --git a/MdePkg/Include/Prot= ocol/DebugSupport.h
> b/MdePkg/Include/Protocol/DebugSupport.h=
> index ec5b92a5c5..47e3a44410 100644
> --- a/Md= ePkg/Include/Protocol/DebugSupport.h
> +++ b/MdePkg/Include/Pr= otocol/DebugSupport.h
> @@ -654,17 +654,68 @@ typedef struct {=
> UINT64 X31;
> } EFI_SYSTEM_CONTEXT_RISCV64;
>
> +//
> +// LoongArch processor exce= ption types.
> +//
> +#define MAX_LOONGARCH_EXCEP= TION 14
> +
> +typedef struct {
> + = UINT64 R0;
> + UINT64 R1;
> + UINT64 R2;
> + UINT64 R3;
> + UINT64 R4;
> + UINT64 R5;=
> + UINT64 R6;
> + UINT64 R7;
> + U= INT64 R8;
> + UINT64 R9;
> + UINT64 R10;
> + UINT64 R11;
> + UINT64 R12;
> + UINT64 R= 13;
> + UINT64 R14;
> + UINT64 R15;
>= ; + UINT64 R16;
> + UINT64 R17;
> + UINT64 R18;
> + UINT64 R19;
> + UINT64 R20;
> + U= INT64 R21;
> + UINT64 R22;
> + UINT64 R23;
<= div>> + UINT64 R24;
> + UINT64 R25;
> + UINT64= R26;
> + UINT64 R27;
> + UINT64 R28;
&= gt; + UINT64 R29;
> + UINT64 R30;
> + UINT64 R31;=
> +
> + UINT64 CRMD; // CuRrent MoDe information=
> + UINT64 PRMD; // PRe-exception MoDe information
= > + UINT64 EUEN; // Extended component Unit ENable
> + UINT= 64 MISC; // MISCellaneous controller
> + UINT64 ECFG; // Excep= tion ConFiGuration
> + UINT64 ESTAT; // Exception STATus
=
> + UINT64 ERA; // Exception Return Address
> + UINT64= BADV; // BAD Virtual address
> + UINT64 BADI; // BAD Instruct= ion
> +} EFI_SYSTEM_CONTEXT_LOONGARCH64;
> +
> ///
> /// Universal EFI_SYSTEM_CONTEXT definition.<= /div>
> ///
> typedef union {
> - EFI_SYST= EM_CONTEXT_EBC *SystemContextEbc;
> - EFI_SYSTEM_CONTEXT_IA32 = *SystemContextIa32;
> - EFI_SYSTEM_CONTEXT_X64 *SystemContextX= 64;
> - EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
&g= t; - EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
> - EFI_SYSTEM_= CONTEXT_AARCH64 *SystemContextAArch64;
> - EFI_SYSTEM_CONTEXT_= RISCV64 *SystemContextRiscV64;
> + EFI_SYSTEM_CONTEXT_EBC *Sys= temContextEbc;
> + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;=
> + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
> = + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
> + EFI_SYSTEM_CON= TEXT_ARM *SystemContextArm;
> + EFI_SYSTEM_CONTEXT_AARCH64 *Sy= stemContextAArch64;
> + EFI_SYSTEM_CONTEXT_RISCV64 *SystemCont= extRiscV64;
> + EFI_SYSTEM_CONTEXT_LOONGARCH64 *SystemContextL= oongArch64;
> } EFI_SYSTEM_CONTEXT;
>
&= gt; //
> diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h
> b/MdePkg/Include/Protocol/PxeBaseCode.h
> index 1= 1872d602d..6787941a5d 100644
> --- a/MdePkg/Include/Protocol/P= xeBaseCode.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCode.h
> @@ -4,6 +4,7 @@
>
> Copyright (c) 200= 6 - 2018, Intel Corporation. All rights reserved.<BR>
> = Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.<BR>
> +Copyright (c) 2022, Loong= son 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_ARCHI= TECTURE 0x000B
> #elif defined (MDE_CPU_RISCV64)
>= ; #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x001B
> +#elif d= efined (MDE_CPU_LOONGARCH64)
> +#define EFI_PXE_CLIENT_SYSTEM_= ARCHITECTURE 0x0027
> #endif
>
> ///=
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h
&= gt; b/MdePkg/Include/Uefi/UefiBaseType.h
> index 4a34ce8e25..e= 5234fab07 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 - 201= 6, ARM Ltd. All rights reserved.<BR>
> Copyright (c) 202= 0, Hewlett Packard Enterprise Development LP. All rights
> res= erved.<BR>
> +Copyright (c) 2022, Loongson Technology Co= rporation Limited. All rights
> reserved.<BR>
= >
> SPDX-License-Identifier: BSD-2-Clause-Patent
= >
> @@ -246,6 +247,12 @@ typedef union {
> #de= fine EFI_IMAGE_MACHINE_RISCV64 0x5064
> #define EFI_IMAGE_MACH= INE_RISCV128 0x5128
>
> +///
> +/// = PE32+ Machine type for LoongArch 32/64 images.
> +///
> +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
> +#defin= e EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
> +
> #if = !defined (EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined
> = (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> #if defined (MDE_CPU_IA= 32)
>
> @@ -280,6 +287,13 @@ typedef union {
>
> #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Ma= chine) (FALSE)
>
> + #elif defined (MDE_CPU_LOONG= ARCH64)
> +
> +#define EFI_IMAGE_MACHINE_TYPE_SUP= PORTED(Machine) \
> + ((Machine) =3D=3D EFI_IMAGE_MACHINE_LOON= GARCH64)
> +
> +#define EFI_IMAGE_MACHINE_CROSS_T= YPE_SUPPORTED(Machine) (FALSE)
> +
> #elif define= d (MDE_CPU_EBC)
>
> ///
> diff --git= a/MdePkg/Include/Uefi/UefiSpec.h
> b/MdePkg/Include/Uefi/Uefi= Spec.h
> index 2b38b100f6..3abebbb8d9 100644
> --= - a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi= /UefiSpec.h
> @@ -7,6 +7,7 @@
>
> Co= pyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR><= /div>
> Portions Copyright (c) 2020, Hewlett Packard Enterprise Deve= lopment LP. All
> rights reserved.<BR>
> +C= opyright (c) 2022, Loongson Technology Corporation Limited. All rights
> reserved.<BR>
>
> SPDX-License-I= dentifier: BSD-2-Clause-Patent
>
> @@ -2195,12 +2= 196,13 @@ typedef struct {
> //
> // EFI File loc= ation to boot from on removable media devices
> //
&= gt; -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
> L"\\EFI\\BOO= T\\BOOTIA32.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64=
> L"\\EFI\\BOOT\\BOOTIA64.EFI"
> -#define EFI_RE= MOVABLE_MEDIA_FILE_NAME_X64
> L"\\EFI\\BOOT\\BOOTX64.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
> L"\\EF= I\\BOOT\\BOOTARM.EFI"
> -#define EFI_REMOVABLE_MEDIA_FILE_NAME= _AARCH64
> L"\\EFI\\BOOT\\BOOTAA64.EFI"
> -#defin= e EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> L"\\EFI\\BOOT\\BOOTR= ISCV64.EFI"
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
> L"\\EFI\\BOOT\\BOOTIA32.EFI"
> +#define EFI_REMOVAB= LE_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_AR= M
> L"\\EFI\\BOOT\\BOOTARM.EFI"
> +#define EFI_RE= MOVABLE_MEDIA_FILE_NAME_AARCH64
> L"\\EFI\\BOOT\\BOOTAA64.EFI"=
> +#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
&g= t; L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> +#define EFI_REMOVABLE_ME= DIA_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_N= AME
> EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> + #= elif defined (MDE_CPU_LOONGARCH64)
> +#define EFI_REMOVABLE_ME= DIA_FILE_NAME
> EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
> #else
> #error Unknown Processor Type
>= ; #endif
> --
> 2.27.0
>
&= gt;
>
>
>
<= img class=3D"mailspring-open" alt=3D"Sent from Mailspring" width=3D"0" heig= ht=3D"0" style=3D"border:0; width:0; height:0;" src=3D"https://link.getmail= spring.com/open/9A61F0C8-A7FA-41AD-B0F6-769EC7687654@getmailspring.com?me= =3Da03b887c&recipient=3DZGV2ZWxAZWRrMi5ncm91cHMuaW8%3D"> --6255424e_1065ea8_6697--