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.web12.440.1648174604872600962 for ; Thu, 24 Mar 2022 19:16:45 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lixianglai@loongson.cn) Received: from localhost.localdomain (unknown [10.2.10.197]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx3xMIJj1irWAPAA--.15467S2; Fri, 25 Mar 2022 10:16:41 +0800 (CST) From: "xianglai" To: devel@edk2.groups.io Cc: maobibo@loongson.cn Subject: [edk2-platforms][PATCH V2 00/16] Platform: Add Loongson support. Date: Fri, 25 Mar 2022 10:16:04 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf9Dx3xMIJj1irWAPAA--.15467S2 X-Coremail-Antispam: 1UD129KBjvAXoW3tryUKr43Gw4fWF47Zw1UWrg_yoW8JFykto W8JFZFkw4UJr1fAa4vg3ZxJrWIq3W2qw4Fqr40vayUZFZIkr9FqFs8Ja4xWFn5ZF9xAw15 G3s5K3ykJFZrXrZ3n29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UjIYCTnIWjp_UUUYY7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xva j40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2 x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8 Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI 0_Cr1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xf McIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7 v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVCm -wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr 0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1l IxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfU5WlkUUUUU X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ Content-Transfer-Encoding: 8bit The uploaded code generates firmware to support Linux launching on the LoongArch platform under qemu, So it will run in a virtual machine. LoongArch is the general processor architecture of Loongson. You can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/. You can also view the code through the Loongson community. The edk2 code in Loongson community: https://github.com/loongson/edk2/tree/LoongArch The edk2-platform code in Loonson community: https://github.com/loongson/edk2-platforms The qemu code in Loongson community: https://github.com/loongson/qemu/tree/tcg-dev The LoongArch Documentation in Loongson community: https://github.com/loongson/LoongArch-Documentation/tree/main/docs xianglai li (16): Platform/Loongson: Add Serial Port library Platform/Loongson: Support SEC And Add Readme.md Platform/Loongson: Add PeiServicesTablePointerLib. Platform/Loongson: Add QemuFwCfgLib. Platform/Loongson: Add MmuLib. Platform/Loongson: Add StableTimerLib. Platform/Loongson: Support PEI phase. Platform/Loongson: Add CPU DXE driver. Platform/Loongson: Add PciCpuIoDxe driver. Platform/Loongson: Add timer Dxe driver. Platform/Loongson: Add RealTime Clock lib. Platform/Loongson: Add Platform Boot Manager Lib. Platform/Loongson: Add Reset System Lib. Platform/Loongson: Support Dxe Platform/Loongson: Add QemuFlashFvbServicesRuntimeDxe driver. Platform/Loongson: Support for saving variables to flash. .../LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.c | 382 ++++++ .../LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.h | 153 +++ .../Drivers/CpuDxe/CpuDxe.inf | 56 + .../Drivers/CpuDxe/LoongArch64/Exception.c | 337 +++++ .../Drivers/CpuDxe/LoongArch64/Fpu.S | 67 + .../Drivers/CpuDxe/LoongArch64/LoongArch.S | 288 ++++ .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c | 548 ++++++++ .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.h | 219 ++++ .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf | 40 + .../QemuFlashFvbServicesRuntimeDxe/FvbInfo.c | 115 ++ .../FvbServicesRuntimeDxe.inf | 76 ++ .../FvbServicesSmm.inf | 70 + .../FwBlockService.c | 1158 +++++++++++++++++ .../FwBlockService.h | 178 +++ .../FwBlockServiceDxe.c | 154 +++ .../FwBlockServiceSmm.c | 63 + .../QemuFlash.c | 252 ++++ .../QemuFlash.h | 86 ++ .../QemuFlashDxe.c | 21 + .../Drivers/StableTimerDxe/Timer.c | 405 ++++++ .../Drivers/StableTimerDxe/Timer.h | 166 +++ .../Drivers/StableTimerDxe/TimerDxe.inf | 40 + .../Include/IndustryStandard/QemuFwCfg.h | 95 ++ .../LoongArchQemuPkg/Include/Library/Cpu.h | 373 ++++++ .../LoongArchQemuPkg/Include/Library/MmuLib.h | 85 ++ .../Include/Library/QemuFwCfgLib.h | 186 +++ .../Include/Library/StableTimer.h | 42 + .../Include/LoongArchAsmMacro.h | 23 + .../Include/LoongArchQemuPlatform.h | 103 ++ .../LsRealTimeClockLib/LsRealTimeClock.h | 41 + .../LsRealTimeClockLib/LsRealTimeClockLib.c | 343 +++++ .../LsRealTimeClockLib/LsRealTimeClockLib.inf | 41 + .../LoongArchQemuPkg/Library/MmuLib/Mmu.S | 35 + .../Library/MmuLib/MmuBaseLib.inf | 35 + .../Library/MmuLib/MmuBaseLibPei.inf | 45 + .../Library/MmuLib/MmuLibCore.c | 908 +++++++++++++ .../Library/MmuLib/MmuLibCore.h | 39 + .../Library/MmuLib/MmuLibCorePei.c | 235 ++++ .../LoongArchQemuPkg/Library/MmuLib/mmu.h | 104 ++ .../LoongArchQemuPkg/Library/MmuLib/page.h | 267 ++++ .../LoongArchQemuPkg/Library/MmuLib/pte.h | 57 + .../PeiServicesTablePointer.c | 78 ++ .../PeiServicesTablePointerLib.inf | 32 + .../PlatformBootManagerLib/PlatformBm.c | 760 +++++++++++ .../PlatformBootManagerLib/PlatformBm.h | 112 ++ .../PlatformBootManagerLib.inf | 77 ++ .../PlatformBootManagerLib/QemuKernel.c | 49 + .../Library/QemuFwCfgLib/QemuFwCfg.c | 119 ++ .../Library/QemuFwCfgLib/QemuFwCfgLib.c | 477 +++++++ .../Library/QemuFwCfgLib/QemuFwCfgLib.inf | 44 + .../QemuFwCfgLib/QemuFwCfgLibInternal.h | 64 + .../Library/ResetSystemLib/ResetSystemLib.c | 155 +++ .../Library/ResetSystemLib/ResetSystemLib.inf | 40 + .../Library/SerialPortLib/SerialPortLib.c | 612 +++++++++ .../Library/SerialPortLib/SerialPortLib.inf | 36 + .../Library/StableTimerLib/Count.S | 26 + .../Library/StableTimerLib/TimerLib.c | 262 ++++ .../Library/StableTimerLib/TimerLib.inf | 28 + .../Loongson/LoongArchQemuPkg/Loongson.dec | 78 ++ .../Loongson/LoongArchQemuPkg/Loongson.dsc | 592 +++++++++ .../Loongson/LoongArchQemuPkg/Loongson.fdf | 358 +++++ .../LoongArchQemuPkg/Loongson.fdf.inc | 74 ++ .../LoongArchQemuPkg/PlatformPei/Fv.c | 61 + .../LoongArchQemuPkg/PlatformPei/MemDetect.c | 116 ++ .../LoongArchQemuPkg/PlatformPei/Platform.c | 264 ++++ .../LoongArchQemuPkg/PlatformPei/Platform.h | 87 ++ .../PlatformPei/PlatformPei.inf | 72 + Platform/Loongson/LoongArchQemuPkg/Readme.md | 59 + .../LoongArchQemuPkg/Sec/LoongArch64/Start.S | 76 ++ .../Loongson/LoongArchQemuPkg/Sec/SecMain.c | 510 ++++++++ .../Loongson/LoongArchQemuPkg/Sec/SecMain.inf | 49 + .../LoongArchQemuPkg/VarStore.fdf.inc | 64 + Readme.md | 9 + 73 files changed, 13371 insertions(+) create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/Exception.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/Fpu.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/LoongArch.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FvbInfo.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/Timer.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/Timer.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/TimerDxe.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/IndustryStandard/QemuFwCfg.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/Cpu.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/MmuLib.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/QemuFwCfgLib.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/StableTimer.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/LoongArchAsmMacro.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/LoongArchQemuPlatform.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClock.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClockLib.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClockLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/Mmu.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuBaseLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuBaseLibPei.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCore.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCore.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCorePei.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/mmu.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/page.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/pte.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBm.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBm.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/QemuKernel.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfg.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemLib/ResetSystemLib.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemLib/ResetSystemLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/SerialPortLib.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/SerialPortLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/Count.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/TimerLib.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/TimerLib.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.dec create mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.dsc create mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.fdf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.fdf.inc create mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Fv.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.h create mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/Readme.md create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Start.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf create mode 100644 Platform/Loongson/LoongArchQemuPkg/VarStore.fdf.inc V2 changs: 1.Added flash variable read and write support. 2.Added small page MMU support. 3.Remove the kernel load function. 4.Delete the Boot parameter interface. -- 2.31.1