2 Entry point to the Standalone MM Foundation when initialized during the SEC
5 Copyright (c) 2017 - 2021, 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 [in] ImageContext Pointer to PE/COFF image context
74 @param [in] ImageBase Base of image in memory
75 @param [in] SectionHeaderOffset Offset of PE/COFF image section header
76 @param [in] NumberOfSections Number of Sections
77 @param [in] TextUpdater Function to change code permissions
78 @param [in] ReadOnlyUpdater Function to change RO permissions
79 @param [in] ReadWriteUpdater Function to change RW permissions
84 UpdateMmFoundationPeCoffPermissions (
85 IN CONST PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
86 IN EFI_PHYSICAL_ADDRESS ImageBase
,
87 IN UINT32 SectionHeaderOffset
,
88 IN CONST UINT16 NumberOfSections
,
89 IN REGION_PERMISSION_UPDATE_FUNC TextUpdater
,
90 IN REGION_PERMISSION_UPDATE_FUNC ReadOnlyUpdater
,
91 IN REGION_PERMISSION_UPDATE_FUNC ReadWriteUpdater
96 Privileged firmware assigns RO & Executable attributes to all memory occupied
97 by the Boot Firmware Volume. This function locates the section information of
98 the Standalone MM Core module to be able to change permissions of the
99 individual sections later in the boot process.
101 @param [in] TeData Pointer to PE/COFF image data
102 @param [in, out] ImageContext Pointer to PE/COFF image context
103 @param [out] ImageBase Pointer to ImageBase variable
104 @param [in, out] SectionHeaderOffset Offset of PE/COFF image section header
105 @param [in, out] NumberOfSections Number of Sections
110 GetStandaloneMmCorePeCoffSections (
112 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
113 OUT EFI_PHYSICAL_ADDRESS
*ImageBase
,
114 IN OUT UINT32
*SectionHeaderOffset
,
115 IN OUT UINT16
*NumberOfSections
120 Privileged firmware assigns RO & Executable attributes to all memory occupied
121 by the Boot Firmware Volume. This function locates the Standalone MM Core
122 module PE/COFF image in the BFV and returns this information.
124 @param [in] BfvAddress Base Address of Boot Firmware Volume
125 @param [in, out] TeData Pointer to address for allocating memory
126 for PE/COFF image data
127 @param [in, out] TeDataSize Pointer to size of PE/COFF image data
132 LocateStandaloneMmCorePeCoffData (
133 IN EFI_FIRMWARE_VOLUME_HEADER
*BfvAddress
,
134 IN OUT VOID
**TeData
,
135 IN OUT UINTN
*TeDataSize
140 Use the boot information passed by privileged firmware to populate a HOB list
141 suitable for consumption by the MM Core and drivers.
143 @param [in, out] CpuDriverEntryPoint Address of MM CPU driver entrypoint
144 @param [in] PayloadBootInfo Boot information passed by privileged
150 CreateHobListFromBootInfo (
151 IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT
*CpuDriverEntryPoint
,
152 IN EFI_SECURE_PARTITION_BOOT_INFO
*PayloadBootInfo
157 The entry point of Standalone MM Foundation.
159 @param [in] SharedBufAddress Pointer to the Buffer between SPM and SP.
160 @param [in] SharedBufSize Size of the shared buffer.
161 @param [in] cookie1 Cookie 1
162 @param [in] cookie2 Cookie 2
168 IN VOID
*SharedBufAddress
,
169 IN UINT64 SharedBufSize
,
176 Auto generated function that calls the library constructors for all of the module's dependent libraries.
178 This function must be called by _ModuleEntryPoint().
179 This function calls the set of library constructors for the set of library instances
180 that a module depends on. This includes library instances that a module depends on
181 directly and library instances that a module depends on indirectly through other
182 libraries. This function is auto generated by build tools and those build tools are
183 responsible for collecting the set of library instances, determine which ones have
184 constructors, and calling the library constructors in the proper order based upon
185 each of the library instances own dependencies.
187 @param ImageHandle The image handle of the DXE Core.
188 @param SystemTable A pointer to the EFI System Table.
193 ProcessLibraryConstructorList (
194 IN EFI_HANDLE ImageHandle
,
195 IN EFI_MM_SYSTEM_TABLE
*MmSystemTable
200 Auto generated function that calls a set of module entry points.
202 This function must be called by _ModuleEntryPoint().
203 This function calls the set of module entry points.
204 This function is auto generated by build tools and those build tools are responsible
205 for collecting the module entry points and calling them in a specified order.
207 @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase.
212 ProcessModuleEntryPointList (