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.web10.4233.1663148200042396430 for ; Wed, 14 Sep 2022 02:36:41 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lichao@loongson.cn) Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxkOCeoCFjEwAZAA--.31954S2; Wed, 14 Sep 2022 17:36:30 +0800 (CST) From: "Chao Li" To: devel@edk2.groups.io Cc: Ray Ni , Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu , Maciej Rabeda , Jiaxin Wu , Siyuan Fu , Jiewen Yao , Jian J Wang , Xiaoyu Lu , Zhiguang Liu , Zhichao Gao , Bob Feng , Yuwei Chen Subject: [PATCH v2 00/34] Add a new architecture called LoongArch in EDK II Date: Wed, 14 Sep 2022 17:35:56 +0800 Message-Id: <20220914093630.3636435-1-lichao@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxkOCeoCFjEwAZAA--.31954S2 X-Coremail-Antispam: 1UD129KBjvJXoW3Ar47ArWDtFykWFWrXr4fXwb_yoWDXr4xpa 1jkr4fGF1UKFWaqw43Ka4UWFnYkFWkGFy5GFs0vr17C3y2yF1kG3sFyrWrWry3Z34rt34F 9ryfKF4Du3WDJrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvIb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwV C2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC 0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4IIrI8v6xkF7I0E8cxan2IY 04v7MxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s 026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_ GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20x vEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x07j189NUUUUU= X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAJCGMgctwUuAACsD Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053 UEFI Spec V2.10 already supports LoongArch and all changes of this commit passwed Azure CI testing, so let's enable it in EDK2. This commit contains 35 patchs, with patch 0 is the cover and the rest being the LoongArch base code. Changes from v1 to v2: 1. For patch 0008, added IANA website link in the commit message and Dhcp.h. 2. Added IANA, Microsft and UEFI specification links in every patch commit message that uses them. 3. For patch 0023, LoongArch64 supports unaligned access operations, so use the unaligned read/write generic implementation. Added Barrier.S file to provide barrier operations for LoongArch. 4. For patch 0024, convert inline assembly code to ASM code. 5. Added the BZ link in every patch commit message. Please refer to this URL for the code repo of LoongArch64: https://github.com/loongson/edk2/tree/LoongArch Fore more documents of LoongArch please refer to following URL: https://loongson.github.io/LoongArch-Documentation/README-EN.html Modified modules: FatPkg, FmpDevicePkg, NetworkPkg, NetworkPkg/HttpBootDxe, CryptoPkg, MdePkg/Include, SecurityPkg, ShellPkg, UnitTestFrameworkPkg, MdePkg/DxeServicesLib, MdeModulePkg, .python/SpellCheck, BaseTools, .azurepipelines, .pytool, MdePkg, MdeModulePkg and MdePkg/MdePkg.ci.yaml. Cc: Ray Ni Cc: Liming Gao Cc: Michael D Kinney Cc: Guomin Jiang Cc: Wei6 Xu Cc: Maciej Rabeda Cc: Jiaxin Wu Cc: Siyuan Fu Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Zhiguang Liu Cc: Zhichao Gao Cc: Bob Feng Cc: Yuwei Chen Chao Li (34): MdePkg: Added file of DebugSupport.h to MdePkg.ci.yaml MdePkg: Added LoongArch jump buffer register definition to MdePkg.ci.yaml FatPkg: Add LOONGARCH64 architecture for EDK2 CI. FmpDevicePkg: Add LOONGARCH64 architecture for EDK2 CI. NetworkPkg: Add LOONGARCH64 architecture for EDK2 CI. NetworkPkg/HttpBootDxe: Add LOONGARCH64 architecture for EDK2 CI. CryptoPkg: Add LOONGARCH64 architecture for EDK2 CI. MdePkg/Include: Add LOONGARCH related definitions EDK2 CI. SecurityPkg: Add LOONGARCH64 architecture for EDK2 CI. ShellPkg: Add LOONGARCH64 architecture for EDK2 CI. UnitTestFrameworkPkg: Add LOONGARCH64 architecture for EDK2 CI. MdePkg/DxeServicesLib: Add LOONGARCH64 architecture MdeModulePkg: Use LockBoxNullLib for LOONGARCH64 .python/SpellCheck: Add "Loongson" and "LOONGARCH" to "words" section BaseTools: BaseTools changes for LoongArch platform. BaseTools: BaseTools changes for LoongArch platform. BaseTools: BaseTools changes for LoongArch platform. BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI. .azurepipelines: Add LoongArch64 architecture on LoongArch64 EDK2 CI. .pytool: Add LoongArch64 architecture on LoongArch64 EDK2 CI. MdePkg: Add LoongArch LOONGARCH64 binding MdePkg/Include: LoongArch definitions. MdePkg/BaseLib: BaseLib for LOONGARCH64 architecture. MdePkg/BaseCacheMaintenanceLib: LoongArch cache maintenance implementation. MdePkg/BaseIoLibIntrinsic: IoLibNoIo for LoongArch architecture. MdePkg/BasePeCoff: Add LoongArch PE/Coff related code. MdePkg/BaseCpuLib: LoongArch Base CPU library implementation. MdePkg/BaseSynchronizationLib: LoongArch cache related code. MdePkg/BaseSafeIntLib: Add LoongArch64 architecture for BaseSafeIntLib. MdeModulePkg/Logo: Add LoongArch64 architecture. MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture. MdeModulePkg/DxeIplPeim : LoongArch DxeIPL implementation. NetworkPkg: Add LoongArch64 architecture. BaseTools: Add LoongArch64 binding. .azurepipelines/Ubuntu-GCC5.yml | 3 +- .pytool/CISettings.py | 5 +- .pytool/Plugin/SpellCheck/cspell.base.yaml | 4 +- ...gcc_loongarch64_unknown_linux_ext_dep.yaml | 22 ++ BaseTools/Conf/tools_def.template | 54 +++- .../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py | 31 ++ BaseTools/Source/C/Common/BasePeCoff.c | 15 +- BaseTools/Source/C/Common/PeCoffLoaderEx.c | 79 +++++ BaseTools/Source/C/GNUmakefile | 3 + BaseTools/Source/C/GenFv/GenFvInternalLib.c | 125 +++++++- BaseTools/Source/C/GenFw/Elf64Convert.c | 293 +++++++++++++++++- BaseTools/Source/C/GenFw/elf_common.h | 94 ++++++ .../C/Include/IndustryStandard/PeImage.h | 57 ++-- .../C/Include/LoongArch64/ProcessorBind.h | 80 +++++ BaseTools/Source/C/Makefiles/header.makefile | 6 + BaseTools/Source/Python/Common/DataType.py | 21 +- .../Source/Python/UPT/Library/DataType.py | 24 +- BaseTools/Source/Python/build/buildoptions.py | 3 +- CryptoPkg/CryptoPkg.dsc | 3 +- .../Library/BaseCryptLib/BaseCryptLib.inf | 6 +- .../Library/BaseCryptLib/RuntimeCryptLib.inf | 4 + .../BaseCryptLibNull/BaseCryptLibNull.inf | 3 +- .../BaseCryptLibOnProtocolPpi/DxeCryptLib.inf | 3 +- .../BaseCryptLibOnProtocolPpi/PeiCryptLib.inf | 3 +- CryptoPkg/Library/Include/CrtLibSupport.h | 3 +- CryptoPkg/Library/OpensslLib/OpensslLib.inf | 2 + .../Library/OpensslLib/OpensslLibCrypto.inf | 2 + CryptoPkg/Library/TlsLib/TlsLib.inf | 3 +- CryptoPkg/Library/TlsLibNull/TlsLibNull.inf | 3 +- FatPkg/FatPkg.dsc | 3 +- FmpDevicePkg/FmpDevicePkg.dsc | 3 +- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 6 +- .../Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c | 63 ++++ MdeModulePkg/Logo/Logo.inf | 3 +- MdeModulePkg/MdeModulePkg.dsc | 4 +- .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf | 9 +- MdePkg/Include/IndustryStandard/Dhcp.h | 45 +-- MdePkg/Include/IndustryStandard/PeImage.h | 9 + MdePkg/Include/Library/BaseLib.h | 24 ++ MdePkg/Include/LoongArch64/ProcessorBind.h | 120 +++++++ MdePkg/Include/Protocol/DebugSupport.h | 107 ++++++- MdePkg/Include/Protocol/PxeBaseCode.h | 3 + MdePkg/Include/Uefi/UefiBaseType.h | 14 + MdePkg/Include/Uefi/UefiSpec.h | 16 +- .../BaseCacheMaintenanceLib.inf | 6 +- .../BaseCacheMaintenanceLib/LoongArchCache.c | 254 +++++++++++++++ MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 7 +- MdePkg/Library/BaseCpuLib/BaseCpuLib.uni | 5 +- .../BaseCpuLib/LoongArch/CpuFlushTlb.S | 15 + .../Library/BaseCpuLib/LoongArch/CpuSleep.S | 15 + .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 10 +- MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c | 3 +- MdePkg/Library/BaseLib/BaseLib.inf | 16 +- MdePkg/Library/BaseLib/LoongArch64/Barrier.S | 28 ++ .../BaseLib/LoongArch64/CpuBreakpoint.S | 24 ++ MdePkg/Library/BaseLib/LoongArch64/CpuPause.S | 31 ++ .../BaseLib/LoongArch64/DisableInterrupts.S | 21 ++ .../BaseLib/LoongArch64/EnableInterrupts.S | 21 ++ .../BaseLib/LoongArch64/GetInterruptState.S | 35 +++ .../BaseLib/LoongArch64/InternalSwitchStack.c | 58 ++++ .../Library/BaseLib/LoongArch64/MemoryFence.S | 18 ++ .../BaseLib/LoongArch64/SetJumpLongJump.S | 49 +++ .../Library/BaseLib/LoongArch64/SwitchStack.S | 39 +++ MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 3 +- .../Library/BasePeCoffLib/BasePeCoffLib.inf | 5 + .../Library/BasePeCoffLib/BasePeCoffLib.uni | 2 + .../BasePeCoffLib/LoongArch/PeCoffLoaderEx.c | 137 ++++++++ .../Library/BaseSafeIntLib/BaseSafeIntLib.inf | 9 +- .../BaseSynchronizationLib.inf | 5 + .../LoongArch64/Synchronization.c | 246 +++++++++++++++ .../Library/DxeServicesLib/DxeServicesLib.inf | 4 +- MdePkg/MdePkg.ci.yaml | 13 + MdePkg/MdePkg.dec | 4 + MdePkg/MdePkg.dsc | 3 +- NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 3 + NetworkPkg/Network.dsc.inc | 3 +- NetworkPkg/NetworkPkg.dsc | 3 +- SecurityPkg/SecurityPkg.dsc | 3 +- ShellPkg/ShellPkg.dsc | 3 +- UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 3 +- 80 files changed, 2368 insertions(+), 119 deletions(-) create mode 100644 BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml create mode 100644 BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h create mode 100644 MdeModulePkg/Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c create mode 100644 MdePkg/Include/LoongArch64/ProcessorBind.h create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Barrier.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/CpuBreakpoint.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/CpuPause.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/GetInterruptState.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/InternalSwitchStack.c create mode 100644 MdePkg/Library/BaseLib/LoongArch64/MemoryFence.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/SetJumpLongJump.S create mode 100644 MdePkg/Library/BaseLib/LoongArch64/SwitchStack.S create mode 100644 MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c create mode 100644 MdePkg/Library/BaseSynchronizationLib/LoongArch64/Synchronization.c -- 2.27.0