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.8542.1649754321808345239 for ; Tue, 12 Apr 2022 02:05:22 -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 AQAAf9Dx39fOQFViPysgAA--.11008S2; Tue, 12 Apr 2022 17:05:19 +0800 (CST) Date: Tue, 12 Apr 2022 17:05:16 +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 , =?utf-8?Q?=22Baoqi_Zhang=22?= , Dongyan Qian Message-ID: In-Reply-To: References: Subject: Re: [edk2-devel] [staging/LoongArch RESEND PATCH v1 19/33] MdePkg: Add LoongArch LOONGARCH64 binding X-Mailer: Mailspring MIME-Version: 1.0 X-CM-TRANSID: AQAAf9Dx39fOQFViPysgAA--.11008S2 X-Coremail-Antispam: 1UD129KBjvJXoW3JrWfJF1DJr1ktrW8tr1xAFb_yoW3XrW5pa nay3WfWr48tr1xCFy7KFW5Gr1ftws2yF4UGF4q93yxZFW2ya1kKF98Kr48JFW0yr90va48 ZFn0gw15ua18CrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmSb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVAYj202 j2C_Jr0_Gr1l5I8CrVACY4xI64kE6c02F40Ex7xfMc02F40Ew4AK048IF2xKxVW8JVW5Jw Aqx4xG6I80eVA0xI0YY7vIx2IE14AGzxvEb7x7McIj6xIIjxv20xvE14v26r106r15McIj 6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l74 80Y4vEI4kI2Ix0rVAqx4xJMxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE 7xkEbVWUJVW8JwC20s026c02F40E14v26r106r1rMI8I3I0E7480Y4vE14v26r106r1rMI 8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWU CwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r 1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBI daVFxhVjvjDU0xZFpf9x07jOJ5rUUUUU= X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAOCF3QvPKQVQABsA Content-Type: multipart/alternative; boundary="625540cc_64079548_6697" --625540cc_64079548_6697 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Abner, Do I have to remove a "_" at the head and tail? All I found in MdePkg is th= at *.h files have two "_" at the head and tail. If you are sure that EDK II= coding style must contain only one "_" at the head and tail, I will modify= it. -- Thanks, Chao ------------------------ On 4=E6=9C=88 7 2022, at 10:15 =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 ; Baoq= i > > Zhang ; Dongyan Qian > > > > Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 19/33] MdePkg: > > Add LoongArch LOONGARCH64 binding > > > > Add LOONGARCH64 sections in MdePkg.dec and LOONGARCH64 > > ProcessorBind.h > > > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Zhiguang Liu > > > > Signed-off-by: Chao Li > > Co-authored-by: Baoqi Zhang > > Co-authored-by: Dongyan Qian > > --- > > MdePkg/Include/LoongArch64/ProcessorBind.h | 121 > > +++++++++++++++++++++ > > MdePkg/MdePkg.dec | 4 + > > MdePkg/MdePkg.dsc | 3 +- > > 3 files changed, 127 insertions(+), 1 deletion(-) > > create mode 100644 MdePkg/Include/LoongArch64/ProcessorBind.h > > > > diff --git a/MdePkg/Include/LoongArch64/ProcessorBind.h > > b/MdePkg/Include/LoongArch64/ProcessorBind.h > > new file mode 100644 > > index 0000000000..a10481e285 > > --- /dev/null > > +++ b/MdePkg/Include/LoongArch64/ProcessorBind.h > > @@ -0,0 +1,121 @@ > > +/** @file > > + Processor or Compiler specific defines and types for LoongArch > > + > > + Copyright (c) 2022 Loongson Technology Corporation Limited. All right= s > > reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __PROCESSOR_BIND_H__ > > +#define __PROCESSOR_BIND_H__ > Please remove the leading "_" and only keep one trailing "_" to follow th= e edk2 coding standard. RISC-V ProcessorBind.h has the mistake. > > Abner > > + > > +// > > +// Define the processor type so other code can make processor based > > choices > > +// > > +#define MDE_CPU_LOONGARCH64 > > + > > +#define EFIAPI > > + > > +// > > +// Make sure we are using the correct packing rules per EFI specificat= ion > > +// > > +#ifndef __GNUC__ > > +#pragma pack() > > +#endif > > + > > +// > > +// Assume standard LoongArch 64-bit alignment. > > +// Need to check portability of long long > > +// > > +typedef unsigned long UINT64; > > +typedef long INT64; > > +typedef unsigned int UINT32; > > +typedef int INT32; > > +typedef unsigned short UINT16; > > +typedef unsigned short CHAR16; > > +typedef short INT16; > > +typedef unsigned char BOOLEAN; > > +typedef unsigned char UINT8; > > +typedef char CHAR8; > > +typedef char INT8; > > + > > +// > > +// Unsigned value of native width. (4 bytes on supported 32-bit proces= sor > > instructions, > > +// 8 bytes on supported 64-bit processor instructions) > > +// > > + > > +typedef UINT64 UINTN; > > + > > +// > > +// Signed value of native width. (4 bytes on supported 32-bit processo= r > > instructions, > > +// 8 bytes on supported 64-bit processor instructions) > > +// > > +typedef INT64 INTN; > > + > > +// > > +// Processor specific defines > > +// > > + > > +// > > +// A value of native width with the highest bit set. > > +// > > +#define MAX_BIT 0x8000000000000000ULL > > +// > > +// A value of native width with the two highest bits set. > > +// > > +#define MAX_2_BITS 0xC000000000000000ULL > > + > > +// > > +// Maximum legal LoongArch 64-bit address > > +// > > +#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL > > + > > +// > > +// Maximum usable address at boot time (48 bits using 4KB pages) > > +// > > +#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL > > + > > + > > +// > > +// Maximum legal LoongArch 64-bit INTN and UINTN values. > > +// > > +#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL) > > +#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL) > > + > > +// > > +// Page allocation granularity for LoongArch > > +// > > +#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000) > > +#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000) > > + > > +#if defined(__GNUC__) > > + // > > + // For GNU assembly code, .global or .globl can declare global symbol= s. > > + // Define this macro to unify the usage. > > + // > > + #define ASM_GLOBAL .globl > > +#endif > > + > > +// > > +// The stack alignment required for LoongArch > > +// > > +#define CPU_STACK_ALIGNMENT 16 > > + > > +/** > > + Return the pointer to the first instruction of a function given a fun= ction > > pointer. > > + On LOONGARCH CPU architectures, these two pointer values are the same= , > > + so the implementation of this macro is very simple. > > + > > + @param FunctionPointer A pointer to a function. > > + > > + @return The pointer to the first instruction of a function given a fu= nction > > pointer. > > + > > +**/ > > +#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID > > *)(UINTN)(FunctionPointer) > > + > > +#ifndef __USER_LABEL_PREFIX__ > > +#define __USER_LABEL_PREFIX__ > > +#endif > > + > > +#endif > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > > index 59b405928b..18d42047e9 100644 > > --- a/MdePkg/MdePkg.dec > > +++ b/MdePkg/MdePkg.dec > > @@ -7,6 +7,7 @@ > > # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved. > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. > > # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP > > +# Copyright (c) 2022 Loongson Technology Corporation Limited. All righ= ts > > reserved.
> > # > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -43,6 +44,9 @@ > > [Includes.RISCV64] > > Include/RiscV64 > > > > +[Includes.LOONGARCH64] > > + Include/LoongArch64 > > + > > [LibraryClasses] > > ## @libraryclass Provides most usb APIs to support the Hid requests > > defined in Usb Hid 1.1 spec > > # and the standard requests defined in Usb 1.1 spec. > > diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc > > index a94959169b..1c83726b86 100644 > > --- a/MdePkg/MdePkg.dsc > > +++ b/MdePkg/MdePkg.dsc > > @@ -4,6 +4,7 @@ > > # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved. > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. > > # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> > +# Copyright (c) 2022 Loongson Technology Corporation Limited. All righ= ts > > reserved.
> > # > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -15,7 +16,7 @@ > > PLATFORM_VERSION =3D 1.08 > > DSC_SPECIFICATION =3D 0x00010005 > > OUTPUT_DIRECTORY =3D Build/Mde > > - SUPPORTED_ARCHITECTURES =3D > > IA32|X64|EBC|ARM|AARCH64|RISCV64 > > + SUPPORTED_ARCHITECTURES =3D > > IA32|X64|EBC|ARM|AARCH64|RISCV64|LOONGARCH64 > > BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT > > SKUID_IDENTIFIER =3D DEFAULT > > > > -- > > 2.27.0 > > > > > > > >=20 > > > --625540cc_64079548_6697 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi Abner,

