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