]> git.proxmox.com Git - mirror_edk2.git/blame - StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h
StandaloneMmPkg: Apply uncrustify changes
[mirror_edk2.git] / StandaloneMmPkg / Include / Library / Arm / StandaloneMmCoreEntryPoint.h
CommitLineData
184558d0
SV
1/** @file\r
2 Entry point to the Standalone MM Foundation when initialized during the SEC\r
3 phase on ARM platforms\r
4\r
764942a2 5Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>\r
86094561 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
184558d0
SV
7\r
8**/\r
9\r
10#ifndef __STANDALONEMMCORE_ENTRY_POINT_H__\r
11#define __STANDALONEMMCORE_ENTRY_POINT_H__\r
12\r
13#include <Library/PeCoffLib.h>\r
14#include <Library/FvLib.h>\r
15\r
16#define CPU_INFO_FLAG_PRIMARY_CPU 0x00000001\r
17\r
18typedef struct {\r
91415a36
MK
19 UINT8 Type; /* type of the structure */\r
20 UINT8 Version; /* version of this structure */\r
21 UINT16 Size; /* size of this structure in bytes */\r
22 UINT32 Attr; /* attributes: unused bits SBZ */\r
184558d0
SV
23} EFI_PARAM_HEADER;\r
24\r
25typedef struct {\r
91415a36
MK
26 UINT64 Mpidr;\r
27 UINT32 LinearId;\r
28 UINT32 Flags;\r
184558d0
SV
29} EFI_SECURE_PARTITION_CPU_INFO;\r
30\r
31typedef struct {\r
91415a36
MK
32 EFI_PARAM_HEADER Header;\r
33 UINT64 SpMemBase;\r
34 UINT64 SpMemLimit;\r
35 UINT64 SpImageBase;\r
36 UINT64 SpStackBase;\r
37 UINT64 SpHeapBase;\r
38 UINT64 SpNsCommBufBase;\r
39 UINT64 SpSharedBufBase;\r
40 UINT64 SpImageSize;\r
41 UINT64 SpPcpuStackSize;\r
42 UINT64 SpHeapSize;\r
43 UINT64 SpNsCommBufSize;\r
44 UINT64 SpPcpuSharedBufSize;\r
45 UINT32 NumSpMemRegions;\r
46 UINT32 NumCpus;\r
47 EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;\r
184558d0
SV
48} EFI_SECURE_PARTITION_BOOT_INFO;\r
49\r
50typedef\r
51EFI_STATUS\r
52(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (\r
91415a36
MK
53 IN UINTN EventId,\r
54 IN UINTN CpuNumber,\r
55 IN UINTN NsCommBufferAddr\r
184558d0
SV
56 );\r
57\r
58typedef struct {\r
91415a36 59 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr;\r
184558d0
SV
60} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;\r
61\r
62typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (\r
91415a36
MK
63 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
64 IN UINT64 Length\r
184558d0
SV
65 );\r
66\r
67/**\r
68 Privileged firmware assigns RO & Executable attributes to all memory occupied\r
69 by the Boot Firmware Volume. This function sets the correct permissions of\r
70 sections in the Standalone MM Core module to be able to access RO and RW data\r
71 and make further progress in the boot process.\r
72\r
764942a2
SM
73 @param [in] ImageContext Pointer to PE/COFF image context\r
74 @param [in] ImageBase Base of image in memory\r
75 @param [in] SectionHeaderOffset Offset of PE/COFF image section header\r
76 @param [in] NumberOfSections Number of Sections\r
77 @param [in] TextUpdater Function to change code permissions\r
78 @param [in] ReadOnlyUpdater Function to change RO permissions\r
79 @param [in] ReadWriteUpdater Function to change RW permissions\r
184558d0
SV
80\r
81**/\r
82EFI_STATUS\r
83EFIAPI\r
84UpdateMmFoundationPeCoffPermissions (\r
91415a36
MK
85 IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
86 IN EFI_PHYSICAL_ADDRESS ImageBase,\r
87 IN UINT32 SectionHeaderOffset,\r
88 IN CONST UINT16 NumberOfSections,\r
89 IN REGION_PERMISSION_UPDATE_FUNC TextUpdater,\r
90 IN REGION_PERMISSION_UPDATE_FUNC ReadOnlyUpdater,\r
91 IN REGION_PERMISSION_UPDATE_FUNC ReadWriteUpdater\r
184558d0
SV
92 );\r
93\r
184558d0
SV
94/**\r
95 Privileged firmware assigns RO & Executable attributes to all memory occupied\r
96 by the Boot Firmware Volume. This function locates the section information of\r
97 the Standalone MM Core module to be able to change permissions of the\r
98 individual sections later in the boot process.\r
99\r
764942a2
SM
100 @param [in] TeData Pointer to PE/COFF image data\r
101 @param [in, out] ImageContext Pointer to PE/COFF image context\r
102 @param [out] ImageBase Pointer to ImageBase variable\r
103 @param [in, out] SectionHeaderOffset Offset of PE/COFF image section header\r
104 @param [in, out] NumberOfSections Number of Sections\r
184558d0
SV
105\r
106**/\r
107EFI_STATUS\r
108EFIAPI\r
109GetStandaloneMmCorePeCoffSections (\r
91415a36
MK
110 IN VOID *TeData,\r
111 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
112 OUT EFI_PHYSICAL_ADDRESS *ImageBase,\r
113 IN OUT UINT32 *SectionHeaderOffset,\r
114 IN OUT UINT16 *NumberOfSections\r
184558d0
SV
115 );\r
116\r
184558d0
SV
117/**\r
118 Privileged firmware assigns RO & Executable attributes to all memory occupied\r
119 by the Boot Firmware Volume. This function locates the Standalone MM Core\r
120 module PE/COFF image in the BFV and returns this information.\r
121\r
764942a2
SM
122 @param [in] BfvAddress Base Address of Boot Firmware Volume\r
123 @param [in, out] TeData Pointer to address for allocating memory\r
124 for PE/COFF image data\r
125 @param [in, out] TeDataSize Pointer to size of PE/COFF image data\r
184558d0
SV
126\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130LocateStandaloneMmCorePeCoffData (\r
91415a36
MK
131 IN EFI_FIRMWARE_VOLUME_HEADER *BfvAddress,\r
132 IN OUT VOID **TeData,\r
133 IN OUT UINTN *TeDataSize\r
184558d0
SV
134 );\r
135\r
184558d0
SV
136/**\r
137 Use the boot information passed by privileged firmware to populate a HOB list\r
138 suitable for consumption by the MM Core and drivers.\r
139\r
4779bc6c
SM
140 @param [in, out] CpuDriverEntryPoint Address of MM CPU driver entrypoint\r
141 @param [in] PayloadBootInfo Boot information passed by privileged\r
142 firmware\r
184558d0
SV
143\r
144**/\r
145VOID *\r
146EFIAPI\r
147CreateHobListFromBootInfo (\r
91415a36
MK
148 IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,\r
149 IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo\r
184558d0
SV
150 );\r
151\r
184558d0
SV
152/**\r
153 The entry point of Standalone MM Foundation.\r
154\r
4779bc6c
SM
155 @param [in] SharedBufAddress Pointer to the Buffer between SPM and SP.\r
156 @param [in] SharedBufSize Size of the shared buffer.\r
157 @param [in] cookie1 Cookie 1\r
158 @param [in] cookie2 Cookie 2\r
159\r
184558d0
SV
160**/\r
161VOID\r
162EFIAPI\r
163_ModuleEntryPoint (\r
164 IN VOID *SharedBufAddress,\r
165 IN UINT64 SharedBufSize,\r
166 IN UINT64 cookie1,\r
167 IN UINT64 cookie2\r
168 );\r
169\r
184558d0
SV
170/**\r
171 Auto generated function that calls the library constructors for all of the module's dependent libraries.\r
172\r
173 This function must be called by _ModuleEntryPoint().\r
174 This function calls the set of library constructors for the set of library instances\r
175 that a module depends on. This includes library instances that a module depends on\r
176 directly and library instances that a module depends on indirectly through other\r
177 libraries. This function is auto generated by build tools and those build tools are\r
178 responsible for collecting the set of library instances, determine which ones have\r
179 constructors, and calling the library constructors in the proper order based upon\r
180 each of the library instances own dependencies.\r
181\r
182 @param ImageHandle The image handle of the DXE Core.\r
183 @param SystemTable A pointer to the EFI System Table.\r
184\r
185**/\r
186VOID\r
187EFIAPI\r
188ProcessLibraryConstructorList (\r
91415a36 189 IN EFI_HANDLE ImageHandle,\r
184558d0
SV
190 IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r
191 );\r
192\r
184558d0
SV
193/**\r
194 Auto generated function that calls a set of module entry points.\r
195\r
196 This function must be called by _ModuleEntryPoint().\r
197 This function calls the set of module entry points.\r
198 This function is auto generated by build tools and those build tools are responsible\r
199 for collecting the module entry points and calling them in a specified order.\r
200\r
201 @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase.\r
202\r
203**/\r
204VOID\r
205EFIAPI\r
206ProcessModuleEntryPointList (\r
207 IN VOID *HobStart\r
208 );\r
209\r
210#endif\r