Do I have to remove a "_" at the head and tail= ? All I found in MdePkg is that *.h files have two "_" at the head and tail= . If you are sure that EDK II coding style must contain only one "_" at the= head and tail, I will modify it.

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


On 4=E6=9C=88 7 2022, at 10:15 =E6=99=9A=E4=B8=8A, "Ch= ang, Abner (HPS SW/FW Technologist)" <abner.chang@hpe.com> wrote:


> -----Original Message-----
&= gt; From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ch= ao Li
> Sent: Wednesday, February 9, 2022 2:56 PM
&g= t; To: devel@edk2.groups.io
> Cc: Michael D Kinney <michael= .d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.co= m.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Baoqi
>= Zhang <zhangbaoqi@loongson.cn>; Dongyan Qian
> <qian= dongyan@loongson.cn>
> Subject: [edk2-devel] [staging/Loong= Arch RESEND PATCH v1 19/33] MdePkg:
> Add LoongArch LOONGARCH6= 4 binding
>
> Add LOONGARCH64 sections in MdePkg.= dec and LOONGARCH64
> ProcessorBind.h
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>= ; Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhigua= ng Liu <zhiguang.liu@intel.com>
>
> Signed-= off-by: Chao Li <lichao@loongson.cn>
> Co-authored-by: B= aoqi Zhang <zhangbaoqi@loongson.cn>
> Co-authored-by: Do= ngyan Qian <qiandongyan@loongson.cn>
> ---
>= ; MdePkg/Include/LoongArch64/ProcessorBind.h | 121
> +++++++++= ++++++++++++
> MdePkg/MdePkg.dec | 4 +
> MdePkg/M= dePkg.dsc | 3 +-
> 3 files changed, 127 insertions(+), 1 delet= ion(-)
> create mode 100644 MdePkg/Include/LoongArch64/Process= orBind.h
>
> diff --git a/MdePkg/Include/LoongArc= h64/ProcessorBind.h
> b/MdePkg/Include/LoongArch64/ProcessorBi= nd.h
> new file mode 100644
> index 0000000000..a= 10481e285
> --- /dev/null
> +++ b/MdePkg/Include/= LoongArch64/ProcessorBind.h
> @@ -0,0 +1,121 @@
>= +/** @file
> + Processor or Compiler specific defines and typ= es for LoongArch
> +
> + Copyright (c) 2022 Loong= son Technology Corporation Limited. All rights
> reserved.<= BR>
> +
> + SPDX-License-Identifier: BSD-2-Cla= use-Patent
> +
> +**/
> +
= > +#ifndef __PROCESSOR_BIND_H__
> +#define __PROCESSOR_BIND= _H__
Please remove the leading "_" and only keep one trailing "_"= to follow the edk2 coding standard. RISC-V ProcessorBind.h has the mistake= .

