Thanks,
Chao
--------
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4054The 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/LoongArchThe edk2-platform code in Loonson community:https://github.com/loongson/edk2-platformsThe qemu code in Loongson community:https://gitlab.com/qemu-project/qemu.gitThe LoongArch Documentation in Loongson community:https://github.com/loongson/LoongArch-Documentation/tree/main/docsThe all patches at:https://github.com/loongson/edk2-platforms/tree/devel-LoongArch-patchv2 changes:- Remove the inline assembly from StableTimerLib.- troubleshoot TAB strings, convert TAB characters to spaces.- remove smm related code, loongarch has no smm mode.v3 changes:- delete ExtractHandler related code.- Boot UEFI with low 256M memory.- Modify common interrupt handling.v4 changes:- Remove qemu flash related code.- Modify fdt base address.v5 changes:- Add Udf driver support.- Split readme file into a separate patch.- Modify the code style- delete extra blank lines- use the assembly function definition macros in MdePkg- sort out the PCD variable Token value.v6 changes:- Obtain the serial port base address by resolving fdt.- Obtain the RTC base address by resolving fdt.- Use the public 16550 serial port driver.- Add Dxe Hob lib.Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>Cc: Bibo Mao <maobibo@loongson.cn>Cc: Chao Li <lichao@loongson.cn>Cc: Leif Lindholm <quic_llindhol@quicinc.com>Cc: Liming Gao <gaoliming@byosoft.com.cn>Cc: Michael D Kinney <michael.d.kinney@intel.com>xianglai li (16):Platform/Loongson: Add Serial Port libraryPlatform/Loongson: Support SECPlatform/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: Add Hob Dxe Lib.Platform/Loongson: Support DxePlatform/Loongson: Add Readme..../LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.c | 367 +++++++.../LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.h | 199 ++++.../Drivers/CpuDxe/CpuDxe.inf | 59 ++.../Drivers/CpuDxe/LoongArch64/Exception.c | 335 +++++++.../Drivers/CpuDxe/LoongArch64/Fpu.S | 97 ++.../Drivers/CpuDxe/LoongArch64/LoongArch.S | 321 +++++++.../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c | 538 +++++++++++.../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.h | 207 ++++.../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf | 44 +.../Drivers/StableTimerDxe/Timer.c | 388 ++++++++.../Drivers/StableTimerDxe/Timer.h | 172 ++++.../Drivers/StableTimerDxe/TimerConfig.S | 38 +.../Drivers/StableTimerDxe/TimerDxe.inf | 44 +.../Include/Guid/Early16550UartBaseAddress.h | 22 +.../LoongArchQemuPkg/Include/Library/Cpu.h | 237 +++++.../LoongArchQemuPkg/Include/Library/MmuLib.h | 85 ++.../Include/Library/QemuFwCfgLib.h | 174 ++++.../Include/Library/StableTimer.h | 59 ++.../Fdt16550SerialPortHookLib.c | 57 ++.../Fdt16550SerialPortHookLib.inf | 38 +.../LsRealTimeClockLib/LsRealTimeClock.h | 40 +.../LsRealTimeClockLib/LsRealTimeClockLib.c | 335 +++++++.../LsRealTimeClockLib/LsRealTimeClockLib.inf | 47 +.../LoongArchQemuPkg/Library/MmuLib/Mmu.S | 155 +++.../Library/MmuLib/MmuBaseLib.inf | 40 +.../Library/MmuLib/MmuBaseLibPei.inf | 47 +.../Library/MmuLib/MmuLibCore.c | 831 ++++++++++++++++.../Library/MmuLib/MmuLibCore.h | 40 +.../Library/MmuLib/MmuLibCorePei.c | 231 +++++.../LoongArchQemuPkg/Library/MmuLib/mmu.h | 190 ++++.../LoongArchQemuPkg/Library/MmuLib/page.h | 280 ++++++.../LoongArchQemuPkg/Library/MmuLib/pte.h | 57 ++.../PeiServicesTablePointer.c | 79 ++.../PeiServicesTablePointer.h | 39 +.../PeiServicesTablePointerLib.S | 40 +.../PeiServicesTablePointerLib.inf | 32 +.../PlatformBootManagerLib/PlatformBm.c | 742 +++++++++++++++.../PlatformBootManagerLib/PlatformBm.h | 112 +++.../PlatformBootManagerLib.inf | 75 ++.../PlatformBootManagerLib/QemuKernel.c | 81 ++.../QemuFwCfgLib/QemuFwCfgLibInternal.h | 63 ++.../Library/QemuFwCfgLib/QemuFwCfgPei.c | 117 +++.../Library/QemuFwCfgLib/QemuFwCfgPeiLib.c | 463 +++++++++.../Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf | 46 +.../BaseResetSystemAcpiGed.c | 146 +++.../BaseResetSystemAcpiGedLib.inf | 37 +.../DxeResetSystemAcpiGed.c | 257 +++++.../DxeResetSystemAcpiGedLib.inf | 41 +.../ResetSystemAcpiLib/ResetSystemAcpiGed.c | 128 +++.../ResetSystemAcpiLib/ResetSystemAcpiGed.h | 23 +.../SerialPortLib/EarlySerialPortLib16550.c | 900 ++++++++++++++++++.../SerialPortLib/EarlySerialPortLib16550.inf | 46 +.../Library/StableTimerLib/Count.S | 52 +.../Library/StableTimerLib/TimerLib.c | 236 +++++.../Library/StableTimerLib/TimerLib.inf | 32 +.../Library/VirtDxeHobLib/HobLib.c | 590 ++++++++++++.../Library/VirtDxeHobLib/VirtDxeHobLib.inf | 34 +.../Loongson/LoongArchQemuPkg/Loongson.dec | 76 ++.../Loongson/LoongArchQemuPkg/Loongson.dsc | 647 +++++++++++++.../Loongson/LoongArchQemuPkg/Loongson.fdf | 347 +++++++.../LoongArchQemuPkg/Loongson.fdf.inc | 29 +.../LoongArchQemuPkg/PlatformPei/Fv.c | 58 ++.../LoongArchQemuPkg/PlatformPei/MemDetect.c | 104 ++.../LoongArchQemuPkg/PlatformPei/Platform.c | 433 +++++++++.../LoongArchQemuPkg/PlatformPei/Platform.h | 86 ++.../PlatformPei/PlatformPei.inf | 74 ++Platform/Loongson/LoongArchQemuPkg/Readme.md | 60 ++.../LoongArchQemuPkg/Sec/LoongArch64/Start.S | 84 ++.../Loongson/LoongArchQemuPkg/Sec/SecMain.c | 494 ++++++++++.../Loongson/LoongArchQemuPkg/Sec/SecMain.inf | 51 +Readme.md | 9 +71 files changed, 12737 insertions(+)create mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/CpuDxe.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/Exception.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/Fpu.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/CpuDxe/LoongArch64/LoongArch.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/Timer.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/Timer.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/TimerConfig.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Drivers/StableTimerDxe/TimerDxe.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Guid/Early16550UartBaseAddress.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/Cpu.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/MmuLib.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/QemuFwCfgLib.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/Library/StableTimer.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClock.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClockLib.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeClockLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/Mmu.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuBaseLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuBaseLibPei.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCore.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCore.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuLibCorePei.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/mmu.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/page.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/pte.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBm.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBm.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/PlatformBootManagerLib/QemuKernel.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgPei.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/EarlySerialPortLib16550.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/EarlySerialPortLib16550.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/Count.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/TimerLib.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/StableTimerLib/TimerLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/VirtDxeHobLib/HobLib.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Library/VirtDxeHobLib/VirtDxeHobLib.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.deccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.dsccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.fdfcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Loongson.fdf.inccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Fv.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.hcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.infcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Readme.mdcreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Start.Screate mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.ccreate mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf--2.31.1