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.web08.1043.1648179473950497338 for ; Thu, 24 Mar 2022 20:37:54 -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.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxOswOOT1iTW4PAA--.15759S2; Fri, 25 Mar 2022 11:37:50 +0800 (CST) From: "xianglai" To: devel@edk2.groups.io Cc: maobibo@loongson.cn Subject: [edk2-platforms][PATCH V2 02/16] Platform/Loongson: Support SEC And Add Readme.md Date: Fri, 25 Mar 2022 11:37:50 +0800 Message-Id: <4152c2bc96381969b3c378912f9ad26a8638d56a.1648171285.git.lixianglai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf9AxOswOOT1iTW4PAA--.15759S2 X-Coremail-Antispam: 1UD129KBjvAXoWftr45WFWrtryrJFW8GrWktFb_yoW5KrW5Go WxWFWIkw48Gr1rXw1UGFnrJrW8AF1Fqa15tr1Fq34DGF4jyFn8ta98J3s7Gw15Awn8J3Z8 G34rGaykJrW7t3Wkn29KB7ZKAUJUUUUf529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UjIYCTnIWjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRUUUUUUUUU= X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ Content-Transfer-Encoding: quoted-printable Add SEC Code And Readme.md for LoongArchQemu Signed-off-by: xianglai li Signed-off-by: xianglai li --- .../Include/LoongArchAsmMacro.h | 23 + .../Loongson/LoongArchQemuPkg/Loongson.dec | 38 ++ .../Loongson/LoongArchQemuPkg/Loongson.dsc | 133 +++++ .../Loongson/LoongArchQemuPkg/Loongson.fdf | 53 ++ .../LoongArchQemuPkg/Loongson.fdf.inc | 21 + Platform/Loongson/LoongArchQemuPkg/Readme.md | 59 ++ .../LoongArchQemuPkg/Sec/LoongArch64/Start.S | 76 +++ .../Loongson/LoongArchQemuPkg/Sec/SecMain.c | 510 ++++++++++++++++++ .../Loongson/LoongArchQemuPkg/Sec/SecMain.inf | 49 ++ Readme.md | 9 + 10 files changed, 971 insertions(+) create mode 100644 Platform/Loongson/LoongArchQemuPkg/Include/LoongArchAsm= Macro.h 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/Readme.md create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Star= t.S create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.c create mode 100644 Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf diff --git a/Platform/Loongson/LoongArchQemuPkg/Include/LoongArchAsmMacro.h= b/Platform/Loongson/LoongArchQemuPkg/Include/LoongArchAsmMacro.h new file mode 100644 index 0000000000..366d4308e8 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Include/LoongArchAsmMacro.h @@ -0,0 +1,23 @@ +/** @file=0D + LoongArch ASM macro definition.=0D +=0D + Copyright (c) 2021, Loongson Limited. All rights reserved.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D + **/=0D +=0D +#ifndef LOONGARCH_ASM_MACRO_H_=0D +#define LOONGARCH_ASM_MACRO_H_=0D +=0D +#include =0D +=0D +#define _ASM_FUNC(Name, Section) \=0D + .global Name ; \=0D + .section #Section, "ax" ; \=0D + .type Name, %function ; \=0D + Name:=0D +=0D +#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)= =0D +=0D +#endif // __LOONGARCH_ASM_MACRO_H__=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dec b/Platform/Loo= ngson/LoongArchQemuPkg/Loongson.dec new file mode 100644 index 0000000000..248b668fd1 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dec @@ -0,0 +1,38 @@ +## @file=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights = reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + DEC_SPECIFICATION =3D 0x00010005=0D + PACKAGE_NAME =3D LoongArchQemuPkg=0D + PACKAGE_GUID =3D b51d765a-41da-45fc-a537-de3ee785c0f6= =0D + PACKAGE_VERSION =3D 0.1=0D +=0D +##########################################################################= ######=0D +#=0D +# Include Section - list of Include Paths that are provided by this packag= e.=0D +# Comments are used for Keywords and Module Types.=0D +#=0D +# Supported Module Types:=0D +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_D= RIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION=0D +#=0D +##########################################################################= ######=0D +[Includes.common]=0D + Include # Root include for the package=0D +=0D +[Guids]=0D + gLoongArchQemuPkgTokenSpaceGuid =3D { 0x0e0383ce, 0x0151, 0x4d01, { 0x8= 0, 0x0e, 0x3f, 0xef, 0x8b, 0x27, 0x6d, 0x52 } }=0D +=0D +[PcdsFixedAtBuild, PcdsDynamic]=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashPeiFvBase|0x0|UINT64|0x00000003= =0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashPeiFvSize|0x0|UINT32|0x00000004= =0D + gLoongArchQemuPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize|0|UINT3= 2|0x00000016=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0|UI= NT32|0x00000017=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamBase|0|UINT64|0x0000001c= =0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamSize|0|UINT32|0x0000001d= =0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashSecFvBase|0x0|UINT64|0x00000028= =0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashSecFvSize|0x0|UINT32|0x00000029= =0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc b/Platform/Loo= ngson/LoongArchQemuPkg/Loongson.dsc new file mode 100644 index 0000000000..f23fed77e6 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc @@ -0,0 +1,133 @@ +## @file=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights = reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +##########################################################################= ######=0D +#=0D +# Defines Section - statements that will be processed to create a Makefile= .=0D +#=0D +##########################################################################= #####=0D +[Defines]=0D + PLATFORM_NAME =3D LoongArchQemu=0D + PLATFORMPKG_NAME =3D LoongArchQemu=0D + PLATFORM_GUID =3D 7926ea52-b0dc-4ee8-ac63-341eebd84ed4= =0D + PLATFORM_VERSION =3D 0.1=0D + DSC_SPECIFICATION =3D 0x00010005=0D + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME)=0D + SUPPORTED_ARCHITECTURES =3D LOONGARCH64=0D + BUILD_TARGETS =3D DEBUG|RELEASE=0D + SKUID_IDENTIFIER =3D DEFAULT=0D + FLASH_DEFINITION =3D Platform/Loongson/LoongArchQemuPkg/Lo= ongson.fdf=0D + TTY_TERMINAL =3D FALSE=0D +=0D +##########################################################################= ##=0D +#=0D +# Defines for default states. These can be changed on the command line.=0D +# -D FLAG=3DVALUE=0D +##########################################################################= ##=0D +[BuildOptions]=0D + GCC:RELEASE_*_*_CC_FLAGS =3D -DSPEEDUP=0D +=0D + #=0D + # Disable deprecated APIs.=0D + #=0D + GCC:*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES=0D +=0D +=0D +[BuildOptions.LOONGARCH64.EDKII.SEC]=0D + *_*_*_CC_FLAGS =3D=0D +=0D +#[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,= BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLIC= ATION]=0D +# GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000=0D +=0D +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]=0D + GCC:*_*_LOONGARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x10000=0D +=0D +##########################################################################= ######=0D +#=0D +# Library Class section - list of all Library Classes needed by this Platf= orm.=0D +#=0D +##########################################################################= ######=0D +=0D +!include MdePkg/MdeLibs.dsc.inc=0D +=0D +[LibraryClasses.common]=0D + PcdLib | MdePkg/Library/BasePcdLibNull/BasePcd= LibNull.inf=0D + PrintLib | MdePkg/Library/BasePrintLib/BasePrint= Lib.inf=0D + BaseMemoryLib | MdePkg/Library/BaseMemoryLib/BaseMemo= ryLib.inf=0D +=0D +=0D + BaseLib | MdePkg/Library/BaseLib/BaseLib.inf=0D + PeCoffLib | MdePkg/Library/BasePeCoffLib/BasePeCo= ffLib.inf=0D + PeCoffGetEntryPointLib | MdePkg/Library/BasePeCoffGetEntryPoin= tLib/BasePeCoffGetEntryPointLib.inf=0D + IoLib | MdePkg/Library/BaseIoLibIntrinsic/Bas= eIoLibIntrinsic.inf=0D + SerialPortLib | Platform/Loongson/LoongArchQemuPkg/Li= brary/SerialPortLib/SerialPortLib.inf=0D + DebugPrintErrorLevelLib | MdePkg/Library/BaseDebugPrintErrorLev= elLib/BaseDebugPrintErrorLevelLib.inf=0D + PeCoffExtraActionLib | MdePkg/Library/BasePeCoffExtraActionL= ibNull/BasePeCoffExtraActionLibNull.inf=0D + DebugAgentLib | MdeModulePkg/Library/DebugAgentLibNul= l/DebugAgentLibNull.inf=0D +=0D + DebugLib | MdePkg/Library/BaseDebugLibSerialPort= /BaseDebugLibSerialPort.inf=0D +=0D +=0D +=0D +=0D +##########################################################################= ######=0D +#=0D +# Pcd Section - list of all EDK II PCD Entries defined by this Platform.=0D +#=0D +##########################################################################= ######=0D +[PcdsFixedAtBuild]=0D +## BaseLib ##=0D + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength | 1= 000000=0D + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength | 1= 000000=0D + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength | 1= 000000=0D +=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel | 0= x8000004F=0D + # DEBUG_INIT 0x00000001 // Initialization=0D + # DEBUG_WARN 0x00000002 // Warnings=0D + # DEBUG_LOAD 0x00000004 // Load events=0D + # DEBUG_FS 0x00000008 // EFI File system=0D + # DEBUG_POOL 0x00000010 // Alloc & Free (pool)=0D + # DEBUG_PAGE 0x00000020 // Alloc & Free (page)=0D + # DEBUG_INFO 0x00000040 // Informational debug messages=0D + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers=0D + # DEBUG_VARIABLE 0x00000100 // Variable=0D + # DEBUG_BM 0x00000400 // Boot Manager=0D + # DEBUG_BLKIO 0x00001000 // BlkIo Driver=0D + # DEBUG_NET 0x00004000 // Network Io Driver=0D + # DEBUG_UNDI 0x00010000 // UNDI Driver=0D + # DEBUG_LOADFILE 0x00020000 // LoadFile=0D + # DEBUG_EVENT 0x00080000 // Event messages=0D + # DEBUG_GCD 0x00100000 // Global Coherency Database changes=0D + # DEBUG_CACHE 0x00200000 // Memory range cachability changes=0D + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may=0D + # DEBUG_ERROR 0x80000000 // Error=0D +=0D +!if $(TARGET) =3D=3D RELEASE=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask | 0= x21=0D +!else=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask | 0= x2f=0D +!endif=0D + # DEBUG_ASSERT_ENABLED 0x01=0D + # DEBUG_PRINT_ENABLED 0x02=0D + # DEBUG_CODE_ENABLED 0x04=0D + # CLEAR_MEMORY_ENABLED 0x08=0D + # ASSERT_BREAKPOINT_ENABLED 0x10=0D + # ASSERT_DEADLOOP_ENABLED 0x20=0D +=0D + gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress | 0= x90000000=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize | 0= x10000=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamBase | 0= x90010000=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamSize | 0= x10000=0D +=0D +=0D +[Components]=0D +=0D + #=0D + # SEC Phase modules=0D + #=0D + Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf b/Platform/Loo= ngson/LoongArchQemuPkg/Loongson.fdf new file mode 100644 index 0000000000..128b3843db --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf @@ -0,0 +1,53 @@ +## @file=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights = reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +##########################################################################= ###########################=0D +[Defines]=0D +!include Loongson.fdf.inc=0D +=0D +##########################################################################= ###########################=0D +[FD.QEMU_EFI]=0D +BaseAddress =3D $(FD_BASE_ADDRESS)=0D +Size =3D $(FD_SIZE)=0D +ErasePolarity =3D 1=0D +BlockSize =3D $(BLOCK_SIZE)=0D +NumBlocks =3D $(FD_BLOCKS)=0D +=0D +$(SECFV_OFFSET)|$(SECFV_SIZE)=0D +gLoongArchQemuPkgTokenSpaceGuid.PcdFlashSecFvBase|gLoongArchQemuPkgTokenSp= aceGuid.PcdFlashSecFvSize=0D +FV =3D SECFV=0D +=0D +##########################################################################= ###########################=0D +[FV.SECFV]=0D +FvNameGuid =3D 587d4265-5e71-41da-9c35-4258551f1e22=0D +BlockSize =3D $(BLOCK_SIZE)=0D +FvAlignment =3D 16=0D +ERASE_POLARITY =3D 1=0D +MEMORY_MAPPED =3D TRUE=0D +STICKY_WRITE =3D TRUE=0D +LOCK_CAP =3D TRUE=0D +LOCK_STATUS =3D TRUE=0D +WRITE_DISABLED_CAP =3D TRUE=0D +WRITE_ENABLED_CAP =3D TRUE=0D +WRITE_STATUS =3D TRUE=0D +WRITE_LOCK_CAP =3D TRUE=0D +WRITE_LOCK_STATUS =3D TRUE=0D +READ_DISABLED_CAP =3D TRUE=0D +READ_ENABLED_CAP =3D TRUE=0D +READ_STATUS =3D TRUE=0D +READ_LOCK_CAP =3D TRUE=0D +READ_LOCK_STATUS =3D TRUE=0D +=0D +INF Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf=0D +=0D +##########################################################################= ###########################=0D +[Rule.Common.SEC]=0D + FILE SEC =3D $(NAMED_GUID) {=0D + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING =3D"$(MODULE_NAME)" Optional=0D + }=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf.inc b/Platform= /Loongson/LoongArchQemuPkg/Loongson.fdf.inc new file mode 100644 index 0000000000..a1a2d537e3 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf.inc @@ -0,0 +1,21 @@ +## @file=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights = reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +DEFINE BLOCK_SIZE =3D 0x1000=0D +=0D +##########################################################################= ##=0D +# fd total=0D +DEFINE FD_BASE_ADDRESS =3D 0x1c000000=0D +DEFINE FD_BLOCKS =3D 0x400=0D +DEFINE FD_SIZE =3D 0x400000=0D +=0D +##########################################################################= ##=0D +#flash code layout=0D +#Set Sec base address and size in flash=0D +DEFINE SECFV_OFFSET =3D 0x00000000=0D +DEFINE SECFV_SIZE =3D 0x00010000=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Readme.md b/Platform/Loongs= on/LoongArchQemuPkg/Readme.md new file mode 100644 index 0000000000..1f10a1758d --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Readme.md @@ -0,0 +1,59 @@ +# Introduction=0D +=0D + This document provides the guideline to build UEFI firmware for Qemu of = LoongArch.=0D +=0D + LoongArch is the general processor architecture of Loongson.=0D +=0D + We can get the latest LoongArch documents or LoongArch tools at https://= github.com/loongson/.=0D +=0D +# How to build (X86 Linux Environment)=0D +=0D + 1. Install LoongArch cross-tools on X86 machines.=0D + Download cross-tools from https://github.com/loongson/ ,Then config cr= oss-tools env.=0D + For Example:=0D + =0D + $ wget https://github.com/loongson/build-tools/releases/latest/downloa= d/loongarch64-clfs-20211202-cross-tools.tar.xz=0D + $ tar -vxf loongarch64-clfs-20211202-cross-tools.tar.xz -C /opt=0D + $ export PATH=3D/opt/cross-tools/bin:$PATH=0D + =0D + 2. Follow edk2-platforms/Readme.md to obtaining source code,And config b= uild env.=0D + For Example:=0D + =0D + $ export WORKSPACE=3D/work/git/tianocore=0D + $ mkdir -p $WORKSPACE=0D + $ cd $WORKSPACE=0D + $ git clone https://github.com/tianocore/edk2.git=0D + $ git submodule update --init=0D + $ git clone https://github.com/tianocore/edk2-platforms.git=0D + $ git submodule update --init=0D + $ git clone https://github.com/tianocore/edk2-non-osi.git=0D + $ export PACKAGES_PATH=3D$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-o= si=0D + =0D + 3. Config cross compiler prefix.=0D + For Example:=0D + =0D + $ export GCC5_LOONGARCH64_PREFIX=3Dloongarch64-unknown-linux-gnu-=0D + =0D + 4.Set up the build environment And build BaseTool.=0D + For Example:=0D + =0D + $. edk2/edksetup.sh=0D + $make -C edk2/BaseTools=0D + =0D + 5.Build platform.=0D + For Exmaple:=0D + =0D + $build --buildtarget=3DDEBUG --tagname=3DGCC5 --arch=3DLOONGARCH64 --= platform=3DPlatform/Loongson/LoongArchQemuPkg/Loongson.dsc=0D + =0D + After a successful build, the resulting images can be found in `Build/{P= latform Name}/{TARGET}_{TOOL_CHAIN_TAG}/FV/QEMU_EFI.fd`.=0D + =0D + A compile script is provided here:=0D + =0D + #!/bin/bash=0D + export WORKSPACE=3D/work/git/tianocore=0D + export PACKAGES_PATH=3D$WORKSPACE/edk2:$WORKSPACE/edk2-platforms=0D + export GCC5_LOONGARCH64_PREFIX=3Dloongarch64-unknown-linux-gnu-=0D + . edk2/edksetup.sh=0D + make -C edk2/BaseTools=0D + build --buildtarget=3DDEBUG --tagname=3DGCC5 --arch=3DLOONGARCH64 --p= latform=3DPlatform/Loongson/LoongArchQemuPkg/Loongson.dsc =0D + =0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Start.S b/P= latform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Start.S new file mode 100644 index 0000000000..48c044fe28 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Sec/LoongArch64/Start.S @@ -0,0 +1,76 @@ +#-------------------------------------------------------------------------= -----=0D +#=0D +# Start for LoongArch=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights r= eserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +# @par Glossary:=0D +# - CSR - CPU Status Register=0D +# - EBASE - Exception Base Address=0D +#-------------------------------------------------------------------------= -----=0D +#ifndef __ASSEMBLY__=0D +#define __ASSEMBLY__=0D +#endif=0D +=0D +#include =0D +#include "LoongArchAsmMacro.h"=0D +=0D + .text=0D + .globl _ModuleEntryPoint=0D +_ModuleEntryPoint:=0D +=0D + /* configure reset ebase */=0D + li.d T0, 0x1c000000=0D + csrwr T0, LOONGARCH_CSR_EBASE=0D +=0D + /*disable interrupt*/=0D + li.d T0, (1 << 2)=0D + csrxchg ZERO, T0, LOONGARCH_CSR_CRMD=0D +=0D + /* read physical cpu number id */=0D + csrrd T0, LOONGARCH_CSR_CPUNUM=0D + andi T0, T0, 0x3ff=0D + li.d A0, BOOTCORE_ID //0=0D + bne T0, A0, slave_main=0D +=0D +call_centry:=0D + /*call C function make sure parameter true*/=0D + li.d A1, FixedPcdGet64(PcdSecPeiTempRamBase) + FixedPcdGet32(PcdSec= PeiTempRamSize) # stack base=0D + li.d A0, FixedPcdGet64(PcdFlashPeiFvBase) # PEI Fv base=0D + move SP, A1=0D + addi.d SP, SP, -0x8=0D + bl SecCoreStartupWithStack=0D +=0D +slave_main:=0D + # clear mailbox=0D + li.d T1, LOONGSON_CSR_MAIL_BUF0=0D + iocsrwr.d ZERO, T1=0D +=0D + # enable IPI interrupt=0D + li.d T0, (1 << 12)=0D + csrxchg T0, T0, LOONGARCH_CSR_ECFG=0D +=0D +1:=0D + # wait for wakeup=0D + idle 0=0D + nop=0D + iocsrrd.w T0, T1=0D + beqz T0, 1b=0D +=0D + # read and clear ipi interrupt=0D + li.d T1, LOONGSON_IOCSR_IPI_STATUS=0D + iocsrrd.w T0, T1=0D + li.d T1, LOONGSON_IOCSR_IPI_CLEAR=0D + iocsrwr.w T0, T1=0D +=0D + # disable IPI interrupt=0D + li.d T0, (1 << 12)=0D + csrxchg ZERO, T0, LOONGARCH_CSR_ECFG=0D +=0D + # read mail buf and jump to specified entry=0D + li.d T1, LOONGSON_CSR_MAIL_BUF0=0D + iocsrrd.d T0, T1=0D + or RA, T0, ZERO=0D + jirl ZERO, RA, 0x0=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.c b/Platform/Lo= ongson/LoongArchQemuPkg/Sec/SecMain.c new file mode 100644 index 0000000000..73d3a2c1a3 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.c @@ -0,0 +1,510 @@ +/** @file=0D + Main SEC phase code. Transitions to PEI.=0D +=0D + Copyright (c) 2021 Loongson Technology Corporation Limited. All rights r= eserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +/**=0D + temporary memory to permanent memory and do stack switching.=0D +=0D + @param[in] PeiServices Pointer to the PEI Services Table.=0D + @param[in] TemporaryMemoryBase Temporary Memory Base address.=0D + @param[in] PermanentMemoryBase Permanent Memory Base address.=0D + @param[in] CopySize The size of memory that needs to be migrated.=0D +=0D + @retval EFI_SUCCESS Migration successful.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TemporaryRamMigration (=0D + IN CONST EFI_PEI_SERVICES **PeiServices,=0D + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,=0D + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,=0D + IN UINTN CopySize=0D + );=0D +=0D +EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi =3D {=0D + TemporaryRamMigration=0D +};=0D +=0D +EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTable[] =3D {=0D + {=0D + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),= =0D + &gEfiTemporaryRamSupportPpiGuid,=0D + &mTemporaryRamSupportPpi=0D + },=0D +};=0D +=0D +/**=0D + Locates a section within a series of sections=0D + with the specified section type.=0D +=0D + The Instance parameter indicates which instance of the section=0D + type to return. (0 is first instance, 1 is second...)=0D +=0D + @param[in] Sections The sections to search=0D + @param[in] SizeOfSections Total size of all sections=0D + @param[in] SectionType The section type to locate=0D + @param[in] Instance The section instance number=0D + @param[out] FoundSection The FFS section if found=0D +=0D + @retval EFI_SUCCESS The file and section was found=0D + @retval EFI_NOT_FOUND The file and section was not found=0D + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted=0D +=0D +**/=0D +EFI_STATUS=0D +FindFfsSectionInstance (=0D + IN VOID *Sections,=0D + IN UINTN SizeOfSections,=0D + IN EFI_SECTION_TYPE SectionType,=0D + IN UINTN Instance,=0D + OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D + )=0D +{=0D + EFI_PHYSICAL_ADDRESS CurrentAddress;=0D + UINT32 Size;=0D + EFI_PHYSICAL_ADDRESS EndOfSections;=0D + EFI_COMMON_SECTION_HEADER *Section;=0D + EFI_PHYSICAL_ADDRESS EndOfSection;=0D +=0D + //=0D + // Loop through the FFS file sections within the PEI Core FFS file=0D + //=0D + EndOfSection =3D (EFI_PHYSICAL_ADDRESS) (UINTN) Sections;=0D + EndOfSections =3D EndOfSection + SizeOfSections;=0D + for (;;) {=0D + if (EndOfSection =3D=3D EndOfSections) {=0D + break;=0D + }=0D + CurrentAddress =3D (EndOfSection + 3) & ~(3ULL);=0D + if (CurrentAddress >=3D EndOfSections) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + Section =3D (EFI_COMMON_SECTION_HEADER*) (UINTN) CurrentAddress;=0D +=0D + Size =3D SECTION_SIZE (Section);=0D + if (Size < sizeof (*Section)) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + EndOfSection =3D CurrentAddress + Size;=0D + if (EndOfSection > EndOfSections) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + //=0D + // Look for the requested section type=0D + //=0D + if (Section->Type =3D=3D SectionType) {=0D + if (Instance =3D=3D 0) {=0D + *FoundSection =3D Section;=0D + return EFI_SUCCESS;=0D + } else {=0D + Instance--;=0D + }=0D + }=0D + }=0D +=0D + return EFI_NOT_FOUND;=0D +}=0D +=0D +/**=0D + Locates a section within a series of sections=0D + with the specified section type.=0D +=0D + @param[in] Sections The sections to search=0D + @param[in] SizeOfSections Total size of all sections=0D + @param[in] SectionType The section type to locate=0D + @param[out] FoundSection The FFS section if found=0D +=0D + @retval EFI_SUCCESS The file and section was found=0D + @retval EFI_NOT_FOUND The file and section was not found=0D + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted=0D +=0D +**/=0D +EFI_STATUS=0D +FindFfsSectionInSections (=0D + IN VOID *Sections,=0D + IN UINTN SizeOfSections,=0D + IN EFI_SECTION_TYPE SectionType,=0D + OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D + )=0D +{=0D + return FindFfsSectionInstance (=0D + Sections,=0D + SizeOfSections,=0D + SectionType,=0D + 0,=0D + FoundSection=0D + );=0D +}=0D +=0D +/**=0D + Locates a FFS file with the specified file type and a section=0D + within that file with the specified section type.=0D +=0D + @param[in] Fv The firmware volume to search=0D + @param[in] FileType The file type to locate=0D + @param[in] SectionType The section type to locate=0D + @param[out] FoundSection The FFS section if found=0D +=0D + @retval EFI_SUCCESS The file and section was found=0D + @retval EFI_NOT_FOUND The file and section was not found=0D + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted=0D +=0D +**/=0D +EFI_STATUS=0D +FindFfsFileAndSection (=0D + IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D + IN EFI_FV_FILETYPE FileType,=0D + IN EFI_SECTION_TYPE SectionType,=0D + OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PHYSICAL_ADDRESS CurrentAddress;=0D + EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume;=0D + EFI_FFS_FILE_HEADER *File;=0D + UINT32 Size;=0D + EFI_PHYSICAL_ADDRESS EndOfFile;=0D +=0D + if (Fv->Signature !=3D EFI_FVH_SIGNATURE) {=0D + DEBUG ((DEBUG_ERROR, "FV at %p does not have FV header signature\n", F= v));=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + CurrentAddress =3D (EFI_PHYSICAL_ADDRESS) (UINTN) Fv;=0D + EndOfFirmwareVolume =3D CurrentAddress + Fv->FvLength;=0D +=0D + //=0D + // Loop through the FFS files in the Boot Firmware Volume=0D + //=0D + for (EndOfFile =3D CurrentAddress + Fv->HeaderLength; ; ) {=0D +=0D + CurrentAddress =3D (EndOfFile + 7) & ~(7ULL);=0D + if (CurrentAddress > EndOfFirmwareVolume) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + File =3D (EFI_FFS_FILE_HEADER*) (UINTN) CurrentAddress;=0D + Size =3D *(UINT32*) File->Size & 0xffffff;=0D + if (Size < (sizeof (*File) + sizeof (EFI_COMMON_SECTION_HEADER))) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + EndOfFile =3D CurrentAddress + Size;=0D + if (EndOfFile > EndOfFirmwareVolume) {=0D + return EFI_VOLUME_CORRUPTED;=0D + }=0D +=0D + //=0D + // Look for the request file type=0D + //=0D + if (File->Type !=3D FileType) {=0D + continue;=0D + }=0D +=0D + Status =3D FindFfsSectionInSections (=0D + (VOID*) (File + 1),=0D + (UINTN) EndOfFile - (UINTN) (File + 1),=0D + SectionType,=0D + FoundSection=0D + );=0D + if (!EFI_ERROR (Status)=0D + || (Status =3D=3D EFI_VOLUME_CORRUPTED))=0D + {=0D + return Status;=0D + }=0D + }=0D +}=0D +=0D +/**=0D + Locates the PEI Core entry point address=0D +=0D + @param[in] Fv The firmware volume to search=0D + @param[out] PeiCoreEntryPoint The entry point of the PEI Core image=0D +=0D + @retval EFI_SUCCESS The file and section was found=0D + @retval EFI_NOT_FOUND The file and section was not found=0D + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted=0D +=0D +**/=0D +EFI_STATUS=0D +FindPeiCoreImageBaseInFv (=0D + IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D + OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_COMMON_SECTION_HEADER *Section;=0D +=0D + Status =3D FindFfsFileAndSection (=0D + Fv,=0D + EFI_FV_FILETYPE_PEI_CORE,=0D + EFI_SECTION_PE32,=0D + &Section=0D + );=0D + if (EFI_ERROR (Status)) {=0D + Status =3D FindFfsFileAndSection (=0D + Fv,=0D + EFI_FV_FILETYPE_PEI_CORE,=0D + EFI_SECTION_TE,=0D + &Section=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "Unable to find PEI Core image\n"));=0D + return Status;=0D + }=0D + }=0D +=0D + *PeiCoreImageBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)(Section + 1);=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Find and return Pei Core entry point.=0D +=0D + It also find SEC and PEI Core file debug information. It will report the= m if=0D + remote debug is enabled.=0D +=0D +**/=0D +VOID=0D +FindAndReportEntryPoints (=0D + IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr,=0D + OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PHYSICAL_ADDRESS PeiCoreImageBase =3D 0;=0D + PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;=0D +=0D + Status =3D FindPeiCoreImageBaseInFv (*BootFirmwareVolumePtr, &PeiCoreIma= geBase);=0D + ASSERT (Status =3D=3D EFI_SUCCESS);=0D +=0D + ZeroMem ((VOID *) &ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT));= =0D +=0D + //=0D + // Report PEI Core debug information when remote debug is enabled=0D + //=0D + ImageContext.ImageAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN)PeiCoreImageB= ase;=0D + ImageContext.PdbPointer =3D PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) I= mageContext.ImageAddress);=0D + PeCoffLoaderRelocateImageExtraAction (&ImageContext);=0D +=0D + //=0D + // Find PEI Core entry point=0D + //=0D + Status =3D PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase,= (VOID**) PeiCoreEntryPoint);=0D + if (EFI_ERROR (Status)) {=0D + *PeiCoreEntryPoint =3D 0;=0D + }=0D +=0D + return;=0D +}=0D +=0D +/**=0D + Find the peicore entry point and jump to the entry point to execute.=0D +=0D + @param[in] Context The first input parameter of InitializeDebugAgent(= ).=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +SecStartupPhase2 (=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_SEC_PEI_HAND_OFF *SecCoreData;=0D + EFI_FIRMWARE_VOLUME_HEADER *BootFv;=0D + EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;=0D +=0D + SecCoreData =3D (EFI_SEC_PEI_HAND_OFF *) Context;=0D +=0D + //=0D + // Find PEI Core entry point. It will report SEC and Pei Core debug info= rmation if remote debug=0D + // is enabled.=0D + //=0D + BootFv =3D (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolume= Base;=0D + FindAndReportEntryPoints (&BootFv, &PeiCoreEntryPoint);=0D + SecCoreData->BootFirmwareVolumeBase =3D BootFv;=0D + SecCoreData->BootFirmwareVolumeSize =3D (UINTN) BootFv->FvLength;=0D +=0D + DEBUG ((DEBUG_INFO, "Find Pei EntryPoint=3D%p\n", PeiCoreEntryPoint));=0D +=0D + //=0D + // Transfer the control to the PEI core=0D + //=0D + DEBUG ((DEBUG_INFO, "SecStartupPhase2 %p\n", PeiCoreEntryPoint));=0D +=0D + (*PeiCoreEntryPoint) (SecCoreData, (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDi= spatchTable);=0D +=0D + //=0D + // If we get here then the PEI Core returned, which is not recoverable.= =0D + //=0D + ASSERT (FALSE);=0D + CpuDeadLoop ();=0D +}=0D +/**=0D + Entry point to the C language phase of SEC. initialize some temporary me= mory and set up the stack,=0D + the control is transferred to this function.=0D +=0D + @param[in] BootFv The pointer to the PEI FV in memory.=0D + @param[in] TopOfCurrentStack Top of Current Stack.=0D +**/=0D +VOID=0D +EFIAPI=0D +SecCoreStartupWithStack (=0D + IN EFI_FIRMWARE_VOLUME_HEADER *BootFv,=0D + IN VOID *TopOfCurrentStack=0D + )=0D +{=0D + EFI_SEC_PEI_HAND_OFF SecCoreData;=0D + EFI_FIRMWARE_VOLUME_HEADER *BootPeiFv =3D (EFI_FIRMWARE_VOLUME_HEA= DER*) BootFv;=0D +=0D + DEBUG ((DEBUG_INFO, "Entering C environment\n"));=0D +=0D + ProcessLibraryConstructorList (NULL, NULL);=0D +=0D + DEBUG ((DEBUG_INFO,=0D + "SecCoreStartupWithStack (0x%lx, 0x%lx)\n",=0D + (UINTN)BootFv,=0D + (UINTN)TopOfCurrentStack=0D + ));=0D + DEBUG ((DEBUG_INFO,=0D + "(0x%lx, 0x%lx)\n",=0D + (UINTN) (PcdGet64 (PcdSecPeiTempRamBase)),=0D + (UINTN) (PcdGet32 (PcdSecPeiTempRamSize))=0D + ));=0D +=0D + // |-------------| <-- TopOfCurrentStack=0D + // | Stack | 32k=0D + // |-------------|=0D + // | Heap | 32k=0D + // |-------------| <-- SecCoreData.TemporaryRamBase=0D + //=0D +=0D + ASSERT ((UINTN) (PcdGet64 (PcdSecPeiTempRamBase) +=0D + PcdGet32 (PcdSecPeiTempRamSize)) =3D=3D=0D + (UINTN) TopOfCurrentStack);=0D +=0D + //=0D + // Initialize SEC hand-off state=0D + //=0D + SecCoreData.DataSize =3D sizeof (EFI_SEC_PEI_HAND_OFF);=0D +=0D + SecCoreData.TemporaryRamSize =3D (UINTN) PcdGet32 (PcdSecPeiTempRa= mSize);=0D + SecCoreData.TemporaryRamBase =3D (VOID *) PcdGet64 (PcdSecPeiTempR= amBase);=0D +=0D + SecCoreData.PeiTemporaryRamBase =3D SecCoreData.TemporaryRamBase;=0D + SecCoreData.PeiTemporaryRamSize =3D SecCoreData.TemporaryRamSize >> 1= ;=0D +=0D + SecCoreData.StackBase =3D (UINT8 *)SecCoreData.TemporaryRam= Base + SecCoreData.PeiTemporaryRamSize;=0D + SecCoreData.StackSize =3D SecCoreData.TemporaryRamSize >> 1= ;=0D +=0D + SecCoreData.BootFirmwareVolumeBase =3D BootPeiFv;=0D + SecCoreData.BootFirmwareVolumeSize =3D (UINTN) BootPeiFv->FvLength;=0D +=0D + DEBUG ((DEBUG_INFO,=0D + "&SecCoreData.BootFirmwareVolumeBase=3D%lx SecCoreData.BootFirmwareVol= umeBase=3D%lx\n",=0D + (UINT64)&(SecCoreData.BootFirmwareVolumeBase),=0D + (UINT64) (SecCoreData.BootFirmwareVolumeBase)));=0D + DEBUG ((DEBUG_INFO,=0D + "&SecCoreData.BootFirmwareVolumeSize=3D%lx SecCoreData.BootFirmwareVol= umeSize=3D%lx\n",=0D + (UINT64)&(SecCoreData.BootFirmwareVolumeSize),=0D + (UINT64) (SecCoreData.BootFirmwareVolumeSize)));=0D +=0D + //=0D + // Initialize Debug Agent to support source level debug in SEC/PEI phase= s before memory ready.=0D + //=0D + InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL);=0D + SecStartupPhase2 (&SecCoreData);=0D +}=0D +=0D +/**=0D + temporary memory to permanent memory and do stack switching.=0D +=0D + @param[in] PeiServices Pointer to the PEI Services Table.=0D + @param[in] TemporaryMemoryBase Temporary Memory Base address.=0D + @param[in] PermanentMemoryBase Permanent Memory Base address.=0D + @param[in] CopySize The size of memory that needs to be migrated.=0D +=0D + @retval EFI_SUCCESS Migration successful.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TemporaryRamMigration (=0D + IN CONST EFI_PEI_SERVICES **PeiServices,=0D + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,=0D + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,=0D + IN UINTN CopySize=0D + )=0D +{=0D + VOID *OldHeap;=0D + VOID *NewHeap;=0D + VOID *OldStack;=0D + VOID *NewStack;=0D + BASE_LIBRARY_JUMP_BUFFER JumpBuffer;=0D +=0D + DEBUG ((DEBUG_INFO,=0D + "TemporaryRamMigration (0x%Lx, 0x%Lx, 0x%Lx)\n",=0D + TemporaryMemoryBase,=0D + PermanentMemoryBase,=0D + (UINT64)CopySize=0D + ));=0D +=0D + OldHeap =3D (VOID*) (UINTN)TemporaryMemoryBase;=0D + NewHeap =3D (VOID*) ((UINTN)PermanentMemoryBase + (CopySize >> 1));=0D +=0D + OldStack =3D (VOID*) ((UINTN)TemporaryMemoryBase + (CopySize >> 1));=0D + NewStack =3D (VOID*) (UINTN)PermanentMemoryBase;=0D +=0D +#if 0=0D + DebugAgentContext.HeapMigrateOffset =3D (UINTN)NewHeap - (UINTN)OldHeap;= =0D + DebugAgentContext.StackMigrateOffset =3D (UINTN)NewStack - (UINTN)OldSta= ck;=0D +=0D + OldStatus =3D SaveAndSetDebugTimerInterrupt (FALSE);=0D + InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, (VOID *) &DebugAgent= Context, NULL);=0D +#endif=0D +=0D + //=0D + // Migrate Heap=0D + //=0D + CopyMem (NewHeap, OldHeap, CopySize >> 1);=0D +=0D + //=0D + // Migrate Stack=0D + //=0D + CopyMem (NewStack, OldStack, CopySize >> 1);=0D +=0D + // Use SetJump ()/LongJump () to switch to a new stack.=0D + //=0D + if (SetJump (&JumpBuffer) =3D=3D 0) {=0D + JumpBuffer.SP =3D JumpBuffer.SP - (UINTN)OldStack + (UINTN)NewStack ;= =0D + LongJump (&JumpBuffer, (UINTN)-1);=0D + }=0D +=0D + //SaveAndSetDebugTimerInterrupt (OldStatus);=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf b/Platform/= Loongson/LoongArchQemuPkg/Sec/SecMain.inf new file mode 100644 index 0000000000..03d4ea5b00 --- /dev/null +++ b/Platform/Loongson/LoongArchQemuPkg/Sec/SecMain.inf @@ -0,0 +1,49 @@ +## @file=0D +# SEC Driver=0D +#=0D +# Copyright (c) 2021 Loongson Technology Corporation Limited. All rights = reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D SecMain=0D + FILE_GUID =3D 57d02d4f-5a5d-4bfa-b7d6-ba0a4d2c72ce= =0D + MODULE_TYPE =3D SEC=0D + VERSION_STRING =3D 1.0=0D +=0D +[Sources.LOONGARCH64]=0D + LoongArch64/Start.S=0D + SecMain.c=0D +=0D +[Packages]=0D + Platform/Loongson/LoongArchQemuPkg/Loongson.dec=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + DebugLib=0D + BaseMemoryLib=0D + PcdLib=0D + DebugAgentLib=0D + IoLib=0D + PeCoffLib=0D + PeCoffGetEntryPointLib=0D + PeCoffExtraActionLib=0D +=0D +[Ppis]=0D + gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED=0D +=0D +[FixedPcd]=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamBase=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdSecPeiTempRamSize=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize=0D +=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashSecFvBase=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashSecFvSize=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashPeiFvBase=0D + gLoongArchQemuPkgTokenSpaceGuid.PcdFlashPeiFvSize=0D diff --git a/Readme.md b/Readme.md index 62876b4b7d..825bd37edd 100644 --- a/Readme.md +++ b/Readme.md @@ -57,6 +57,7 @@ IA32 | i?86-linux-gnu-* _or_ x86_64-linux-= gnu- IPF | ia64-linux-gnu=0D X64 | x86_64-linux-gnu-=0D RISCV64 | riscv64-unknown-elf-=0D +LOONGARCH64 | loongarch64-linux-gnu-=0D =0D \* i386, i486, i586 or i686=0D =0D @@ -71,6 +72,11 @@ RISC-V open source community provides GCC toolchains for [riscv64-unknown-elf](https://github.com/riscv/riscv-gnu-toolchain)=0D compiled to run on x86 Linux.=0D =0D +### GCC for LoongArch=0D +Loonson open source community provides GCC toolchains for=0D +[loongarch64-unknown-elf](https://github.com/loongson/build-tools)=0D +compiled to run on x86 Linux=0D +=0D ### clang=0D Clang does not require separate cross compilers, but it does need a=0D target-specific binutils. These are included with any prepackaged GCC tool= chain=0D @@ -257,6 +263,9 @@ For more information, see the ##### Minnowboard Max/Turbot based on Intel Valleyview2 SoC=0D * [Minnowboard Max](Platform/Intel/Vlv2TbltDevicePkg)=0D =0D +## Loongson=0D +* [LoongArchQemu](Platform/Loongson/LoongArchQemuPkg)=0D +=0D ## Marvell=0D * [Armada 70x0](Platform/Marvell/Armada70x0Db)=0D * [Armada 80x0](Platform/Marvell/Armada80x0Db)=0D --=20 2.31.1