Commit Graph

21 Commits

Author SHA1 Message Date
Mikhail Krichanov dbcf8301e1 SecurePE: Replaced old PE loader with Secure one. 2025-02-27 13:57:00 +03:00
Oliver Smith-Denny db03bf1d9d StandaloneMmPkg: Consume X64 StandaloneMmCoreEntryPoint From MdePkg
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>
2025-02-07 02:23:11 +00:00
Levi Yun 2091e449f1 StandaloneMmPkg: Introduce a PCD to disable shadow boot FV
On some Arm platforms the boot firmware volume passed in the HOB
by the secure world firmware (TF-A) is never freed and is always
mapped as read-only.

On such platforms the heap memory can be saved by disabling the
shadow copy of the boot firmware volume. This is useful as on
some platforms the amount of memory available is limited.

Therefore, introduce a PCD PcdShadowBfv that platforms
can configure to disable the shadow boot FV. This PCD is set to
TRUE by default.

Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-20 09:13:26 +00:00
Levi Yun f0c87b9ef4 StandaloneMmPkg: move core entry point lib and cpu driver to ArmPkg
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>
2025-01-17 14:55:42 +00:00
Levi Yun b370eab898 StandaloneMmPkg: introduce StandaloneMmExtractGuidedSectionLib
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>
2025-01-17 14:55:42 +00:00
levi.yun 6087382c62 StandaloneMmPkg: Introduce PI_MM_CPU_DRIVER_EP protocol.
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>
2025-01-17 14:55:42 +00:00
Hongbin1 Zhang 47cb080ca4 StandaloneMmPkg : Add MM core fv location PPI
Add MM core FV location PPI, it will include
MM core FV location which could be in FSP-I
or Bootloader MM FV.

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
2024-12-20 05:44:54 +00:00
Wei6 Xu d5c7bba504 StandaloneMmPkg: Restart dispatcher once MM entry is registered for X64
X64 arch needs to restart the MM dispatcher once MM entry point is
registered, therefore set PcdRestartMmDispatcherOnceMmEntryRegistered
to TRUE by default for X64 only.

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>
2024-08-30 18:27:36 +00:00
Wei6 Xu 487fa274c4 StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered
Defer the dispatch of the remaining MM drivers once the CPU driver has
been dispatched.

In MmDispatcher, return immediately if the MM Entry Point was registered.
Then the MM IPL will reinvoke the MM Core Dispatcher. This is required
so MM Mode may be enabled as soon as all the dependent MM Drivers for MM
Mode have been dispatched.

Introduce a FeatureFlag PCD to control if MmDispatcher returns or not
when MmEntryPointPoint is registered. Default value is FALSE.

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>
2024-08-28 15:25:27 +00:00
Wei6 Xu f0254c9a1c StandaloneMmPkg: Remove definition for MM_CORE_PRIVATE_DATA
MM_CORE_PRIVATE_DATA is not used as shared structures between MM IPL
and MM Core, therefore clean up definition for MM_CORE_PRIVATE_DATA.

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>
2024-08-28 15:25:27 +00:00
Jiaxin Wu 56908fd4be StandaloneMmPkg/StandaloneMmPkg.dec: Add gEventMmDispatchGuid
MmIpl shall use gEventMmDispatchGuid to initialize
EFI_MM_COMMUNICATE_HEADER structure, and then communicate with MmCore
to dispatch all StandaloneMm drivers in SMM environment.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Co-authored-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Co-Authored-by: Ray Ni <ray.ni@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Star Zeng <star.zeng@intel.com>
Co-Authored-by: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-08-28 15:25:27 +00:00
Dun Tan 43e8801410 StandaloneMmPkg: Add MmPlatformHobProducerLib library class
CreateMmPlatformHob() is defined in the MmPlatformHobProducerLib
library class. The function is for StandaloneMm IPL to create all
Platform specific HOBs that required by the Standalone MM env.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Co-authored-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Co-authored-by: Ray Ni <ray.ni@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-08-28 15:25:27 +00:00
Tuan Phan e7a7169446 StandaloneMmPkg: Make StandaloneMmCpu driver architecture independent
StandaloneMmCpu now can supports more architectures like RISC-V besides
ARM/AARCH64.

Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
Reviewed-by: levi.yun <yeoreum.yun@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-02-27 12:27:58 +00:00
Wei6 Xu c012284048 StandaloneMmPkg/Core: Limit FwVol encapsulation section recursion
MmCoreFfsFindMmDriver() is called recursively for encapsulation sections.
Currently this recursion is not limited. Introduce a new PCD
(fixed-at-build, or patchable-in-module), and make MmCoreFfsFindMmDriver()
track the section nesting depth against that PCD.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-12-19 09:29:07 +00:00
Etienne Carriere a776bbabd9 StandaloneMmPkg: build for 32bit arm machines
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>
2021-08-11 11:32:32 +00:00
Michael Kubacki cd14150c15 StandaloneMmPkg: Remove StandaloneMmDriverEntryPoint.h
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3235

The library for this header initially resided in StandaloneMmPkg
but moved to MdePkg and now this file is a duplicate of the header
file in MdePkg.

This change removes the header file from StandaloneMmPkg. More
details regarding the history of the library transitioning from
StandaloneMmPkg to MdePkg are below.

The following commit removed the library from StandaloneMmPkg:
  d6253d2f9a ("StandaloneMmPkg: remove redundant
  StandaloneMmDriverEntryPoint driver", 2019-03-11)

The following commits added the library class & instance to MdePkg:
  7df4764e6a ("MdePkg: introduce standalone MM entry point
  library class", 2019-01-14)

  5866d49923 ("MdePkg: introduce standalone MM entry point
  library implementation", 2019-01-14)

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2021-02-26 18:56:48 +00:00
Sami Mujawar 3325965cb3 StandaloneMmPkg: Add library header files to DEC
Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150)

Declare the library header files in the package DEC file to
fix errors reported by Core CI.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-01-07 11:13:39 +00:00
Michael D Kinney 86094561f6 StandaloneMmPkg: Replace BSD License with BSD+Patent License
https://bugzilla.tianocore.org/show_bug.cgi?id=1373

Replace BSD 2-Clause License with BSD+Patent License.  This change is
based on the following emails:

  https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html
  https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html

RFCs with detailed process for the license change:

  V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html
  V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html
  V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2019-04-09 10:58:27 -07:00
Ard Biesheuvel 4d275961d8 StandaloneMmPkg: drop unused PCD PcdStandaloneMmEnable
The PCD PcdStandaloneMmEnable is unused, and shouldn't exist in the
first place since the value is implied by the context (it is never
valid to set it to FALSE for standalone MM or TRUE for traditional
MM). So drop it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
2019-03-11 12:51:12 +01:00
Ard Biesheuvel 56edfb174a StandaloneMmPkg: drop redundant definition of gEfiMmConfigurationProtocolGuid
gEfiMmConfigurationProtocolGuid is already defined in MdePkg, so drop
the duplicate definition from StandaloneMmPkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by "Yao, Jiewen" <jiewen.yao@intel.com>
2019-03-11 12:46:35 +01:00
Supreeth Venkatesh da417eb8ed StandaloneMmPkg: Describe the declaration and definition files.
This patch describes the package declarations and definitions
for creating standalone management mode image with
core/foundation and drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-20 10:59:56 +08:00