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