<div>Hi Abner,</div><br><div>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.</div><br><div><signature id="local-70af077c-8d4b"><p class="ex1" style="display: block; font-size: 12px; -webkit-margin-before: 1__qem; -webkit-margin-after: 1__qem; -webkit-margin-start: 0; -webkit-margin-end: 0; color: #666;">--<br>Thanks,<br>Chao<br>------------------------</p><br><div style="display: block; font-size: 0.9em; min-width: 250px; max-width: 300px; margin-top: 4px; padding-top: 4px;"><div style="display: block;"><div style="display: block;"></div><div style="display: block;"></div></div></div></signature></div><div class="gmail_quote_attribution">On 4月 7 2022, at 10:15 ζ™šδΈŠ, "Chang, Abner (HPS SW/FW Technologist)" <abner.chang@hpe.com> wrote:</div><blockquote><div><br><br><div>> -----Original Message-----</div><div>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li</div><div>> Sent: Wednesday, February 9, 2022 2:56 PM</div><div>> To: devel@edk2.groups.io</div><div>> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao</div><div>> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Baoqi</div><div>> Zhang <zhangbaoqi@loongson.cn>; Dongyan Qian</div><div>> <qiandongyan@loongson.cn></div><div>> Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 19/33] MdePkg:</div><div>> Add LoongArch LOONGARCH64 binding</div><div>></div><div>> Add LOONGARCH64 sections in MdePkg.dec and LOONGARCH64</div><div>> ProcessorBind.h</div><div>></div><div>> Cc: Michael D Kinney <michael.d.kinney@intel.com></div><div>> Cc: Liming Gao <gaoliming@byosoft.com.cn></div><div>> Cc: Zhiguang Liu <zhiguang.liu@intel.com></div><div>></div><div>> Signed-off-by: Chao Li <lichao@loongson.cn></div><div>> Co-authored-by: Baoqi Zhang <zhangbaoqi@loongson.cn></div><div>> Co-authored-by: Dongyan Qian <qiandongyan@loongson.cn></div><div>> ---</div><div>> MdePkg/Include/LoongArch64/ProcessorBind.h | 121</div><div>> +++++++++++++++++++++</div><div>> MdePkg/MdePkg.dec | 4 +</div><div>> MdePkg/MdePkg.dsc | 3 +-</div><div>> 3 files changed, 127 insertions(+), 1 deletion(-)</div><div>> create mode 100644 MdePkg/Include/LoongArch64/ProcessorBind.h</div><div>></div><div>> diff --git a/MdePkg/Include/LoongArch64/ProcessorBind.h</div><div>> b/MdePkg/Include/LoongArch64/ProcessorBind.h</div><div>> new file mode 100644</div><div>> index 0000000000..a10481e285</div><div>> --- /dev/null</div><div>> +++ b/MdePkg/Include/LoongArch64/ProcessorBind.h</div><div>> @@ -0,0 +1,121 @@</div><div>> +/** @file</div><div>> + Processor or Compiler specific defines and types for LoongArch</div><div>> +</div><div>> + Copyright (c) 2022 Loongson Technology Corporation Limited. All rights</div><div>> reserved.<BR></div><div>> +</div><div>> + SPDX-License-Identifier: BSD-2-Clause-Patent</div><div>> +</div><div>> +**/</div><div>> +</div><div>> +#ifndef __PROCESSOR_BIND_H__</div><div>> +#define __PROCESSOR_BIND_H__</div><div>Please remove the leading "_" and only keep one trailing "_" to follow the edk2 coding standard. RISC-V ProcessorBind.h has the mistake.</div><br><div>Abner</div><div>> +</div><div>> +//</div><div>> +// Define the processor type so other code can make processor based</div><div>> choices</div><div>> +//</div><div>> +#define MDE_CPU_LOONGARCH64</div><div>> +</div><div>> +#define EFIAPI</div><div>> +</div><div>> +//</div><div>> +// Make sure we are using the correct packing rules per EFI specification</div><div>> +//</div><div>> +#ifndef __GNUC__</div><div>> +#pragma pack()</div><div>> +#endif</div><div>> +</div><div>> +//</div><div>> +// Assume standard LoongArch 64-bit alignment.</div><div>> +// Need to check portability of long long</div><div>> +//</div><div>> +typedef unsigned long UINT64;</div><div>> +typedef long INT64;</div><div>> +typedef unsigned int UINT32;</div><div>> +typedef int INT32;</div><div>> +typedef unsigned short UINT16;</div><div>> +typedef unsigned short CHAR16;</div><div>> +typedef short INT16;</div><div>> +typedef unsigned char BOOLEAN;</div><div>> +typedef unsigned char UINT8;</div><div>> +typedef char CHAR8;</div><div>> +typedef char INT8;</div><div>> +</div><div>> +//</div><div>> +// Unsigned value of native width. (4 bytes on supported 32-bit processor</div><div>> instructions,</div><div>> +// 8 bytes on supported 64-bit processor instructions)</div><div>> +//</div><div>> +</div><div>> +typedef UINT64 UINTN;</div><div>> +</div><div>> +//</div><div>> +// Signed value of native width. (4 bytes on supported 32-bit processor</div><div>> instructions,</div><div>> +// 8 bytes on supported 64-bit processor instructions)</div><div>> +//</div><div>> +typedef INT64 INTN;</div><div>> +</div><div>> +//</div><div>> +// Processor specific defines</div><div>> +//</div><div>> +</div><div>> +//</div><div>> +// A value of native width with the highest bit set.</div><div>> +//</div><div>> +#define MAX_BIT 0x8000000000000000ULL</div><div>> +//</div><div>> +// A value of native width with the two highest bits set.</div><div>> +//</div><div>> +#define MAX_2_BITS 0xC000000000000000ULL</div><div>> +</div><div>> +//</div><div>> +// Maximum legal LoongArch 64-bit address</div><div>> +//</div><div>> +#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL</div><div>> +</div><div>> +//</div><div>> +// Maximum usable address at boot time (48 bits using 4KB pages)</div><div>> +//</div><div>> +#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL</div><div>> +</div><div>> +</div><div>> +//</div><div>> +// Maximum legal LoongArch 64-bit INTN and UINTN values.</div><div>> +//</div><div>> +#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)</div><div>> +#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)</div><div>> +</div><div>> +//</div><div>> +// Page allocation granularity for LoongArch</div><div>> +//</div><div>> +#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)</div><div>> +#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)</div><div>> +</div><div>> +#if defined(__GNUC__)</div><div>> + //</div><div>> + // For GNU assembly code, .global or .globl can declare global symbols.</div><div>> + // Define this macro to unify the usage.</div><div>> + //</div><div>> + #define ASM_GLOBAL .globl</div><div>> +#endif</div><div>> +</div><div>> +//</div><div>> +// The stack alignment required for LoongArch</div><div>> +//</div><div>> +#define CPU_STACK_ALIGNMENT 16</div><div>> +</div><div>> +/**</div><div>> + Return the pointer to the first instruction of a function given a function</div><div>> pointer.</div><div>> + On LOONGARCH CPU architectures, these two pointer values are the same,</div><div>> + so the implementation of this macro is very simple.</div><div>> +</div><div>> + @param FunctionPointer A pointer to a function.</div><div>> +</div><div>> + @return The pointer to the first instruction of a function given a function</div><div>> pointer.</div><div>> +</div><div>> +**/</div><div>> +#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID</div><div>> *)(UINTN)(FunctionPointer)</div><div>> +</div><div>> +#ifndef __USER_LABEL_PREFIX__</div><div>> +#define __USER_LABEL_PREFIX__</div><div>> +#endif</div><div>> +</div><div>> +#endif</div><div>> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec</div><div>> index 59b405928b..18d42047e9 100644</div><div>> --- a/MdePkg/MdePkg.dec</div><div>> +++ b/MdePkg/MdePkg.dec</div><div>> @@ -7,6 +7,7 @@</div><div>> # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR></div><div>> # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR></div><div>> # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR></div><div>> +# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights</div><div>> reserved.<BR></div><div>> #</div><div>> # SPDX-License-Identifier: BSD-2-Clause-Patent</div><div>> #</div><div>> @@ -43,6 +44,9 @@</div><div>> [Includes.RISCV64]</div><div>> Include/RiscV64</div><div>></div><div>> +[Includes.LOONGARCH64]</div><div>> + Include/LoongArch64</div><div>> +</div><div>> [LibraryClasses]</div><div>> ## @libraryclass Provides most usb APIs to support the Hid requests</div><div>> defined in Usb Hid 1.1 spec</div><div>> # and the standard requests defined in Usb 1.1 spec.</div><div>> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc</div><div>> index a94959169b..1c83726b86 100644</div><div>> --- a/MdePkg/MdePkg.dsc</div><div>> +++ b/MdePkg/MdePkg.dsc</div><div>> @@ -4,6 +4,7 @@</div><div>> # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR></div><div>> # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR></div><div>> # (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR></div><div>> +# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights</div><div>> reserved.<BR></div><div>> #</div><div>> # SPDX-License-Identifier: BSD-2-Clause-Patent</div><div>> #</div><div>> @@ -15,7 +16,7 @@</div><div>> PLATFORM_VERSION = 1.08</div><div>> DSC_SPECIFICATION = 0x00010005</div><div>> OUTPUT_DIRECTORY = Build/Mde</div><div>> - SUPPORTED_ARCHITECTURES =</div><div>> IA32|X64|EBC|ARM|AARCH64|RISCV64</div><div>> + SUPPORTED_ARCHITECTURES =</div><div>> IA32|X64|EBC|ARM|AARCH64|RISCV64|LOONGARCH64</div><div>> BUILD_TARGETS = DEBUG|RELEASE|NOOPT</div><div>> SKUID_IDENTIFIER = DEFAULT</div><div>></div><div>> --</div><div>> 2.27.0</div><div>></div><div>></div><div>></div><div>> </div><div>></div></div></blockquote><img class="mailspring-open" alt="Sent from Mailspring" width="0" height="0" style="border:0; width:0; height:0;" src="https://link.getmailspring.com/open/A5594BA5-3732-4A3B-B768-7C0A7F11A15B@getmailspring.com?me=a03b887c&recipient=ZGV2ZWxAZWRrMi5ncm91cHMuaW8%3D">


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/88765">View/Reply Online (#88765)</a> |    |  <a target="_blank" href="https://groups.io/mt/89016991/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>