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