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