summaryrefslogtreecommitdiffstats
path: root/StandaloneMmPkg/Core
Commit message (Collapse)AuthorAgeFilesLines
* StandaloneMmPkg/StandaloneMmCore: Fix compiler warningMichael Kubacki2021-02-111-4/+4
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3204 Fixes the following compiler warning in VS2019 by changing defining the MmramRangeCount variable to be UINTN and type casting prior to value assignment. \edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): error C2220: the following warning is treated as an error \edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): warning C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg: Fix ECC error 9001 in Standalone MM CoreSami Mujawar2021-01-071-4/+5
| | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix the ECC reported error "[9001] The file headers should follow Doxygen special documentation blocks in section 2.3.5" 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>
* StandaloneMmPkg: Fix ECC error 4002 and 9002 in StandaloneMmCoreSami Mujawar2021-01-071-5/+18
| | | | | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Add doxygen style function documentation headers to fix the ECC reported errors: - [4002] Function header doesn't exist. - [9002] The function headers should follow Doxygen special documentation blocks in section 2.3.5. 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>
* StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCoreSami Mujawar2021-01-071-2/+4
| | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix ECC error "[5007] There should be no initialization of a variable as part of its declaration Variable." 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>
* StandaloneMmPkg: Fix ECC error 4002 in FwVol helperSami Mujawar2021-01-071-13/+14
| | | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix ECC Error "[4002] Function header doesn't exist Function [MmCoreFfsFindMmDriver] has NO comment immediately preceding it." 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>
* StandaloneMmPkg: Fix ECC error 1001 in SMM Memory pool managementSami Mujawar2021-01-071-3/+3
| | | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix the following error reported by the Ecc tool: [1001] 'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces. 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>
* StandaloneMmPkg: Fix ECC error 9002 in Core dispatcherSami Mujawar2021-01-071-10/+6
| | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix the ECC reported error "[9002] The function headers should follow Doxygen special documentation blocks in section 2.3.5 in Comment" 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>
* StandaloneMmPkg: Fix spell check reported errorsSami Mujawar2021-01-076-34/+35
| | | | | | | | | | | | Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix the spelling mistakes reported by the spell check utility that is run as part of the 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>
* StandaloneMmPkg: generate position independent code for StMM coreArd Biesheuvel2020-06-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The standalone MM core runs in a restricted environment that is set up by a higher privilege level, and which may not allow memory regions to be writable and executable at the same time. This means that making the StMM core self-relocatable requires that all the targets of the relocation fixups are outside of the executable region of the image, given that we cannot remap the executable code writable from the executable code itself without losing those execute permissions. So instead, use the existing toolchain support to ensure that position independent code is used where possible, and that all the remaining relocated quantities are emitted into the data section. (Note that staticallly initialized const pointers will be emitted into the .data.rel.ro section, which gets pulled into the .data section by our linker script) To ensure that we don't pick up any absolute references in executable code inadvertently (e.g., in assembler code), add the '-z text' linker option which will force the build to fail in this case. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* StandaloneMmPkg/Core: add missing GUID referenceArd Biesheuvel2020-06-161-0/+1
| | | | | | | | | | The Standalone core uses gEfiHobMemoryAllocModuleGuid, but failed to declare this in its INF. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* StandaloneMmPkg/Core: fix bogus FV pointer in DEBUG stringArd Biesheuvel2020-06-161-1/+1
| | | | | | | | | | | FvIsBeingProcessed () emits a DEBUG print with the intent to print the memory address of the FV that is being processed, but instead, it prints the contents of an uninitialized stack variable. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* StandaloneMmPkg: switch to MM communicate 2 protocolArd Biesheuvel2020-05-121-1/+1
| | | | | | | | | | Update the reference to MM communicate to refer to the MM communicate 2 protocol instead. This makes no difference for the MM side of the implementation, but is more accurate nonetheless, since the original MM protocol does not work in combination with standalone MM. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* StandaloneMmPkg: Fix few typosAntoine Coeur2020-02-103-3/+3
| | | | | | | | | | | | | Fix few typos in comments. Cc: Achin Gupta <achin.gupta@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-76-philmd@redhat.com>
* StandaloneMmPkg: Fix a typoPhilippe Mathieu-Daudé2020-02-101-1/+1
| | | | | | | | | | | Fix a typo in a comment. Cc: Achin Gupta <achin.gupta@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-75-philmd@redhat.com>
* StandaloneMmPkg/Core: Fix typo in function namePhilippe Mathieu-Daude2019-10-172-4/+4
| | | | | | | | | An extra 's' slipped into the FvIsBeingProcessed function name. Drop it to fix the typo. Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* StandaloneMmPkg/Core: stop abusing EFI_HANDLE for FwVolHeader trackingLaszlo Ersek2019-10-093-46/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FvHasBeenProcessed() and FvIsBeingProcesssed() functions make sure that every firmware volume is processed only once (every driver in every firmware volume should be discovered only once). For this, the functions use a linked list. In MdeModulePkg's DXE Core and SMM Core, the key used for identifying those firmware volumes that have been processed is the EFI_HANDLE on which the DXE or SMM firmware volume protocol is installed. In the StandaloneMmPkg core however, the key is the address of the firmware volume header; that is, it has type (EFI_FIRMWARE_VOLUME_HEADER*). (EFI_FIRMWARE_VOLUME_HEADER*) has nothing to do with EFI_HANDLE. EFI_HANDLE just happens to be specified as (VOID*), and therefore the conversion between (EFI_FIRMWARE_VOLUME_HEADER*) and EFI_HANDLE is silent. (The FvHasBeenProcessed() and FvIsBeingProcesssed() functions were likely copied verbatim from MdeModulePkg's DXE Core and/or the SMM Core, and not flagged by the compiler in StandaloneMmPkg due to UEFI regrettably specifying EFI_HANDLE as (VOID*), thereby enabling the above implicit conversion.) We should not exploit this circumstance. Represent the key type faithfully instead. This is a semantic fix; there is no change in operation. Cc: Achin Gupta <achin.gupta@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Reviewed-by: Achin Gupta <achin.gupta@arm.com>
* StandaloneMmPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-0914-97/+14
| | | | | | | | | | | | | | | | | | | | 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>
* StandaloneMmPkg/Core: remove legacy boot supportArd Biesheuvel2019-03-112-113/+33
| | | | | | | | | Remove the support for booting 'legacy' (i.e., non-UEFI boot) OSes. 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>
* StandaloneMmPkg/Core: drop support for dispatching FVs into MMArd Biesheuvel2019-03-113-69/+0
| | | | | | | | | | | Remove the support that permits calls into the MM context to dispatch firmware volumes that are not part of the initial standalone MM firmware volume. 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>
* StandaloneMmPkg/Core: dispatch all drivers at init timeArd Biesheuvel2019-03-112-93/+0
| | | | | | | | | | | | | Instead of deferring dispatch of the remaining MM drivers once the CPU driver has been dispatched, proceed and dispatch all drivers. This makes sense for standalone MM, since all dispatchable drivers should be present in the initial firmware volume anyway: dispatch of additional FVs originating in the non-secure side is not supported. 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>
* StandaloneMmPkg/Core: permit encapsulated firmware volumesArd Biesheuvel2019-03-112-9/+91
| | | | | | | | | | | | | | | Standalone MM requires 4 KB section alignment for all images, so that strict permissions can be applied. Unfortunately, this results in a lot of wasted space, which is usually costly in the secure world environment that standalone MM is expected to operate in. So let's permit the standalone MM drivers (but not the core) to be delivered in a compressed firmware volume. 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>
* StandaloneMmPkg/Core/Dispatcher: don't copy dispatched image twiceArd Biesheuvel2019-01-211-29/+1
| | | | | | | | | | | The dispatcher uses the PE/COFF loader to load images into the heap, but only does so after copying the entire image first, leading to two copies being made for no good reason. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Achin Gupta <achin.gupta@arm.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* StandaloneMmPkg/Core: Implementation of Standalone MM Core Module.Supreeth Venkatesh2018-07-2014-0/+5749
Management Mode (MM) is a generic term used to describe a secure execution environment provided by the CPU and related silicon that is entered when the CPU detects a MMI. For x86 systems, this can be implemented with System Management Mode (SMM). For ARM systems, this can be implemented with TrustZone (TZ). A MMI can be a CPU instruction or interrupt. Upon detection of a MMI, a CPU will jump to the MM Entry Point and save some portion of its state (the "save state") such that execution can be resumed. The MMI can be generated synchronously by software or asynchronously by a hardware event. Each MMI source can be detected, cleared and disabled. Some systems provide for special memory (Management Mode RAM or MMRAM) which is set aside for software running in MM. Usually the MMRAM is hidden during normal CPU execution, but this is not required. Usually, after MMRAM is hidden it cannot be exposed until the next system reset. The MM Core Interface Specification describes three pieces of the PI Management Mode architecture: 1. MM Dispatch During DXE, the DXE Foundation works with the MM Foundation to schedule MM drivers for execution in the discovered firmware volumes. 2. MM Initialization MM related code opens MMRAM, creates the MMRAM memory map, and launches the MM Foundation, which provides the necessary services to launch MM-related drivers. Then, sometime before boot, MMRAM is closed and locked. This piece may be completed during the SEC, PEI or DXE phases. 3. MMI Management When an MMI generated, the MM environment is created and then the MMI sources are detected and MMI handlers called. This patch implements the MM Core. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com> Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>