]>
Commit | Line | Data |
---|---|---|
615c6dd0 | 1 | /** @file\r |
b1f6a7c6 | 2 | Definition of Pei Core Structures and Services\r |
3 | \r | |
15273993 | 4 | Copyright (c) 2006 - 2008, Intel Corporation\r |
192f6d4c | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
615c6dd0 | 13 | **/\r |
192f6d4c | 14 | \r |
15 | #ifndef _PEI_MAIN_H_\r | |
16 | #define _PEI_MAIN_H_\r | |
17 | \r | |
859b72fa | 18 | #include <PiPei.h>\r |
859b72fa A |
19 | #include <Ppi/DxeIpl.h>\r |
20 | #include <Ppi/MemoryDiscovered.h>\r | |
859b72fa | 21 | #include <Ppi/StatusCode.h>\r |
859b72fa | 22 | #include <Ppi/Reset.h>\r |
b0d803fe | 23 | #include <Ppi/FirmwareVolume.h>\r |
24 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
25 | #include <Ppi/Decompress.h>\r | |
26 | #include <Ppi/GuidedSectionExtraction.h>\r | |
27 | #include <Ppi/LoadFile.h>\r | |
28 | #include <Ppi/Security2.h>\r | |
58dcdada | 29 | #include <Ppi/TemporaryRamSupport.h>\r |
859b72fa A |
30 | #include <Library/DebugLib.h>\r |
31 | #include <Library/PeiCoreEntryPoint.h>\r | |
32 | #include <Library/BaseLib.h>\r | |
33 | #include <Library/HobLib.h>\r | |
34 | #include <Library/PerformanceLib.h>\r | |
35 | #include <Library/PeiServicesLib.h>\r | |
36 | #include <Library/ReportStatusCodeLib.h>\r | |
c58cf83d | 37 | #include <Library/PeCoffLib.h>\r |
859b72fa A |
38 | #include <Library/PeCoffGetEntryPointLib.h>\r |
39 | #include <Library/BaseMemoryLib.h>\r | |
b0d803fe | 40 | #include <Library/CacheMaintenanceLib.h>\r |
859b72fa | 41 | #include <Library/TimerLib.h>\r |
177aabe6 | 42 | #include <Library/PcdLib.h>\r |
28dc3c67 | 43 | #include <IndustryStandard/PeImage.h>\r |
14e8823a | 44 | #include <Library/PeiServicesTablePointerLib.h>\r |
b0d803fe | 45 | #include <Library/MemoryAllocationLib.h>\r |
288f9b38 | 46 | #include <Library/PeiPiLib.h>\r |
b0d803fe | 47 | #include <Guid/FirmwareFileSystem2.h>\r |
48 | #include <Guid/AprioriFileName.h>\r | |
192f6d4c | 49 | \r |
15273993 | 50 | ///\r |
51 | /// It is an FFS type extension used for PeiFindFileEx. It indicates current\r | |
52 | /// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r | |
53 | ///\r | |
3a63377f | 54 | #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r |
55 | \r | |
b1f6a7c6 | 56 | ///\r |
57 | /// Pei Core private data structures\r | |
58 | ///\r | |
192f6d4c | 59 | typedef union {\r |
60 | EFI_PEI_PPI_DESCRIPTOR *Ppi;\r | |
61 | EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r | |
62 | VOID *Raw;\r | |
63 | } PEI_PPI_LIST_POINTERS;\r | |
64 | \r | |
40f26b8f | 65 | ///\r |
1cc76977 | 66 | /// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r |
67 | /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\r | |
40f26b8f | 68 | ///\r |
192f6d4c | 69 | typedef struct {\r |
1cc76977 | 70 | ///\r |
71 | /// index of end of PpiList link list.\r | |
72 | ///\r | |
192f6d4c | 73 | INTN PpiListEnd;\r |
1cc76977 | 74 | ///\r |
75 | /// index of end of notify link list.\r | |
76 | ///\r | |
192f6d4c | 77 | INTN NotifyListEnd;\r |
1cc76977 | 78 | ///\r |
79 | /// index of the dispatched notify list.\r | |
80 | ///\r | |
192f6d4c | 81 | INTN DispatchListEnd;\r |
1cc76977 | 82 | ///\r |
83 | /// index of last installed Ppi description in PpiList link list.\r | |
84 | ///\r | |
192f6d4c | 85 | INTN LastDispatchedInstall;\r |
1cc76977 | 86 | ///\r |
87 | /// index of last dispatched notify in Notify link list.\r | |
88 | /// \r | |
192f6d4c | 89 | INTN LastDispatchedNotify;\r |
1cc76977 | 90 | ///\r |
91 | /// Ppi database.\r | |
92 | ///\r | |
eaf539d0 | 93 | PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r |
192f6d4c | 94 | } PEI_PPI_DATABASE;\r |
95 | \r | |
3a63377f | 96 | \r |
3a63377f | 97 | //\r |
98 | // PEI_CORE_FV_HANDE.PeimState\r | |
99 | // Do not change these values as there is code doing math to change states.\r | |
100 | // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
101 | //\r | |
102 | #define PEIM_STATE_NOT_DISPATCHED 0x00\r | |
103 | #define PEIM_STATE_DISPATCHED 0x01\r | |
104 | #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r | |
105 | #define PEIM_STATE_DONE 0x03\r | |
106 | \r | |
107 | typedef struct {\r | |
108 | EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r | |
50cb16d9 | 109 | UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
177aabe6 | 110 | EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
3a63377f | 111 | BOOLEAN ScanFv;\r |
112 | } PEI_CORE_FV_HANDLE;\r | |
113 | \r | |
288f9b38 LG |
114 | #define CACHE_SETION_MAX_NUMBER 0x10\r |
115 | typedef struct {\r | |
116 | EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r | |
117 | VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r | |
118 | UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r | |
119 | UINTN AllSectionCount;\r | |
120 | UINTN SectionIndex;\r | |
121 | } CACHE_SECTION_DATA;\r | |
122 | \r | |
192f6d4c | 123 | \r |
124 | #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')\r | |
125 | \r | |
40f26b8f | 126 | ///\r |
127 | /// Pei Core private data structure instance\r | |
128 | ///\r | |
192f6d4c | 129 | typedef struct{\r |
130 | UINTN Signature;\r | |
131 | EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow\r | |
132 | PEI_PPI_DATABASE PpiData;\r | |
3a63377f | 133 | UINTN FvCount;\r |
177aabe6 | 134 | PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
135 | EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r | |
3a63377f | 136 | UINTN AprioriCount;\r |
50cb16d9 | 137 | UINTN CurrentPeimFvCount;\r |
3a63377f | 138 | UINTN CurrentPeimCount;\r |
139 | EFI_PEI_FILE_HANDLE CurrentFileHandle;\r | |
140 | UINTN AllFvCount;\r | |
177aabe6 | 141 | EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
192f6d4c | 142 | EFI_PEI_HOB_POINTERS HobList;\r |
143 | BOOLEAN SwitchStackSignal;\r | |
144 | BOOLEAN PeiMemoryInstalled;\r | |
145 | EFI_PHYSICAL_ADDRESS StackBase;\r | |
146 | UINT64 StackSize;\r | |
147 | VOID *BottomOfCarHeap;\r | |
148 | VOID *TopOfCarHeap;\r | |
149 | VOID *CpuIo;\r | |
b0d803fe | 150 | EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r |
192f6d4c | 151 | EFI_PEI_SERVICES ServiceTableShadow;\r |
58dcdada | 152 | UINTN SizeOfTemporaryMemory;\r |
192f6d4c | 153 | UINTN SizeOfCacheAsRam;\r |
154 | VOID *MaxTopOfCarHeap;\r | |
b0d803fe | 155 | EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r |
58dcdada | 156 | EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r |
157 | UINT64 PhysicalMemoryLength;\r | |
158 | EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r | |
159 | VOID* ShadowedPeiCore;\r | |
288f9b38 | 160 | CACHE_SECTION_DATA CacheSection;\r |
192f6d4c | 161 | } PEI_CORE_INSTANCE;\r |
162 | \r | |
40f26b8f | 163 | ///\r |
164 | /// Pei Core Instance Data Macros\r | |
165 | ///\r | |
192f6d4c | 166 | #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r |
167 | CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)\r | |
168 | \r | |
15273993 | 169 | /**\r |
170 | Function Pointer type for PeiCore function.\r | |
171 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r | |
172 | environment, such as the size and location of temporary RAM, the stack location and\r | |
173 | the BFV location.\r | |
174 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
175 | An empty PPI list consists of a single descriptor with the end-tag\r | |
176 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
177 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
178 | that both the PEI Foundation and any modules can leverage the associated service\r | |
179 | calls and/or code in these early PPIs\r | |
180 | @param Data Pointer to old core data that is used to initialize the\r | |
181 | core's data areas.\r | |
182 | **/\r | |
192f6d4c | 183 | typedef\r |
184 | EFI_STATUS\r | |
15273993 | 185 | (EFIAPI *PEICORE_FUNCTION_POINTER)(\r |
b98c2ab7 | 186 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
187 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
188 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
192f6d4c | 189 | );\r |
190 | \r | |
b1f6a7c6 | 191 | ///\r |
192 | /// Union of temporarily used function pointers (to save stack space)\r | |
193 | ///\r | |
192f6d4c | 194 | typedef union {\r |
15273993 | 195 | PEICORE_FUNCTION_POINTER PeiCore;\r |
1c9d209f | 196 | EFI_PEIM_ENTRY_POINT2 PeimEntry;\r |
192f6d4c | 197 | EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r |
198 | EFI_DXE_IPL_PPI *DxeIpl;\r | |
199 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r | |
200 | EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r | |
201 | VOID *Raw;\r | |
202 | } PEI_CORE_TEMP_POINTERS;\r | |
203 | \r | |
b98c2ab7 | 204 | typedef struct {\r |
205 | CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r | |
206 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
207 | VOID *Data;\r | |
208 | } PEI_CORE_PARAMETERS;\r | |
209 | \r | |
192f6d4c | 210 | //\r |
211 | // PeiCore function\r | |
212 | //\r | |
b1f6a7c6 | 213 | /**\r |
192f6d4c | 214 | \r |
215 | The entry routine to Pei Core, invoked by PeiMain during transition\r | |
216 | from SEC to PEI. After switching stack in the PEI core, it will restart\r | |
217 | with the old core data.\r | |
218 | \r | |
192f6d4c | 219 | \r |
b1f6a7c6 | 220 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
221 | environment, such as the size and location of temporary RAM, the stack location and\r | |
222 | the BFV location.\r | |
223 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
224 | An empty PPI list consists of a single descriptor with the end-tag\r | |
225 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
226 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
227 | that both the PEI Foundation and any modules can leverage the associated service\r | |
228 | calls and/or code in these early PPIs\r | |
229 | @param Data Pointer to old core data that is used to initialize the\r | |
192f6d4c | 230 | core's data areas.\r |
231 | \r | |
b1f6a7c6 | 232 | @retval EFI_NOT_FOUND Never reach\r |
192f6d4c | 233 | \r |
b1f6a7c6 | 234 | **/\r |
235 | EFI_STATUS\r | |
236 | EFIAPI\r | |
237 | PeiCore (\r | |
238 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
239 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList,\r | |
240 | IN VOID *Data\r | |
241 | )\r | |
192f6d4c | 242 | ;\r |
243 | \r | |
244 | //\r | |
245 | // Dispatcher support functions\r | |
246 | //\r | |
247 | \r | |
b1f6a7c6 | 248 | /**\r |
192f6d4c | 249 | \r |
250 | This is the POSTFIX version of the dependency evaluator. When a\r | |
251 | PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r | |
252 | the evaluation stack. When that entry is poped from the evaluation\r | |
253 | stack, the PPI is checked if it is installed. This method allows\r | |
254 | some time savings as not all PPIs must be checked for certain\r | |
255 | operation types (AND, OR).\r | |
256 | \r | |
192f6d4c | 257 | \r |
1cc76977 | 258 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 259 | @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r |
260 | the BNF described above and is stored in postfix notation.\r | |
192f6d4c | 261 | \r |
b1f6a7c6 | 262 | @retval TRUE if it is a well-formed Grammar\r |
263 | @retval FALSE if the dependency expression overflows the evaluation stack\r | |
264 | if the dependency expression underflows the evaluation stack\r | |
265 | if the dependency expression is not a well-formed Grammar.\r | |
192f6d4c | 266 | \r |
b1f6a7c6 | 267 | **/\r |
268 | BOOLEAN\r | |
269 | PeimDispatchReadiness (\r | |
270 | IN EFI_PEI_SERVICES **PeiServices,\r | |
271 | IN VOID *DependencyExpression\r | |
272 | )\r | |
192f6d4c | 273 | ;\r |
274 | \r | |
b1f6a7c6 | 275 | /**\r |
276 | Conduct PEIM dispatch.\r | |
277 | \r | |
731bd38e | 278 | @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r |
1cc76977 | 279 | @param PrivateData Pointer to the private data passed in from caller\r |
192f6d4c | 280 | \r |
b1f6a7c6 | 281 | @retval EFI_SUCCESS Successfully dispatched PEIM.\r |
282 | @retval EFI_NOT_FOUND The dispatch failed.\r | |
283 | \r | |
284 | **/\r | |
b0d803fe | 285 | VOID\r |
192f6d4c | 286 | PeiDispatcher (\r |
5aae0aa7 | 287 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
b0d803fe | 288 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 289 | )\r |
b1f6a7c6 | 290 | ;\r |
192f6d4c | 291 | \r |
b1f6a7c6 | 292 | /**\r |
293 | Initialize the Dispatcher's data members\r | |
192f6d4c | 294 | \r |
b1f6a7c6 | 295 | @param PrivateData PeiCore's private data structure\r |
296 | @param OldCoreData Old data from SecCore\r | |
297 | NULL if being run in non-permament memory mode.\r | |
298 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r | |
299 | environment, such as the size and location of temporary RAM, the stack location and\r | |
300 | the BFV location.\r | |
192f6d4c | 301 | \r |
b1f6a7c6 | 302 | **/\r |
192f6d4c | 303 | VOID\r |
304 | InitializeDispatcherData (\r | |
b0d803fe | 305 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 306 | IN PEI_CORE_INSTANCE *OldCoreData,\r |
5aae0aa7 | 307 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r |
192f6d4c | 308 | )\r |
192f6d4c | 309 | ;\r |
310 | \r | |
b1f6a7c6 | 311 | /**\r |
312 | This routine parses the Dependency Expression, if available, and\r | |
313 | decides if the module can be executed.\r | |
192f6d4c | 314 | \r |
192f6d4c | 315 | \r |
b1f6a7c6 | 316 | @param Private PeiCore's private data structure\r |
317 | @param FileHandle PEIM's file handle\r | |
731bd38e | 318 | @param PeimCount The index of last dispatched PEIM.\r |
192f6d4c | 319 | \r |
731bd38e | 320 | @retval TRUE Can be dispatched\r |
321 | @retval FALSE Cannot be dispatched\r | |
192f6d4c | 322 | \r |
b1f6a7c6 | 323 | **/\r |
192f6d4c | 324 | BOOLEAN\r |
325 | DepexSatisfied (\r | |
b0d803fe | 326 | IN PEI_CORE_INSTANCE *Private,\r |
327 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
328 | IN UINTN PeimCount\r | |
192f6d4c | 329 | )\r |
192f6d4c | 330 | ;\r |
331 | \r | |
192f6d4c | 332 | //\r |
333 | // PPI support functions\r | |
334 | //\r | |
b1f6a7c6 | 335 | /**\r |
336 | \r | |
337 | Initialize PPI services.\r | |
338 | \r | |
b1f6a7c6 | 339 | @param PrivateData Pointer to the PEI Core data.\r |
340 | @param OldCoreData Pointer to old PEI Core data. \r | |
341 | NULL if being run in non-permament memory mode.\r | |
342 | \r | |
343 | **/\r | |
192f6d4c | 344 | VOID\r |
345 | InitializePpiServices (\r | |
b0d803fe | 346 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 347 | IN PEI_CORE_INSTANCE *OldCoreData\r |
348 | )\r | |
b1f6a7c6 | 349 | ;\r |
192f6d4c | 350 | \r |
b1f6a7c6 | 351 | /**\r |
192f6d4c | 352 | \r |
731bd38e | 353 | Migrate the Hob list from the CAR stack to PEI installed memory.\r |
354 | \r | |
355 | @param PrivateData Pointer to PeiCore's private data structure.\r | |
356 | @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range\r | |
357 | will be fixup for PpiData and PpiDescriptor pointer.\r | |
358 | @param OldCheckingTop Top of temporary memory range. All Ppi in this range\r | |
359 | will be fixup for PpiData and PpiDescriptor.\r | |
5c5a0601 | 360 | @param Fixup The address difference between\r |
361 | the new Hob list and old Hob list.\r | |
192f6d4c | 362 | \r |
b1f6a7c6 | 363 | **/\r |
192f6d4c | 364 | VOID\r |
365 | ConvertPpiPointers (\r | |
40f26b8f | 366 | IN PEI_CORE_INSTANCE *PrivateData,\r |
367 | IN UINTN OldCheckingBottom,\r | |
368 | IN UINTN OldCheckingTop,\r | |
369 | IN INTN Fixup\r | |
192f6d4c | 370 | )\r |
b1f6a7c6 | 371 | ;\r |
192f6d4c | 372 | \r |
b1f6a7c6 | 373 | /**\r |
192f6d4c | 374 | \r |
731bd38e | 375 | Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r |
192f6d4c | 376 | \r |
15273993 | 377 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
378 | @param PpiList Pointer to ppi array that want to be installed.\r | |
192f6d4c | 379 | \r |
15273993 | 380 | @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r |
381 | @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r | |
731bd38e | 382 | if any PPI in PpiList is not valid\r |
15273993 | 383 | @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r |
192f6d4c | 384 | \r |
b1f6a7c6 | 385 | **/\r |
192f6d4c | 386 | EFI_STATUS\r |
387 | EFIAPI\r | |
388 | PeiInstallPpi (\r | |
0c2b5da8 | 389 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
390 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
192f6d4c | 391 | )\r |
b1f6a7c6 | 392 | ;\r |
192f6d4c | 393 | \r |
b1f6a7c6 | 394 | /**\r |
192f6d4c | 395 | \r |
b1f6a7c6 | 396 | Re-Install PPI services.\r |
192f6d4c | 397 | \r |
1cc76977 | 398 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
399 | @param OldPpi Pointer to the old PEI PPI Descriptors.\r | |
400 | @param NewPpi Pointer to the new PEI PPI Descriptors.\r | |
192f6d4c | 401 | \r |
1cc76977 | 402 | @retval EFI_SUCCESS if the operation was successful\r |
403 | @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r | |
731bd38e | 404 | if NewPpi is not valid\r |
1cc76977 | 405 | @retval EFI_NOT_FOUND if the PPI was not in the database\r |
192f6d4c | 406 | \r |
b1f6a7c6 | 407 | **/\r |
192f6d4c | 408 | EFI_STATUS\r |
409 | EFIAPI\r | |
410 | PeiReInstallPpi (\r | |
0c2b5da8 | 411 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
412 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
413 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
192f6d4c | 414 | )\r |
b1f6a7c6 | 415 | ;\r |
192f6d4c | 416 | \r |
b1f6a7c6 | 417 | /**\r |
192f6d4c | 418 | \r |
b1f6a7c6 | 419 | Locate a given named PPI.\r |
192f6d4c | 420 | \r |
192f6d4c | 421 | \r |
1cc76977 | 422 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
423 | @param Guid Pointer to GUID of the PPI.\r | |
424 | @param Instance Instance Number to discover.\r | |
425 | @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r | |
b1f6a7c6 | 426 | returns a pointer to the descriptor (includes flags, etc)\r |
1cc76977 | 427 | @param Ppi Pointer to reference the found PPI\r |
192f6d4c | 428 | \r |
b1f6a7c6 | 429 | @retval EFI_SUCCESS if the PPI is in the database\r |
430 | @retval EFI_NOT_FOUND if the PPI is not in the database\r | |
192f6d4c | 431 | \r |
b1f6a7c6 | 432 | **/\r |
192f6d4c | 433 | EFI_STATUS\r |
434 | EFIAPI\r | |
435 | PeiLocatePpi (\r | |
1cc76977 | 436 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
437 | IN CONST EFI_GUID *Guid,\r | |
192f6d4c | 438 | IN UINTN Instance,\r |
439 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
440 | IN OUT VOID **Ppi\r | |
441 | )\r | |
b1f6a7c6 | 442 | ;\r |
192f6d4c | 443 | \r |
b1f6a7c6 | 444 | /**\r |
192f6d4c | 445 | \r |
b1f6a7c6 | 446 | Install a notification for a given PPI.\r |
192f6d4c | 447 | \r |
192f6d4c | 448 | \r |
1cc76977 | 449 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
450 | @param NotifyList Pointer to list of Descriptors to notify upon.\r | |
192f6d4c | 451 | \r |
b1f6a7c6 | 452 | @retval EFI_SUCCESS if successful\r |
453 | @retval EFI_OUT_OF_RESOURCES if no space in the database\r | |
454 | @retval EFI_INVALID_PARAMETER if not a good decriptor\r | |
192f6d4c | 455 | \r |
b1f6a7c6 | 456 | **/\r |
192f6d4c | 457 | EFI_STATUS\r |
458 | EFIAPI\r | |
459 | PeiNotifyPpi (\r | |
0c2b5da8 | 460 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
461 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
192f6d4c | 462 | )\r |
b1f6a7c6 | 463 | ;\r |
192f6d4c | 464 | \r |
b1f6a7c6 | 465 | /**\r |
192f6d4c | 466 | \r |
b1f6a7c6 | 467 | Process the Notify List at dispatch level.\r |
192f6d4c | 468 | \r |
b1f6a7c6 | 469 | @param PrivateData PeiCore's private data structure.\r |
192f6d4c | 470 | \r |
b1f6a7c6 | 471 | **/\r |
192f6d4c | 472 | VOID\r |
473 | ProcessNotifyList (\r | |
b0d803fe | 474 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 475 | )\r |
b1f6a7c6 | 476 | ;\r |
192f6d4c | 477 | \r |
b1f6a7c6 | 478 | /**\r |
192f6d4c | 479 | \r |
b1f6a7c6 | 480 | Dispatch notifications.\r |
192f6d4c | 481 | \r |
b1f6a7c6 | 482 | @param PrivateData PeiCore's private data structure\r |
483 | @param NotifyType Type of notify to fire.\r | |
484 | @param InstallStartIndex Install Beginning index.\r | |
485 | @param InstallStopIndex Install Ending index.\r | |
486 | @param NotifyStartIndex Notify Beginning index.\r | |
487 | @param NotifyStopIndex Notify Ending index.\r | |
192f6d4c | 488 | \r |
b1f6a7c6 | 489 | **/\r |
192f6d4c | 490 | VOID\r |
491 | DispatchNotify (\r | |
b0d803fe | 492 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 493 | IN UINTN NotifyType,\r |
494 | IN INTN InstallStartIndex,\r | |
495 | IN INTN InstallStopIndex,\r | |
496 | IN INTN NotifyStartIndex,\r | |
497 | IN INTN NotifyStopIndex\r | |
498 | )\r | |
192f6d4c | 499 | ;\r |
500 | \r | |
501 | //\r | |
502 | // Boot mode support functions\r | |
503 | //\r | |
b1f6a7c6 | 504 | /**\r |
505 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
506 | \r | |
1cc76977 | 507 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 508 | @param BootMode A pointer to contain the value of the boot mode.\r |
509 | \r | |
510 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
511 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
512 | \r | |
513 | **/\r | |
192f6d4c | 514 | EFI_STATUS\r |
515 | EFIAPI\r | |
516 | PeiGetBootMode (\r | |
0c2b5da8 | 517 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 518 | IN OUT EFI_BOOT_MODE *BootMode\r |
519 | )\r | |
b1f6a7c6 | 520 | ;\r |
192f6d4c | 521 | \r |
b1f6a7c6 | 522 | /**\r |
523 | This service enables PEIMs to update the boot mode variable.\r | |
192f6d4c | 524 | \r |
192f6d4c | 525 | \r |
1cc76977 | 526 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
527 | @param BootMode The value of the boot mode to set.\r | |
192f6d4c | 528 | \r |
1cc76977 | 529 | @return EFI_SUCCESS The value was successfully updated\r |
192f6d4c | 530 | \r |
b1f6a7c6 | 531 | **/\r |
192f6d4c | 532 | EFI_STATUS\r |
533 | EFIAPI\r | |
534 | PeiSetBootMode (\r | |
0c2b5da8 | 535 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 536 | IN EFI_BOOT_MODE BootMode\r |
537 | )\r | |
192f6d4c | 538 | ;\r |
539 | \r | |
540 | //\r | |
541 | // Security support functions\r | |
542 | //\r | |
b1f6a7c6 | 543 | /**\r |
544 | \r | |
545 | Initialize the security services.\r | |
546 | \r | |
1cc76977 | 547 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
40f26b8f | 548 | @param OldCoreData Pointer to the old core data.\r |
b1f6a7c6 | 549 | NULL if being run in non-permament memory mode.\r |
550 | \r | |
551 | **/\r | |
192f6d4c | 552 | VOID\r |
553 | InitializeSecurityServices (\r | |
554 | IN EFI_PEI_SERVICES **PeiServices,\r | |
555 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
556 | )\r | |
b1f6a7c6 | 557 | ;\r |
192f6d4c | 558 | \r |
b1f6a7c6 | 559 | /**\r |
560 | Verify a Firmware volume\r | |
192f6d4c | 561 | \r |
40f26b8f | 562 | @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r |
192f6d4c | 563 | \r |
40f26b8f | 564 | @retval EFI_SUCCESS Firmware Volume is legal\r |
565 | @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r | |
192f6d4c | 566 | \r |
b1f6a7c6 | 567 | **/\r |
192f6d4c | 568 | EFI_STATUS\r |
569 | VerifyFv (\r | |
570 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
571 | )\r | |
b1f6a7c6 | 572 | ;\r |
192f6d4c | 573 | \r |
b1f6a7c6 | 574 | /**\r |
192f6d4c | 575 | \r |
b1f6a7c6 | 576 | Provide a callout to the security verification service.\r |
192f6d4c | 577 | \r |
192f6d4c | 578 | \r |
b1f6a7c6 | 579 | @param PrivateData PeiCore's private data structure\r |
580 | @param VolumeHandle Handle of FV\r | |
581 | @param FileHandle Handle of PEIM's ffs\r | |
192f6d4c | 582 | \r |
b1f6a7c6 | 583 | @retval EFI_SUCCESS Image is OK\r |
584 | @retval EFI_SECURITY_VIOLATION Image is illegal\r | |
192f6d4c | 585 | \r |
b1f6a7c6 | 586 | **/\r |
192f6d4c | 587 | EFI_STATUS\r |
588 | VerifyPeim (\r | |
b0d803fe | 589 | IN PEI_CORE_INSTANCE *PrivateData,\r |
590 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
591 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
192f6d4c | 592 | )\r |
b1f6a7c6 | 593 | ;\r |
192f6d4c | 594 | \r |
b1f6a7c6 | 595 | /**\r |
192f6d4c | 596 | \r |
b1f6a7c6 | 597 | Gets the pointer to the HOB List.\r |
192f6d4c | 598 | \r |
192f6d4c | 599 | \r |
1cc76977 | 600 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 601 | @param HobList Pointer to the HOB List.\r |
192f6d4c | 602 | \r |
b1f6a7c6 | 603 | @retval EFI_SUCCESS Get the pointer of HOB List\r |
604 | @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r | |
605 | @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r | |
192f6d4c | 606 | \r |
b1f6a7c6 | 607 | **/\r |
192f6d4c | 608 | EFI_STATUS\r |
609 | EFIAPI\r | |
610 | PeiGetHobList (\r | |
0c2b5da8 | 611 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 612 | IN OUT VOID **HobList\r |
613 | )\r | |
b1f6a7c6 | 614 | ;\r |
192f6d4c | 615 | \r |
b1f6a7c6 | 616 | /**\r |
617 | Add a new HOB to the HOB List.\r | |
192f6d4c | 618 | \r |
1cc76977 | 619 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
620 | @param Type Type of the new HOB.\r | |
621 | @param Length Length of the new HOB to allocate.\r | |
622 | @param Hob Pointer to the new HOB.\r | |
192f6d4c | 623 | \r |
b1f6a7c6 | 624 | @return EFI_SUCCESS Success to create hob.\r |
625 | @retval EFI_INVALID_PARAMETER if Hob is NULL\r | |
626 | @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
627 | @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
192f6d4c | 628 | \r |
b1f6a7c6 | 629 | **/\r |
192f6d4c | 630 | EFI_STATUS\r |
631 | EFIAPI\r | |
632 | PeiCreateHob (\r | |
0c2b5da8 | 633 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 634 | IN UINT16 Type,\r |
635 | IN UINT16 Length,\r | |
636 | IN OUT VOID **Hob\r | |
637 | )\r | |
b1f6a7c6 | 638 | ;\r |
192f6d4c | 639 | \r |
b1f6a7c6 | 640 | /**\r |
192f6d4c | 641 | \r |
b1f6a7c6 | 642 | Builds a Handoff Information Table HOB\r |
192f6d4c | 643 | \r |
b1f6a7c6 | 644 | @param BootMode - Current Bootmode\r |
645 | @param MemoryBegin - Start Memory Address.\r | |
646 | @param MemoryLength - Length of Memory.\r | |
192f6d4c | 647 | \r |
b1f6a7c6 | 648 | @return EFI_SUCCESS Always success to initialize HOB.\r |
192f6d4c | 649 | \r |
b1f6a7c6 | 650 | **/\r |
192f6d4c | 651 | EFI_STATUS\r |
652 | PeiCoreBuildHobHandoffInfoTable (\r | |
653 | IN EFI_BOOT_MODE BootMode,\r | |
654 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
655 | IN UINT64 MemoryLength\r | |
656 | )\r | |
192f6d4c | 657 | ;\r |
658 | \r | |
659 | \r | |
660 | //\r | |
661 | // FFS Fw Volume support functions\r | |
662 | //\r | |
b1f6a7c6 | 663 | /**\r |
664 | Given the input file pointer, search for the next matching file in the\r | |
665 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
666 | the Firmware Volume defined by FwVolHeader.\r | |
667 | \r | |
668 | \r | |
1cc76977 | 669 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 670 | @param SearchType Filter to find only files of this type.\r |
671 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
15273993 | 672 | @param FwVolHeader Pointer to the FV header of the volume to search.\r |
673 | @param FileHeader Pointer to the current file from which to begin searching.\r | |
b1f6a7c6 | 674 | This pointer will be updated upon return to reflect the file found.\r |
675 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r | |
676 | @retval EFI_SUCCESS Success to find next file in given volume\r | |
677 | \r | |
678 | **/\r | |
192f6d4c | 679 | EFI_STATUS\r |
680 | EFIAPI\r | |
681 | PeiFfsFindNextFile (\r | |
0c2b5da8 | 682 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 683 | IN UINT8 SearchType,\r |
0c2b5da8 | 684 | IN EFI_PEI_FV_HANDLE FwVolHeader,\r |
685 | IN OUT EFI_PEI_FILE_HANDLE *FileHeader\r | |
192f6d4c | 686 | )\r |
b1f6a7c6 | 687 | ;\r |
192f6d4c | 688 | \r |
b1f6a7c6 | 689 | /**\r |
690 | Given the input file pointer, search for the next matching section in the\r | |
691 | FFS volume.\r | |
192f6d4c | 692 | \r |
1cc76977 | 693 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 694 | @param SectionType Filter to find only sections of this type.\r |
15273993 | 695 | @param FfsFileHeader Pointer to the current file to search.\r |
b1f6a7c6 | 696 | @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.\r |
697 | NULL if section not found\r | |
192f6d4c | 698 | \r |
b1f6a7c6 | 699 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r |
700 | @retval EFI_SUCCESS Success to find section data in given file\r | |
192f6d4c | 701 | \r |
b1f6a7c6 | 702 | **/\r |
192f6d4c | 703 | EFI_STATUS\r |
704 | EFIAPI\r | |
705 | PeiFfsFindSectionData (\r | |
b0d803fe | 706 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 707 | IN EFI_SECTION_TYPE SectionType,\r |
0c2b5da8 | 708 | IN EFI_PEI_FILE_HANDLE FfsFileHeader,\r |
192f6d4c | 709 | IN OUT VOID **SectionData\r |
710 | )\r | |
b1f6a7c6 | 711 | ;\r |
192f6d4c | 712 | \r |
b1f6a7c6 | 713 | /**\r |
714 | search the firmware volumes by index\r | |
192f6d4c | 715 | \r |
15273993 | 716 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
717 | @param Instance Instance of FV to find\r | |
718 | @param FwVolHeader Pointer to found Volume.\r | |
192f6d4c | 719 | \r |
15273993 | 720 | @retval EFI_INVALID_PARAMETER FwVolHeader is NULL\r |
721 | @retval EFI_SUCCESS Firmware volume instance successfully found.\r | |
192f6d4c | 722 | \r |
b1f6a7c6 | 723 | **/\r |
192f6d4c | 724 | EFI_STATUS\r |
725 | EFIAPI\r | |
726 | PeiFvFindNextVolume (\r | |
15273993 | 727 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 728 | IN UINTN Instance,\r |
0c2b5da8 | 729 | IN OUT EFI_PEI_FV_HANDLE *FwVolHeader\r |
192f6d4c | 730 | )\r |
192f6d4c | 731 | ;\r |
732 | \r | |
733 | //\r | |
734 | // Memory support functions\r | |
735 | //\r | |
b1f6a7c6 | 736 | /**\r |
737 | \r | |
738 | Initialize the memory services.\r | |
739 | \r | |
1cc76977 | 740 | @param PrivateData PeiCore's private data structure\r |
b1f6a7c6 | 741 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
742 | environment, such as the size and location of temporary RAM, the stack location and\r | |
743 | the BFV location.\r | |
744 | @param OldCoreData Pointer to the PEI Core data.\r | |
745 | NULL if being run in non-permament memory mode.\r | |
746 | \r | |
747 | **/\r | |
192f6d4c | 748 | VOID\r |
749 | InitializeMemoryServices (\r | |
b0d803fe | 750 | IN PEI_CORE_INSTANCE *PrivateData,\r |
5aae0aa7 | 751 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
192f6d4c | 752 | IN PEI_CORE_INSTANCE *OldCoreData\r |
753 | )\r | |
b1f6a7c6 | 754 | ;\r |
192f6d4c | 755 | \r |
b1f6a7c6 | 756 | /**\r |
192f6d4c | 757 | \r |
b1f6a7c6 | 758 | Install the permanent memory is now available.\r |
759 | Creates HOB (PHIT and Stack).\r | |
192f6d4c | 760 | \r |
1cc76977 | 761 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
762 | @param MemoryBegin Start of memory address.\r | |
763 | @param MemoryLength Length of memory.\r | |
192f6d4c | 764 | \r |
b1f6a7c6 | 765 | @return EFI_SUCCESS Always success.\r |
192f6d4c | 766 | \r |
b1f6a7c6 | 767 | **/\r |
192f6d4c | 768 | EFI_STATUS\r |
769 | EFIAPI\r | |
770 | PeiInstallPeiMemory (\r | |
0c2b5da8 | 771 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 772 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r |
773 | IN UINT64 MemoryLength\r | |
774 | )\r | |
b1f6a7c6 | 775 | ;\r |
192f6d4c | 776 | \r |
b1f6a7c6 | 777 | /**\r |
192f6d4c | 778 | \r |
b1f6a7c6 | 779 | Memory allocation service on permanent memory,\r |
780 | not usable prior to the memory installation.\r | |
192f6d4c | 781 | \r |
192f6d4c | 782 | \r |
1cc76977 | 783 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
784 | @param MemoryType Type of memory to allocate.\r | |
785 | @param Pages Number of pages to allocate.\r | |
786 | @param Memory Pointer of memory allocated.\r | |
192f6d4c | 787 | \r |
b1f6a7c6 | 788 | @retval EFI_SUCCESS The allocation was successful\r |
789 | @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r | |
790 | @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r | |
791 | @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r | |
792 | to allocate the number of pages.\r | |
192f6d4c | 793 | \r |
b1f6a7c6 | 794 | **/\r |
192f6d4c | 795 | EFI_STATUS\r |
796 | EFIAPI\r | |
797 | PeiAllocatePages (\r | |
0c2b5da8 | 798 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 799 | IN EFI_MEMORY_TYPE MemoryType,\r |
800 | IN UINTN Pages,\r | |
801 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
802 | )\r | |
b1f6a7c6 | 803 | ;\r |
192f6d4c | 804 | \r |
b1f6a7c6 | 805 | /**\r |
192f6d4c | 806 | \r |
b1f6a7c6 | 807 | Memory allocation service on the CAR.\r |
192f6d4c | 808 | \r |
192f6d4c | 809 | \r |
1cc76977 | 810 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
811 | @param Size Amount of memory required\r | |
812 | @param Buffer Address of pointer to the buffer\r | |
192f6d4c | 813 | \r |
b1f6a7c6 | 814 | @retval EFI_SUCCESS The allocation was successful\r |
815 | @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
816 | to allocate the requested size.\r | |
192f6d4c | 817 | \r |
b1f6a7c6 | 818 | **/\r |
192f6d4c | 819 | EFI_STATUS\r |
820 | EFIAPI\r | |
821 | PeiAllocatePool (\r | |
0c2b5da8 | 822 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 823 | IN UINTN Size,\r |
824 | OUT VOID **Buffer\r | |
825 | )\r | |
b1f6a7c6 | 826 | ;\r |
192f6d4c | 827 | \r |
b1f6a7c6 | 828 | /**\r |
192f6d4c | 829 | \r |
b1f6a7c6 | 830 | Routine for load image file.\r |
192f6d4c | 831 | \r |
192f6d4c | 832 | \r |
1cc76977 | 833 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
834 | @param FileHandle Pointer to the FFS file header of the image.\r | |
835 | @param EntryPoint Pointer to entry point of specified image file for output.\r | |
836 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
192f6d4c | 837 | \r |
1cc76977 | 838 | @retval EFI_SUCCESS Image is successfully loaded.\r |
839 | @retval EFI_NOT_FOUND Fail to locate necessary PPI\r | |
840 | @retval Others Fail to load file.\r | |
192f6d4c | 841 | \r |
b1f6a7c6 | 842 | **/\r |
192f6d4c | 843 | EFI_STATUS\r |
844 | PeiLoadImage (\r | |
845 | IN EFI_PEI_SERVICES **PeiServices,\r | |
b0d803fe | 846 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
847 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
848 | OUT UINT32 *AuthenticationState\r | |
192f6d4c | 849 | )\r |
b1f6a7c6 | 850 | ;\r |
192f6d4c | 851 | \r |
b1f6a7c6 | 852 | /**\r |
192f6d4c | 853 | \r |
b1f6a7c6 | 854 | Core version of the Status Code reporter\r |
192f6d4c | 855 | \r |
192f6d4c | 856 | \r |
1cc76977 | 857 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
858 | @param CodeType Type of Status Code.\r | |
859 | @param Value Value to output for Status Code.\r | |
860 | @param Instance Instance Number of this status code.\r | |
861 | @param CallerId ID of the caller of this status code.\r | |
862 | @param Data Optional data associated with this status code.\r | |
192f6d4c | 863 | \r |
b1f6a7c6 | 864 | @retval EFI_SUCCESS if status code is successfully reported\r |
865 | @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
192f6d4c | 866 | \r |
b1f6a7c6 | 867 | **/\r |
192f6d4c | 868 | EFI_STATUS\r |
869 | EFIAPI\r | |
870 | PeiReportStatusCode (\r | |
0c2b5da8 | 871 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 872 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
873 | IN EFI_STATUS_CODE_VALUE Value,\r | |
874 | IN UINT32 Instance,\r | |
0c2b5da8 | 875 | IN CONST EFI_GUID *CallerId,\r |
876 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
192f6d4c | 877 | )\r |
b1f6a7c6 | 878 | ;\r |
192f6d4c | 879 | \r |
b1f6a7c6 | 880 | /**\r |
192f6d4c | 881 | \r |
b1f6a7c6 | 882 | Core version of the Reset System\r |
192f6d4c | 883 | \r |
192f6d4c | 884 | \r |
1cc76977 | 885 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
192f6d4c | 886 | \r |
b1f6a7c6 | 887 | @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r |
888 | @retval EFI_DEVICE_ERROR Did not reset system.\r | |
889 | Otherwise, resets the system.\r | |
192f6d4c | 890 | \r |
b1f6a7c6 | 891 | **/\r |
192f6d4c | 892 | EFI_STATUS\r |
893 | EFIAPI\r | |
894 | PeiResetSystem (\r | |
b0d803fe | 895 | IN CONST EFI_PEI_SERVICES **PeiServices\r |
192f6d4c | 896 | )\r |
b1f6a7c6 | 897 | ;\r |
192f6d4c | 898 | \r |
b1f6a7c6 | 899 | /**\r |
192f6d4c | 900 | \r |
b1f6a7c6 | 901 | Initialize PeiCore Fv List.\r |
192f6d4c | 902 | \r |
192f6d4c | 903 | \r |
b1f6a7c6 | 904 | @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r |
905 | @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
192f6d4c | 906 | \r |
b1f6a7c6 | 907 | **/\r |
50cb16d9 | 908 | VOID\r |
b0d803fe | 909 | PeiInitializeFv (\r |
910 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
911 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
912 | )\r | |
b1f6a7c6 | 913 | ;\r |
b0d803fe | 914 | \r |
b1f6a7c6 | 915 | /**\r |
916 | Process Firmware Volum Information once FvInfoPPI install.\r | |
b0d803fe | 917 | \r |
1cc76977 | 918 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
919 | @param NotifyDescriptor Address of the notification descriptor data structure.\r | |
920 | @param Ppi Address of the PPI that was installed.\r | |
50cb16d9 | 921 | \r |
b1f6a7c6 | 922 | @retval EFI_SUCCESS if the interface could be successfully installed\r |
b0d803fe | 923 | \r |
b1f6a7c6 | 924 | **/\r |
b0d803fe | 925 | EFI_STATUS\r |
926 | EFIAPI\r | |
927 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
928 | IN EFI_PEI_SERVICES **PeiServices,\r | |
929 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
930 | IN VOID *Ppi\r | |
931 | )\r | |
b1f6a7c6 | 932 | ;\r |
b0d803fe | 933 | \r |
b1f6a7c6 | 934 | /**\r |
50cb16d9 | 935 | \r |
b1f6a7c6 | 936 | Given the input VolumeHandle, search for the next matching name file.\r |
b0d803fe | 937 | \r |
1cc76977 | 938 | @param FileName File name to search.\r |
939 | @param VolumeHandle The current FV to search.\r | |
940 | @param FileHandle Pointer to the file matching name in VolumeHandle.\r | |
941 | NULL if file not found\r | |
b0d803fe | 942 | \r |
15273993 | 943 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r |
944 | @retval EFI_SUCCESS Success to search given file\r | |
b0d803fe | 945 | \r |
b1f6a7c6 | 946 | **/\r |
b0d803fe | 947 | EFI_STATUS\r |
50cb16d9 | 948 | EFIAPI\r |
b0d803fe | 949 | PeiFfsFindFileByName (\r |
950 | IN CONST EFI_GUID *FileName,\r | |
951 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
952 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
953 | )\r | |
b1f6a7c6 | 954 | ;\r |
b0d803fe | 955 | \r |
b1f6a7c6 | 956 | /**\r |
b0d803fe | 957 | \r |
b1f6a7c6 | 958 | Returns information about a specific file.\r |
b0d803fe | 959 | \r |
b0d803fe | 960 | \r |
1cc76977 | 961 | @param FileHandle The handle to file.\r |
962 | @param FileInfo Pointer to the file information.\r | |
b0d803fe | 963 | \r |
b1f6a7c6 | 964 | @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.\r |
965 | @retval EFI_SUCCESS Success to collect file info.\r | |
b0d803fe | 966 | \r |
b1f6a7c6 | 967 | **/\r |
b0d803fe | 968 | EFI_STATUS\r |
50cb16d9 | 969 | EFIAPI\r |
b0d803fe | 970 | PeiFfsGetFileInfo (\r |
971 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
972 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
973 | )\r | |
b1f6a7c6 | 974 | ;\r |
b0d803fe | 975 | \r |
b1f6a7c6 | 976 | /**\r |
b0d803fe | 977 | \r |
b1f6a7c6 | 978 | Collect information of given Fv Volume.\r |
b0d803fe | 979 | \r |
1cc76977 | 980 | @param VolumeHandle The handle to Fv Volume.\r |
981 | @param VolumeInfo The pointer to volume information.\r | |
b0d803fe | 982 | \r |
b1f6a7c6 | 983 | @retval EFI_INVALID_PARAMETER VolumeInfo is NULL\r |
984 | @retval EFI_SUCCESS Success to collect fv info.\r | |
985 | **/\r | |
b0d803fe | 986 | EFI_STATUS\r |
50cb16d9 | 987 | EFIAPI\r |
b0d803fe | 988 | PeiFfsGetVolumeInfo (\r |
989 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
990 | OUT EFI_FV_INFO *VolumeInfo\r | |
991 | )\r | |
b0d803fe | 992 | ;\r |
993 | \r | |
14e8823a | 994 | /**\r |
995 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
996 | discovery permanent memory.\r | |
997 | \r | |
b1f6a7c6 | 998 | @param FileHandle File handle of a PEIM.\r |
50cb16d9 | 999 | \r |
b1f6a7c6 | 1000 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
1001 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1002 | @retval EFI_SUCCESS Successfully to register itself.\r | |
14e8823a | 1003 | \r |
50cb16d9 | 1004 | **/\r |
14e8823a | 1005 | EFI_STATUS\r |
1006 | EFIAPI\r | |
1007 | PeiRegisterForShadow (\r | |
1008 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1009 | )\r | |
1010 | ;\r | |
1011 | \r | |
b1f6a7c6 | 1012 | /**\r |
1013 | Given the input file pointer, search for the next matching file in the\r | |
1014 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
1015 | the Firmware Volume defined by FwVolHeader.\r | |
1016 | \r | |
1017 | \r | |
1018 | @param FvHandle Pointer to the FV header of the volume to search\r | |
1019 | @param FileName File name\r | |
1020 | @param SearchType Filter to find only files of this type.\r | |
1021 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
1022 | @param FileHandle This parameter must point to a valid FFS volume.\r | |
1023 | @param AprioriFile Pointer to AprioriFile image in this FV if has\r | |
1024 | \r | |
1025 | @return EFI_NOT_FOUND No files matching the search criteria were found\r | |
1026 | @retval EFI_SUCCESS Success to search given file\r | |
1027 | \r | |
1028 | **/\r | |
b0d803fe | 1029 | EFI_STATUS\r |
1030 | PeiFindFileEx (\r | |
1031 | IN CONST EFI_PEI_FV_HANDLE FvHandle,\r | |
1032 | IN CONST EFI_GUID *FileName, OPTIONAL\r | |
1033 | IN EFI_FV_FILETYPE SearchType,\r | |
1034 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r | |
1035 | IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r | |
1036 | )\r | |
b0d803fe | 1037 | ;\r |
1038 | \r | |
b1f6a7c6 | 1039 | /**\r |
15273993 | 1040 | Initialize image service that install PeiLoadFilePpi.\r |
b0d803fe | 1041 | \r |
15273993 | 1042 | @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r |
1043 | @param OldCoreData Pointer to Old PeiCore's private data.\r | |
1044 | If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r | |
1045 | If not NULL, PeiCore is entered at second time, stack/heap has been moved\r | |
1046 | to permenent memory.\r | |
b0d803fe | 1047 | \r |
b1f6a7c6 | 1048 | **/\r |
1049 | VOID\r | |
1050 | InitializeImageServices (\r | |
1051 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1052 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
1053 | )\r | |
b0d803fe | 1054 | ;\r |
1055 | \r | |
288f9b38 LG |
1056 | /**\r |
1057 | Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r | |
1058 | \r | |
1cc76977 | 1059 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 1060 | @param FileHandle File handle of a Fv type file.\r |
288f9b38 | 1061 | @param AuthenticationState Pointer to attestation authentication state of image.\r |
731bd38e | 1062 | If return 0, means pass security checking.\r |
50cb16d9 | 1063 | \r |
b1f6a7c6 | 1064 | @retval EFI_NOT_FOUND FV image can't be found.\r |
1065 | @retval EFI_SUCCESS Successfully to process it.\r | |
288f9b38 LG |
1066 | \r |
1067 | **/\r | |
1068 | EFI_STATUS\r | |
1069 | ProcessFvFile (\r | |
1070 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1071 | IN EFI_PEI_FILE_HANDLE FvFileHandle,\r | |
1072 | OUT UINT32 *AuthenticationState\r | |
1073 | );\r | |
1074 | \r | |
192f6d4c | 1075 | #endif\r |