Abner
> +
> +//
> +/= / Define the processor type so other code can make processor based
> choices
> +//
> +#define MDE_CPU_LOONGARCH= 64
> +
> +#define EFIAPI
> +
> +//
> +// Make sure we are using the correct packing r= ules per EFI specification
> +//
> +#ifndef __GNU= C__
> +#pragma pack()
> +#endif
> +<= /div>
> +//
> +// Assume standard LoongArch 64-bit alig= nment.
> +// Need to check portability of long long
= > +//
> +typedef unsigned long UINT64;
> +type= def long INT64;
> +typedef unsigned int UINT32;
>= +typedef int INT32;
> +typedef unsigned short UINT16;
> +typedef unsigned short CHAR16;
> +typedef short INT16= ;
> +typedef unsigned char BOOLEAN;
> +typedef un= signed char UINT8;
> +typedef char CHAR8;
> +type= def char INT8;
> +
> +//
> +// Unsig= ned value of native width. (4 bytes on supported 32-bit processor
> instructions,
> +// 8 bytes on supported 64-bit processo= r instructions)
> +//
> +
> +typedef= UINT64 UINTN;
> +
> +//
> +// Signe= d value of native width. (4 bytes on supported 32-bit processor
&= gt; instructions,
> +// 8 bytes on supported 64-bit processor = instructions)
> +//
> +typedef INT64 INTN;
<= div>> +
> +//
> +// Processor specific defines=
> +//
> +
> +//
> +// = A value of native width with the highest bit set.
> +//
<= div>> +#define MAX_BIT 0x8000000000000000ULL
> +//
> +// A value of native width with the two highest bits set.> +//
> +#define MAX_2_BITS 0xC000000000000000ULL
> +
> +//
> +// Maximum legal LoongArch 64-b= it address
> +//
> +#define MAX_ADDRESS 0xFFFFFFF= FFFFFFFFFULL
> +
> +//
> +// Maximum= usable address at boot time (48 bits using 4KB pages)
> +//
> +#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL
> +=
> +
> +//
> +// Maximum legal Loong= Arch 64-bit INTN and UINTN values.
> +//
> +#defi= ne MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
> +#define MAX_UINTN= ((UINTN)0xFFFFFFFFFFFFFFFFULL)
> +
> +//
> +// Page allocation granularity for LoongArch
> +//
> +#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
> +#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)
>= ; +
> +#if defined(__GNUC__)
> + //
>= ; + // For GNU assembly code, .global or .globl can declare global symbols.=
> + // Define this macro to unify the usage.
> += //
> + #define ASM_GLOBAL .globl
> +#endif
=
> +
> +//
> +// The stack alignment requi= red for LoongArch
> +//
> +#define CPU_STACK_ALIG= NMENT 16
> +
> +/**
> + Return the p= ointer to the first instruction of a function given a function
&g= t; pointer.
> + On LOONGARCH CPU architectures, these two poin= ter values are the same,
> + so the implementation of this mac= ro is very simple.
> +
> + @param FunctionPointer= A pointer to a function.
> +
> + @return The poi= nter to the first instruction of a function given a function
>= pointer.
> +
> +**/
> +#define FUNC= TION_ENTRY_POINT(FunctionPointer) (VOID
> *)(UINTN)(FunctionPo= inter)
> +
> +#ifndef __USER_LABEL_PREFIX__
=
> +#define __USER_LABEL_PREFIX__
> +#endif
&= gt; +
> +#endif
> diff --git a/MdePkg/MdePkg.dec = b/MdePkg/MdePkg.dec
> index 59b405928b..18d42047e9 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -7,6 +7,7 @@
> # Copyright (c) 2007 - 2021, I= ntel Corporation. All rights reserved.<BR>
> # Portions = copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
<= div>> # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development= LP<BR>
> +# Copyright (c) 2022 Loongson Technology Corp= oration Limited. All rights
> reserved.<BR>
&g= t; #
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> #
> @@ -43,6 +44,9 @@
> [Includes.RISCV64]=
> Include/RiscV64
>
> +[Includes.LO= ONGARCH64]
> + Include/LoongArch64
> +
= > [LibraryClasses]
> ## @libraryclass Provides most usb API= s to support the Hid requests
> defined in Usb Hid 1.1 spec
> # and the standard requests defined in Usb 1.1 spec.
> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
> ind= ex a94959169b..1c83726b86 100644
> --- a/MdePkg/MdePkg.dsc
> +++ b/MdePkg/MdePkg.dsc
> @@ -4,6 +4,7 @@
> # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.= <BR>
> # Portions copyright (c) 2008 - 2009, Apple Inc. = All rights reserved.<BR>
> # (C) Copyright 2020 Hewlett = Packard Enterprise Development LP<BR>
> +# Copyright (c)= 2022 Loongson Technology Corporation Limited. All rights
> re= served.<BR>
> #
> # SPDX-License-Identifier= : BSD-2-Clause-Patent
> #
> @@ -15,7 +16,7 @@
> PLATFORM_VERSION =3D 1.08
> DSC_SPECIFICATION =3D = 0x00010005
> OUTPUT_DIRECTORY =3D Build/Mde
> - S= UPPORTED_ARCHITECTURES =3D
> IA32|X64|EBC|ARM|AARCH64|RISCV64<= /div>
> + SUPPORTED_ARCHITECTURES =3D
> IA32|X64|EBC|AR= M|AARCH64|RISCV64|LOONGARCH64
> BUILD_TARGETS =3D DEBUG|RELEAS= E|NOOPT
> SKUID_IDENTIFIER =3D DEFAULT
>
> --
> 2.27.0
>
>
>= ;
>
>
3D"Sent --625540cc_64079548_6697--