summaryrefslogtreecommitdiffstats
path: root/StandaloneMmPkg/Library
Commit message (Collapse)AuthorAgeFilesLines
* StandaloneMmPkg: Produce gMmStatusCodeUseSerialHobGuid HOBJiaxin Wu2025-03-271-0/+1
| | | | | | | Produce gMmStatusCodeUseSerialHobGuid as MM Foundation HOB to describe the status code use serial port or not. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* StandaloneMmPkg/Library: Print warning message if GUID HOB not foundJiaxin Wu2025-03-111-0/+4
| | | | | | This patch is to print the warning message if GUID HOB not found Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* StandaloneMmPkg/Core: pass HOB list in MMRAM to library constructorDun Tan2025-02-243-119/+1
| | | | | | | | | | | | | | | | | | | The commit changes the code to initializes new HOB list in MMRAM before the ProcessLibraryConstructorList() and pass the MMRAM HOB list to lib constructor. Previously, the HOB list in non-MMRAM range is passed to the lib constructor. Then code in the library constructor would consume unverified HOB list in non-MMRAM buffer. With this commit, the HOB validation and memory allocation HOB migration are doned before the library constructor. Since the HOB list initialization needs to allocate memory in MMRAM, we also need to call the MmInitializeMemoryServices() before the HOB list initialization. Then the duplicated code in the StandaloneMmCore MemoryAllocationLib can also be removed. Signed-off-by: Dun Tan <dun.tan@intel.com>
* StandaloneMmPkg StandaloneMmCoreMemoryAllocationLib: Rename gMmstStar Zeng2025-02-111-12/+12
| | | | | | | | | | | | | | | | | StandaloneMmCoreMemoryAllocationLib.c and StandaloneMmServicesTableLib.c are both defining gMmst, StandaloneMmCoreMemoryAllocationLib will be linked to StandaloneMmCore directly, StandaloneMmServicesTableLib may be linked to StandaloneMmCore indirectly, when they are both linked to StandaloneMmCore, there will be "lld-link: error: duplicate symbol: gMmst" build error with Clang compiler. gMmst is declared in MmServicesTableLib.h and its definition should be owned by MmServicesTableLib. This patch renames gMmst in StandaloneMmCoreMemoryAllocationLib.c to mMemoryAllocationMmst to avoid this build error. Signed-off-by: Star Zeng <star.zeng@intel.com>
* StandaloneMmPkg: Consume X64 StandaloneMmCoreEntryPoint From MdePkgOliver Smith-Denny2025-02-072-118/+0
| | | | | | | | Now that the X64 StandaloneMmCoreEntryPoint has been moved to MdePkg, it can be removed from StandaloneMmPkg and consumed from MdePpkg. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* StandaloneMmPkg: move core entry point lib and cpu driver to ArmPkgLevi Yun2025-01-175-2087/+0
| | | | | | | | | | | | StandaloneMmCpu driver is only used for Arm architecture and StandaloneMmCoreEntryPointLib for Arm has specific implementation with StandaloneMmCpu driver. Move StandaloneMmCpu Driver and StandaloneMmCoreEntryPointLib for Arm to ArmPkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: introduce StandaloneMmExtractGuidedSectionLibLevi Yun2025-01-172-0/+443
| | | | | | | | | | | | | | The default ExtractGuidedSectionLib used by Standalone MM is the implementation in EmbeddedPkg. However, the ExtractGuidedSectionLib implementation in EmbeddedPkg builds HOBs to save the extract handler information. Since StandaloneMm is consumer of HOB, not a HOB producer, introduce a StandaloneMmExtraGuidedSectionLib implementation that saves the extract handler information in the ConfigurationTable. This StandaloneMmExtraGuidedSectionLib can be used by MM_STANDALONE and MM_CORE_STANDALONE modules. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: remove per-cpu feature on StandaloneMmLevi Yun2025-01-171-118/+4
| | | | | | | | | StandaloneMm in Arm is UP-migratable which means StandaloneMm cannot run concurrently. Therefore, remove per-cpu feature in StandaloneMm. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: Move sanity check for comm buffer to entrypointLevi Yun2025-01-171-0/+107
| | | | | | | | | | | | | | | | | | Arm has three types of communication buffer - Non secure communication buffer: shared buffer with NS partition - Secure communication buffer: shared buffer with Secure partition - Internal Misc service buffer: For misc service i.e. for services that do not use MmCommunication protocol, a buffer is created and populated internally. Since, internal Misc service buffer is allocated dynamically in StandaloneMm there is no additional check required for the Misc service buffer. This patch move sanity check of communication buffer from StandaloneMmCpu Driver to StandaloneMmEntryPoint. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: Apply embedded stack in StandaloneMmEntryPointLevi Yun2025-01-174-1/+461
| | | | | | | | | | | | | | | | | | | | | | | | | There are 2 communication interfaces between the SPMC and StandaloneMM 1. SpmMM 2. FF-A When SpmMM is enabled, TF-A acts as the SPMC at EL3 and the stack is setup by TF-A for use by StandaloneMm. However, when FF-A is enabled, the SPMC does not setup the stack for StandaloneMm and it is expected that the StandaloneMm code will setup its own stack. Therefore, reserve an area in the data region for use as the stack for StandaloneMM. This stack will be used in both the scenarios described above, i.e. when either SpmMM or FF-A is enabled. Although the stack is reserved from the data section which is expected to be Read-Write enabled, when TF-A maps the StandaloneMM binary into the DRAM it configures the entire StandaloneMM memory as Read-Only. Therefore, before the stack can be utilised, the PE Coff sections need to be scanned to change the the stack region from Read-Only to Read-Write. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMm/Library: Apply FF-A v1.2 in StandaloneMmLevi Yun2025-01-172-155/+582
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support the service other than Mmcommunication service, StandaloneMm should use FF-A v1.2 or later [0]. For this, StandaloneMm needs to change: 1. apply FF-A boot protocol - FF-A uses its own boot protocol and it can deliver phit hob. So, StandaloneMm should understand FF-A boot protocol and get phit hob from it to initialize. 2. Use DIRECT_REQ2 / DIRECT_RESP2 - To support the other service via FF-A protocol than MmCommunication, StandaloneMm should use DIRECT_REQ2 / DIRECT_RESP2. In case of service provided with MmCommunication protocol, register x2/x3 value is set as gEfiMmCommunication2ProtocolGuid and register x4 value is set with MmCommunication Buffer (ServiceTypeMmCommunication). In case of service with each speicifiation via FF-A, register x2/x3 value is set as each service guid and StandaloneMmCoreEntryPoint genreates Mm communication header with passed arguments to dispatch this service provided by StandaloneMm. i.e) Tpm service, Firmware update service and etc. (ServiceTypeMisc) Link: https://developer.arm.com/documentation/den0077/latest/ [0] Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* ArmPkg: Remove PcdFfaEnabledLevi Yun2025-01-171-3/+0
| | | | | | | | | | PcdFfaEnabled is no more used because ArmFfaLib could find whether FF-A is supported dynamically. This patch removes usage of PcdFfaEnabled. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMm/Library: Apply transfer list boot protocol in StandaloneMmLevi Yun2025-01-173-399/+501
| | | | | | | | | | | | | | | To remove hob creation in StandaloneMm entrypoint, TF-A should pass PHIT hob information to StandaloneMm. When it passes PHIT hob, it passes according to firmware handoff specification[0]. This patch applies boot protocol using transfer list with firmware handoff specification and remove hob creation in StandaloneMm entrypoint. Link: https://github.com/FirmwareHandoff/firmware_handoff [0] Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* ArmPkg/IndustryStandard: Change naming convention in ArmMmSvc.hlevi.yun2025-01-171-9/+9
| | | | | | | | | | | | Change naming convention in ArmMmSvc.h with MM to SPM_MM This would make it clear to discern ABI protocol used to communicate with secure partition. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMm/Library: Remove Hob creation on Arm CoreHob Librarylevi.yun2025-01-174-434/+3
| | | | | | | | | | | By using transfer list passed by TF-A, StandaloneMmCore is no more producer of HOBs, But it is consumer. So, the Arm-specific implementation of StandaloneMmCoreHobLib is no longer needed. This change removes the Arm-specific HOB creation code and integrates the necessary adjustments. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: Introduce PI_MM_CPU_DRIVER_EP protocol.levi.yun2025-01-173-31/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a PI_MM_CPU_DRIVER_EP protocol to handle Mmcommunication request based on the CPU driver. Previously the CPU driver entry point was retrieved using the gEfiArmTfCpuDriverEntryPoint HOB. However, this practice is incorrect as StandaloneMM must be a HOB consumer and not a HOB producer. Therefore, remove the CPU entry HOB gEfiArmTfCpuDriverEntryPoint, and replace it with the CPU driver entry protocol EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL. The EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL installed in StandaloneMmCpuInitialize() will be used by the code in Arm/StandaloneMmCoreEntryPoint. This protocol is used like below: +=====+ |StandaloneMmCore| +=====+ | CEntryPoint() =================== | ProcessModuleEntryPointList() | +--> StandaloneMmMain() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | // Load StandaloneMmCpu driver which implements | // CpuDriverEntryPoint used by DelegatedEventLoop(). | // and install the gEdkiiPiMmCpuDriverEpProtocolGuid. -------------- | ... // Get CpuDriverEntryPoint implemented by // StandaloneMmCpu driver with gEdkiiPiMmCpuDriverEpProtocolGuid | DelegatedEventLoop() // Handle request by delegating it to // CpuDriverEntryPoint. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg: Simplify returning event complete valueslevi.yun2025-01-171-76/+114
| | | | | | | | | | | | | | | | Communication with Stmm can be via SPM using MM or FF-A. However, some return values differ between these communication models. This patch adds helper functions to covert the return values based on the communication model. It also fixes an issue when using the SPM using MM model, wherein an error code value of -7 was being returned when an unknown error occurred. The -7 value is not defined in SPM using MM. Therefore, return an UNSUPPORTED code instead. Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
* StandaloneMmPkg/MemLib: remove unnecessary checkDun Tan2024-11-055-162/+1
| | | | | | | | | | | | | | | Remove unnecessary check in API MmIsBufferOutsideMmValid of StandaloneMmMemLib. The API is used to check if a input buffer is outside MMRAM and inside a valid non-MMRAM range. Previously, the API only checks if the input buffer is overlapped with MMRAM range. In the last commit, we add logic to check if the input buffer is inside valid non-MMRAM ranges reported by the resource HOB. Since the resource HOB only covers valid non-MMRAM ranges, we doesn't need to check if the input buffer is inside the MMRAM anymore. Signed-off-by: Dun Tan <dun.tan@intel.com>
* StandaloneMmPkg/MemLib: Check if the non-MMRAM buffer is validDun Tan2024-11-054-1/+284
| | | | | | | | | | | | | | | Check if the non-MMRAM buffer is inside valid non-mmram range in API MmIsBufferOutsideMmValid of StandaloneMmMemLib. Previously, the API only checks if the input buffer is overlapped with MMRAM range. Currently, in the new standalone MM infrastructure, we limit the non-MMRAM access to the ranges reported by the resource HOB. To meet the new design, in this API, we cache all the memory ranges reported by the resource HOB and check if the input buffer is inside valid non-MMRAM ranges reported by the resource HOB. Signed-off-by: Dun Tan <dun.tan@intel.com>
* StandaloneMmPkg/MemLib: Add an internal header fileDun Tan2024-11-055-48/+59
| | | | | | | | Add a internal header file for StandaloneMmMemLib. Move some common reference and declaration into StandaloneMmMemLibInternal.h. Signed-off-by: Dun Tan <dun.tan@intel.com>
* StandaloneMmPkg: CodeQL Fixes.Michael Kubacki2024-10-031-1/+1
| | | | | | | | | | | Makes changes to comply with alerts raised by CodeQL. Most of the issues here fall into the following two categories: 1. Potential use of uninitialized pointer 2. Inconsistent integer width used in loop comparison Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* StandaloneMmPkg: Support using gEfiSmmSmramMemoryGuid to get MMRAM rangeWei6 Xu2024-08-284-4/+12
| | | | | | | | | | | | Add the support using gEfiSmmSmramMemoryGuid to get MMRAM ranges. If gEfiSmmSmramMemoryGuid HOB is not found, then try to get MMRAM ranges from gEfiMmPeiMmramMemoryReserveGuid HOB. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
* StandaloneMmMemLib: Drop MM_CORE_PRIVATE_DATAWei6 Xu2024-08-282-33/+11
| | | | | | | | | | | MM_CORE_PRIVATE_DATA is not used as shared structures between MM IPL and MM Core, therefore clean up the code related to gMmCorePrivate. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
* StandaloneMmCoreMemoryAllocationLib: Drop MM_CORE_PRIVATE_DATAWei6 Xu2024-08-282-30/+16
| | | | | | | | | | | MM_CORE_PRIVATE_DATA is not used as shared structures between MM IPL and MM Core, therefore clean up the code related to gMmCorePrivate. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
* StandaloneMmPkg: Create null instance for MmPlatformHobProducerLibDun Tan2024-08-282-0/+94
| | | | | | | Create null instance MmPlatformHobProducerLibNull.inf for MmPlatformHobProducerLib. Signed-off-by: Dun Tan <dun.tan@intel.com>
* StandaloneMmPkg: Add LockBox Dependency Libraryxieyuanh2024-07-312-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The LockBox Dependency Library is designed for standalone MM environments where gBS are not accessible to indicates that LockBox API is readyfor use. For DXE drivers use lockbox APIs via a communication mechanism triggering an SMI, it's must to have the corresponding SMI handler pre-installed for interrupt management. To ensure orderly operations and proper notification, besides specified the guid in the [Depex] section of the .inf file. The installation of smi handler, along with the LockBox protocol marked by gEfiLockBoxProtocolGuid, must be informed to the DXE driver. This protocol installation signifies that the LockBox API is ready for use, and this functionality is implemented in the constructor of this library. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* StandaloneMmPkg: Fix section data length returned larger than actual dataMichael Kubacki2024-07-051-7/+7
| | | | | | | | | | This change fixes an issue where the returned section data length is always 4 bytes larger than the actual section length. This could cause an issue where the caller accesses the final 4 bytes which would be invalid. Co-authored-by: Kun Qin <kuqin@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* StandaloneMmPkg: Arm: Update to use the new StandaloneMmCpu driverTuan Phan2024-02-273-50/+64
| | | | | | | | | Update entry point library for Arm to use the new architecture independent StandaloneMmCpu driver. Signed-off-by: Tuan Phan <tphan@ventanamicro.com> Reviewed-by: levi.yun <yeoreum.yun@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg/Hob: Integer Overflow in CreateHob()Gua Guo2024-01-261-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 Fix integer overflow in various CreateHob instances. Fixes: CVE-2022-36765 The CreateHob() function aligns the requested size to 8 performing the following operation: ``` HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ``` No checks are performed to ensure this value doesn't overflow, and could lead to CreateHob() returning a smaller HOB than requested, which could lead to OOB HOB accesses. Reported-by: Marc Beatove <mbeatove@google.com> Reviewed-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: John Mathew <john.mathews@intel.com> Authored-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
* StandaloneMmPkg/StandaloneMmHobLib: Remove HOB creationNhi Pham2023-12-111-120/+51
| | | | | | | | | | | | | | | According to the discussion in "StandaloneMmPkg: Fix HOB space and heap space conflicted issue" [1], Standalone MM modules should be HOB consumers where HOB is read-only. Therefore, this patch removes the supported functions for HOB creation in the StandaloneMmHobLib. [1] https://edk2.groups.io/g/devel/message/108333 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Oliver Smith-Denny <osde@linux.microsoft.com> Signed-off-by: Nhi Pham <nhiphambka@gmail.com>
* StandaloneMmPkg: Include correct MmuLib headerArd Biesheuvel2023-06-272-2/+2
| | | | | | | | | | StandaloneMm has its own version of the ArmMmuLib library class, but includes the ArmMmuLib header. This happens to work because the prototypes that are referenced are the same, but this will no longer be the case after a future patch. So correct the #includes. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
* StandaloneMmPkg: Update code to be more C11 compliant by using __func__Rebecca Cran2023-04-103-20/+20
| | | | | | | | | | | | __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout StandaloneMmPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg/StandaloneMmMemLib: Change max address computationGirish Mahadevan2023-02-091-14/+1
| | | | | | | | | | Currently the standalonemmlibinternal assumes the max physical bits to be 36 which is causing issues on v8 architectures. Instead use the MAX_ALLOC_ADDRESS macro to determine the maximum allowed address rather than recomputing it locally. Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: Remove duplicated wordsPierre Gondois2022-09-052-2/+2
| | | | | | | | | In an effort to clean the documentation of the above package, remove duplicated words. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* StandaloneMmPkg: Fix issue about SpPcpuSharedBufSize fieldMing Huang2022-07-072-2/+2
| | | | | | | | | | | | | | | | TF-A: TrustedFirmware-A SPM: Secure Partition Manager(MM) In TF-A, the name of this field is sp_shared_buf_size. This field is the size of range for transmit data from TF-A to standaloneMM when SPM enable. SpPcpuSharedBufSize is pass from TF-A while StandaloneMM initialize. So, SpPcpuSharedBufSize should be rename to SpSharedBufSize and this field should no multiply by PayloadBootInfo->NumCpus; Signed-off-by: Ming Huang <huangming@linux.alibaba.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg/FvLib: Support large file with EFI_FFS_FILE_HEADER2.Wei6 Xu2021-12-151-20/+45
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3769 Current FvLib will hit parse issue when encountering LARGE file, then ignore latter ffs/section, thus causing required drivers not being dispatched. Therefore, need to add support for EFI_FFS_FILE_HEADER2 and EFI_COMMON_SECTION_HEADER2 in FvLib to fix this issue. Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* StandaloneMmPkg: Apply uncrustify changesMichael Kubacki2021-12-0717-646/+814
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the StandaloneMmPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg: Change OPTIONAL keyword usage styleMichael D Kinney2021-12-071-1/+1
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg: Support CLANGPDB buildsMarvin Häuser2021-10-181-1/+8
| | | | | | | | | | | | | Currently, the flag "-fpie" is passed for all builds with a GCC family toolchain, including CLANGPDB. CLANGPDB however does not support this flag as it generates PE/COFF files directly. As the flag is mostly required for ARM-specific self-relocation, drop it for other architectures and document the limitation to enable e.g. X64 CLANGPDB builds of StandaloneMmCore. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de> Acked-by: Shi Steven <steven.shi@intel.com>
* StandaloneMmPkg: build for 32bit arm machinesEtienne Carriere2021-08-1110-26/+33
| | | | | | | | | | | | | This change allows to build StandaloneMmPkg components for 32bit Arm StandaloneMm firmware. This change mainly moves AArch64/ source files to Arm/ side directory for several components: StandaloneMmCpu, StandaloneMmCoreEntryPoint and StandaloneMmMemLib. The source file is built for both 32b and 64b Arm targets. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: fix pointer/int casts against 32bit architecturesEtienne Carriere2021-08-112-8/+8
| | | | | | | | | | Use intermediate (UINTN) cast when casting int from/to pointer. This is needed as UINT64 values cast from/to 32bit pointer for 32bit architectures. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg: Add option to use FF-A calls for communication with SPMAchin Gupta2021-02-231-14/+74
| | | | | | | | | | | Add support for reporting completion of a MM request using either the Firmware Framework(FF-A) ABI transport or through the earlier used SVC calls. Signed-off-by: Achin Gupta <achin.gupta@arm.com> Co-developed-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: Add option to use FF-A calls for getting SPM versionSughosh Ganu2021-02-232-10/+33
| | | | | | | | | | | | With the introduction of Firmware Framework(FF-A), a Secure Partition can get the SPM version either using FF-A calls or through the existing svc calls. Use a runtime check to use either of the two methods based on the Pcd feature flag value. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Co-developed-by: Achin Gupta <achin.gupta@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: Use macros for SPM version checkSughosh Ganu2021-02-231-5/+5
| | | | | | | | | | | Declare module wide variables for SPM major and minor versions to be used in checking the SPM version compatibility. Use the SPM major and minor version macros declared in the previous patch for the version check. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: Use FF-A header file in Standalone MM Core entry pointAchin Gupta2021-02-231-0/+1
| | | | | | | | | | Add the Firmware Framework(FF-A) header in the StandaloneMm entry point driver. Support for invoking the functions through FF-A will be added in a subsequent patch. Signed-off-by: Achin Gupta <achin.gupta@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architectureKun Qin2021-02-014-1/+246
| | | | | | | | | | | | | This change extends StandaloneMmMemLib library to support X64 architecture. The implementation is ported from MdePkg/Library/SmmMemLib. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warningKun Qin2021-02-011-3/+3
| | | | | | | | | | | | | | | | Assigning MmramRangeCount from MmCorePrivate (UINT64) to local variable MmramRangeCount (UINT32) will cause compilation failure due to "warning C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data". This changes defines local MmramRangeCount as UINTN type and adds type cast before value assignment. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm CoreKun Qin2021-02-014-275/+597
| | | | | | | | | | | | | | | This change adds support of x64 version of StandaloneMmCoreHobLib. It brings in global variable "gHobList" through StandaloneMmCoreEntryPoint, imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64Kun Qin2021-02-012-0/+74
| | | | | | | | | | | | | This change extends StandaloneMmCoreEntryPoint library to support X64 architecture. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* StandaloneMmPkg: Remove dependency on ArmPlatformPkg.decSami Mujawar2021-01-071-2/+1
| | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Update StandaloneMmCoreEntryPoint to remove the unnecessary dependency on ArmPlatformPkg.dec. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>