]> git.proxmox.com Git - mirror_edk2.git/blame - StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h
StandaloneMmPkg: Fix ECC error 4002 and 9002 in StandaloneMmCore
[mirror_edk2.git] / StandaloneMmPkg / Include / Library / AArch64 / 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
5Copyright (c) 2017 - 2018, 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
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
23} EFI_PARAM_HEADER;\r
24\r
25typedef struct {\r
26 UINT64 Mpidr;\r
27 UINT32 LinearId;\r
28 UINT32 Flags;\r
29} EFI_SECURE_PARTITION_CPU_INFO;\r
30\r
31typedef struct {\r
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
48} EFI_SECURE_PARTITION_BOOT_INFO;\r
49\r
50typedef\r
51EFI_STATUS\r
52(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (\r
53 IN UINTN EventId,\r
54 IN UINTN CpuNumber,\r
55 IN UINTN NsCommBufferAddr\r
56 );\r
57\r
58typedef struct {\r
59 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr;\r
60} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;\r
61\r
62typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (\r
63 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
64 IN UINT64 Length\r
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
73 @param ImageContext Pointer to PE/COFF image context\r
493f2c69 74 @param ImageBase Base of image in memory\r
184558d0
SV
75 @param SectionHeaderOffset Offset of PE/COFF image section header\r
76 @param NumberOfSections Number of Sections\r
77 @param TextUpdater Function to change code permissions\r
78 @param ReadOnlyUpdater Function to change RO permissions\r
79 @param ReadWriteUpdater Function to change RW permissions\r
80\r
81**/\r
82EFI_STATUS\r
83EFIAPI\r
84UpdateMmFoundationPeCoffPermissions (\r
85 IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
493f2c69 86 IN EFI_PHYSICAL_ADDRESS ImageBase,\r
184558d0
SV
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
92 );\r
93\r
94\r
95/**\r
96 Privileged firmware assigns RO & Executable attributes to all memory occupied\r
97 by the Boot Firmware Volume. This function locates the section information of\r
98 the Standalone MM Core module to be able to change permissions of the\r
99 individual sections later in the boot process.\r
100\r
101 @param TeData Pointer to PE/COFF image data\r
102 @param ImageContext Pointer to PE/COFF image context\r
493f2c69 103 @param ImageBase Pointer to ImageBase variable\r
184558d0
SV
104 @param SectionHeaderOffset Offset of PE/COFF image section header\r
105 @param NumberOfSections Number of Sections\r
106\r
107**/\r
108EFI_STATUS\r
109EFIAPI\r
110GetStandaloneMmCorePeCoffSections (\r
111 IN VOID *TeData,\r
112 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
493f2c69 113 OUT EFI_PHYSICAL_ADDRESS *ImageBase,\r
184558d0
SV
114 IN OUT UINT32 *SectionHeaderOffset,\r
115 IN OUT UINT16 *NumberOfSections\r
116 );\r
117\r
118\r
119/**\r
120 Privileged firmware assigns RO & Executable attributes to all memory occupied\r
121 by the Boot Firmware Volume. This function locates the Standalone MM Core\r
122 module PE/COFF image in the BFV and returns this information.\r
123\r
124 @param BfvAddress Base Address of Boot Firmware Volume\r
125 @param TeData Pointer to address for allocating memory for\r
126 PE/COFF image data\r
127 @param TeDataSize Pointer to size of PE/COFF image data\r
128\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132LocateStandaloneMmCorePeCoffData (\r
133 IN EFI_FIRMWARE_VOLUME_HEADER *BfvAddress,\r
134 IN OUT VOID **TeData,\r
135 IN OUT UINTN *TeDataSize\r
136 );\r
137\r
138\r
139/**\r
140 Use the boot information passed by privileged firmware to populate a HOB list\r
141 suitable for consumption by the MM Core and drivers.\r
142\r
143 @param CpuDriverEntryPoint Address of MM CPU driver entrypoint\r
144 @param PayloadBootInfo Boot information passed by privileged firmware\r
145\r
146**/\r
147VOID *\r
148EFIAPI\r
149CreateHobListFromBootInfo (\r
150 IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,\r
151 IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo\r
152 );\r
153\r
154\r
155/**\r
156 The entry point of Standalone MM Foundation.\r
157\r
158 @param SharedBufAddress Pointer to the Buffer between SPM and SP.\r
159 @param cookie1.\r
160 @param cookie2.\r
161**/\r
162VOID\r
163EFIAPI\r
164_ModuleEntryPoint (\r
165 IN VOID *SharedBufAddress,\r
166 IN UINT64 SharedBufSize,\r
167 IN UINT64 cookie1,\r
168 IN UINT64 cookie2\r
169 );\r
170\r
171\r
172/**\r
173 Auto generated function that calls the library constructors for all of the module's dependent libraries.\r
174\r
175 This function must be called by _ModuleEntryPoint().\r
176 This function calls the set of library constructors for the set of library instances\r
177 that a module depends on. This includes library instances that a module depends on\r
178 directly and library instances that a module depends on indirectly through other\r
179 libraries. This function is auto generated by build tools and those build tools are\r
180 responsible for collecting the set of library instances, determine which ones have\r
181 constructors, and calling the library constructors in the proper order based upon\r
182 each of the library instances own dependencies.\r
183\r
184 @param ImageHandle The image handle of the DXE Core.\r
185 @param SystemTable A pointer to the EFI System Table.\r
186\r
187**/\r
188VOID\r
189EFIAPI\r
190ProcessLibraryConstructorList (\r
191 IN EFI_HANDLE ImageHandle,\r
192 IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r
193 );\r
194\r
195\r
196/**\r
197 Auto generated function that calls a set of module entry points.\r
198\r
199 This function must be called by _ModuleEntryPoint().\r
200 This function calls the set of module entry points.\r
201 This function is auto generated by build tools and those build tools are responsible\r
202 for collecting the module entry points and calling them in a specified order.\r
203\r
204 @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase.\r
205\r
206**/\r
207VOID\r
208EFIAPI\r
209ProcessModuleEntryPointList (\r
210 IN VOID *HobStart\r
211 );\r
212\r
213#endif\r