2 Entry point to the Standalone MM Foundation when initialized during the SEC
5 Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __STANDALONEMMCORE_ENTRY_POINT_H__
11 #define __STANDALONEMMCORE_ENTRY_POINT_H__
13 #include <Library/PeCoffLib.h>
14 #include <Library/FvLib.h>
16 #define CPU_INFO_FLAG_PRIMARY_CPU 0x00000001
19 UINT8 Type
; /* type of the structure */
20 UINT8 Version
; /* version of this structure */
21 UINT16 Size
; /* size of this structure in bytes */
22 UINT32 Attr
; /* attributes: unused bits SBZ */
29 } EFI_SECURE_PARTITION_CPU_INFO
;
32 EFI_PARAM_HEADER Header
;
38 UINT64 SpNsCommBufBase
;
39 UINT64 SpSharedBufBase
;
41 UINT64 SpPcpuStackSize
;
43 UINT64 SpNsCommBufSize
;
44 UINT64 SpPcpuSharedBufSize
;
45 UINT32 NumSpMemRegions
;
47 EFI_SECURE_PARTITION_CPU_INFO
*CpuInfo
;
48 } EFI_SECURE_PARTITION_BOOT_INFO
;
52 (*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT
) (
55 IN UINTN NsCommBufferAddr
59 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT
*ArmTfCpuDriverEpPtr
;
60 } ARM_TF_CPU_DRIVER_EP_DESCRIPTOR
;
62 typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC
) (
63 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
68 Privileged firmware assigns RO & Executable attributes to all memory occupied
69 by the Boot Firmware Volume. This function sets the correct permissions of
70 sections in the Standalone MM Core module to be able to access RO and RW data
71 and make further progress in the boot process.
73 @param ImageContext Pointer to PE/COFF image context
74 @param SectionHeaderOffset Offset of PE/COFF image section header
75 @param NumberOfSections Number of Sections
76 @param TextUpdater Function to change code permissions
77 @param ReadOnlyUpdater Function to change RO permissions
78 @param ReadWriteUpdater Function to change RW permissions
83 UpdateMmFoundationPeCoffPermissions (
84 IN CONST PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
85 IN UINT32 SectionHeaderOffset
,
86 IN CONST UINT16 NumberOfSections
,
87 IN REGION_PERMISSION_UPDATE_FUNC TextUpdater
,
88 IN REGION_PERMISSION_UPDATE_FUNC ReadOnlyUpdater
,
89 IN REGION_PERMISSION_UPDATE_FUNC ReadWriteUpdater
94 Privileged firmware assigns RO & Executable attributes to all memory occupied
95 by the Boot Firmware Volume. This function locates the section information of
96 the Standalone MM Core module to be able to change permissions of the
97 individual sections later in the boot process.
99 @param TeData Pointer to PE/COFF image data
100 @param ImageContext Pointer to PE/COFF image context
101 @param SectionHeaderOffset Offset of PE/COFF image section header
102 @param NumberOfSections Number of Sections
107 GetStandaloneMmCorePeCoffSections (
109 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
110 IN OUT UINT32
*SectionHeaderOffset
,
111 IN OUT UINT16
*NumberOfSections
116 Privileged firmware assigns RO & Executable attributes to all memory occupied
117 by the Boot Firmware Volume. This function locates the Standalone MM Core
118 module PE/COFF image in the BFV and returns this information.
120 @param BfvAddress Base Address of Boot Firmware Volume
121 @param TeData Pointer to address for allocating memory for
123 @param TeDataSize Pointer to size of PE/COFF image data
128 LocateStandaloneMmCorePeCoffData (
129 IN EFI_FIRMWARE_VOLUME_HEADER
*BfvAddress
,
130 IN OUT VOID
**TeData
,
131 IN OUT UINTN
*TeDataSize
136 Use the boot information passed by privileged firmware to populate a HOB list
137 suitable for consumption by the MM Core and drivers.
139 @param CpuDriverEntryPoint Address of MM CPU driver entrypoint
140 @param PayloadBootInfo Boot information passed by privileged firmware
145 CreateHobListFromBootInfo (
146 IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT
*CpuDriverEntryPoint
,
147 IN EFI_SECURE_PARTITION_BOOT_INFO
*PayloadBootInfo
152 The entry point of Standalone MM Foundation.
154 @param SharedBufAddress Pointer to the Buffer between SPM and SP.
161 IN VOID
*SharedBufAddress
,
162 IN UINT64 SharedBufSize
,
169 Auto generated function that calls the library constructors for all of the module's dependent libraries.
171 This function must be called by _ModuleEntryPoint().
172 This function calls the set of library constructors for the set of library instances
173 that a module depends on. This includes library instances that a module depends on
174 directly and library instances that a module depends on indirectly through other
175 libraries. This function is auto generated by build tools and those build tools are
176 responsible for collecting the set of library instances, determine which ones have
177 constructors, and calling the library constructors in the proper order based upon
178 each of the library instances own dependencies.
180 @param ImageHandle The image handle of the DXE Core.
181 @param SystemTable A pointer to the EFI System Table.
186 ProcessLibraryConstructorList (
187 IN EFI_HANDLE ImageHandle
,
188 IN EFI_MM_SYSTEM_TABLE
*MmSystemTable
193 Auto generated function that calls a set of module entry points.
195 This function must be called by _ModuleEntryPoint().
196 This function calls the set of module entry points.
197 This function is auto generated by build tools and those build tools are responsible
198 for collecting the module entry points and calling them in a specified order.
200 @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase.
205 ProcessModuleEntryPointList (