]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Definition of Pei Core Structures and Services\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | 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 | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _PEI_MAIN_H_\r | |
16 | #define _PEI_MAIN_H_\r | |
17 | \r | |
18 | #include <PiPei.h>\r | |
19 | #include <Ppi/DxeIpl.h>\r | |
20 | #include <Ppi/MemoryDiscovered.h>\r | |
21 | #include <Ppi/StatusCode.h>\r | |
22 | #include <Ppi/Reset.h>\r | |
23 | #include <Ppi/Reset2.h>\r | |
24 | #include <Ppi/FirmwareVolume.h>\r | |
25 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
26 | #include <Ppi/FirmwareVolumeInfo2.h>\r | |
27 | #include <Ppi/Decompress.h>\r | |
28 | #include <Ppi/GuidedSectionExtraction.h>\r | |
29 | #include <Ppi/LoadFile.h>\r | |
30 | #include <Ppi/Security2.h>\r | |
31 | #include <Ppi/TemporaryRamSupport.h>\r | |
32 | #include <Ppi/TemporaryRamDone.h>\r | |
33 | #include <Ppi/SecHobData.h>\r | |
34 | #include <Ppi/PeiCoreFvLocation.h>\r | |
35 | #include <Library/DebugLib.h>\r | |
36 | #include <Library/PeiCoreEntryPoint.h>\r | |
37 | #include <Library/BaseLib.h>\r | |
38 | #include <Library/HobLib.h>\r | |
39 | #include <Library/PerformanceLib.h>\r | |
40 | #include <Library/PeiServicesLib.h>\r | |
41 | #include <Library/ReportStatusCodeLib.h>\r | |
42 | #include <Library/PeCoffLib.h>\r | |
43 | #include <Library/PeCoffGetEntryPointLib.h>\r | |
44 | #include <Library/BaseMemoryLib.h>\r | |
45 | #include <Library/CacheMaintenanceLib.h>\r | |
46 | #include <Library/PcdLib.h>\r | |
47 | #include <IndustryStandard/PeImage.h>\r | |
48 | #include <Library/PeiServicesTablePointerLib.h>\r | |
49 | #include <Library/MemoryAllocationLib.h>\r | |
50 | #include <Guid/FirmwareFileSystem2.h>\r | |
51 | #include <Guid/FirmwareFileSystem3.h>\r | |
52 | #include <Guid/AprioriFileName.h>\r | |
53 | \r | |
54 | ///\r | |
55 | /// It is an FFS type extension used for PeiFindFileEx. It indicates current\r | |
56 | /// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r | |
57 | ///\r | |
58 | #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r | |
59 | \r | |
60 | ///\r | |
61 | /// Pei Core private data structures\r | |
62 | ///\r | |
63 | typedef union {\r | |
64 | EFI_PEI_PPI_DESCRIPTOR *Ppi;\r | |
65 | EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r | |
66 | VOID *Raw;\r | |
67 | } PEI_PPI_LIST_POINTERS;\r | |
68 | \r | |
69 | ///\r | |
70 | /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room\r | |
71 | ///\r | |
72 | #define PPI_GROWTH_STEP 64\r | |
73 | #define CALLBACK_NOTIFY_GROWTH_STEP 32\r | |
74 | #define DISPATCH_NOTIFY_GROWTH_STEP 8\r | |
75 | \r | |
76 | typedef struct {\r | |
77 | UINTN CurrentCount;\r | |
78 | UINTN MaxCount;\r | |
79 | UINTN LastDispatchedCount;\r | |
80 | ///\r | |
81 | /// MaxCount number of entries.\r | |
82 | ///\r | |
83 | PEI_PPI_LIST_POINTERS *PpiPtrs;\r | |
84 | } PEI_PPI_LIST;\r | |
85 | \r | |
86 | typedef struct {\r | |
87 | UINTN CurrentCount;\r | |
88 | UINTN MaxCount;\r | |
89 | ///\r | |
90 | /// MaxCount number of entries.\r | |
91 | ///\r | |
92 | PEI_PPI_LIST_POINTERS *NotifyPtrs;\r | |
93 | } PEI_CALLBACK_NOTIFY_LIST;\r | |
94 | \r | |
95 | typedef struct {\r | |
96 | UINTN CurrentCount;\r | |
97 | UINTN MaxCount;\r | |
98 | UINTN LastDispatchedCount;\r | |
99 | ///\r | |
100 | /// MaxCount number of entries.\r | |
101 | ///\r | |
102 | PEI_PPI_LIST_POINTERS *NotifyPtrs;\r | |
103 | } PEI_DISPATCH_NOTIFY_LIST;\r | |
104 | \r | |
105 | ///\r | |
106 | /// PPI database structure which contains three links:\r | |
107 | /// PpiList, CallbackNotifyList and DispatchNotifyList.\r | |
108 | ///\r | |
109 | typedef struct {\r | |
110 | ///\r | |
111 | /// PPI List.\r | |
112 | ///\r | |
113 | PEI_PPI_LIST PpiList;\r | |
114 | ///\r | |
115 | /// Notify List at dispatch level.\r | |
116 | ///\r | |
117 | PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList;\r | |
118 | ///\r | |
119 | /// Notify List at callback level.\r | |
120 | ///\r | |
121 | PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList;\r | |
122 | } PEI_PPI_DATABASE;\r | |
123 | \r | |
124 | //\r | |
125 | // PEI_CORE_FV_HANDE.PeimState\r | |
126 | // Do not change these values as there is code doing math to change states.\r | |
127 | // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
128 | //\r | |
129 | #define PEIM_STATE_NOT_DISPATCHED 0x00\r | |
130 | #define PEIM_STATE_DISPATCHED 0x01\r | |
131 | #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02\r | |
132 | #define PEIM_STATE_DONE 0x03\r | |
133 | \r | |
134 | //\r | |
135 | // Number of FV instances to grow by each time we run out of room\r | |
136 | //\r | |
137 | #define FV_GROWTH_STEP 8\r | |
138 | \r | |
139 | typedef struct {\r | |
140 | EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r | |
141 | EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;\r | |
142 | EFI_PEI_FV_HANDLE FvHandle;\r | |
143 | UINTN PeimCount;\r | |
144 | //\r | |
145 | // Ponter to the buffer with the PeimCount number of Entries.\r | |
146 | //\r | |
147 | UINT8 *PeimState;\r | |
148 | //\r | |
149 | // Ponter to the buffer with the PeimCount number of Entries.\r | |
150 | //\r | |
151 | EFI_PEI_FILE_HANDLE *FvFileHandles;\r | |
152 | BOOLEAN ScanFv;\r | |
153 | UINT32 AuthenticationStatus;\r | |
154 | } PEI_CORE_FV_HANDLE;\r | |
155 | \r | |
156 | typedef struct {\r | |
157 | EFI_GUID FvFormat;\r | |
158 | VOID *FvInfo;\r | |
159 | UINT32 FvInfoSize;\r | |
160 | UINT32 AuthenticationStatus;\r | |
161 | EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;\r | |
162 | } PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r | |
163 | \r | |
164 | #define CACHE_SETION_MAX_NUMBER 0x10\r | |
165 | typedef struct {\r | |
166 | EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r | |
167 | VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r | |
168 | UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r | |
169 | UINT32 AuthenticationStatus[CACHE_SETION_MAX_NUMBER];\r | |
170 | UINTN AllSectionCount;\r | |
171 | UINTN SectionIndex;\r | |
172 | } CACHE_SECTION_DATA;\r | |
173 | \r | |
174 | #define HOLE_MAX_NUMBER 0x3\r | |
175 | typedef struct {\r | |
176 | EFI_PHYSICAL_ADDRESS Base;\r | |
177 | UINTN Size;\r | |
178 | UINTN Offset;\r | |
179 | BOOLEAN OffsetPositive;\r | |
180 | } HOLE_MEMORY_DATA;\r | |
181 | \r | |
182 | ///\r | |
183 | /// Forward declaration for PEI_CORE_INSTANCE\r | |
184 | ///\r | |
185 | typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r | |
186 | \r | |
187 | \r | |
188 | /**\r | |
189 | Function Pointer type for PeiCore function.\r | |
190 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r | |
191 | and location of temporary RAM, the stack location and the BFV location.\r | |
192 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
193 | An empty PPI list consists of a single descriptor with the end-tag\r | |
194 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
195 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
196 | that both the PEI Foundation and any modules can leverage the associated service\r | |
197 | calls and/or code in these early PPIs\r | |
198 | @param OldCoreData Pointer to old core data that is used to initialize the\r | |
199 | core's data areas.\r | |
200 | **/\r | |
201 | typedef\r | |
202 | EFI_STATUS\r | |
203 | (EFIAPI *PEICORE_FUNCTION_POINTER)(\r | |
204 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
205 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
206 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
207 | );\r | |
208 | \r | |
209 | //\r | |
210 | // Number of files to grow by each time we run out of room\r | |
211 | //\r | |
212 | #define TEMP_FILE_GROWTH_STEP 32\r | |
213 | \r | |
214 | #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r | |
215 | \r | |
216 | ///\r | |
217 | /// Pei Core private data structure instance\r | |
218 | ///\r | |
219 | struct _PEI_CORE_INSTANCE {\r | |
220 | UINTN Signature;\r | |
221 | \r | |
222 | ///\r | |
223 | /// Point to ServiceTableShadow\r | |
224 | ///\r | |
225 | EFI_PEI_SERVICES *Ps;\r | |
226 | PEI_PPI_DATABASE PpiData;\r | |
227 | \r | |
228 | ///\r | |
229 | /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r | |
230 | ///\r | |
231 | UINTN FvCount;\r | |
232 | \r | |
233 | ///\r | |
234 | /// The max count of FVs which contains FFS and could be dispatched by PeiCore.\r | |
235 | ///\r | |
236 | UINTN MaxFvCount;\r | |
237 | \r | |
238 | ///\r | |
239 | /// Pointer to the buffer with the MaxFvCount number of entries.\r | |
240 | /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.\r | |
241 | ///\r | |
242 | PEI_CORE_FV_HANDLE *Fv;\r | |
243 | \r | |
244 | ///\r | |
245 | /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.\r | |
246 | /// Each entry is for one FV which could not be dispatched by PeiCore.\r | |
247 | ///\r | |
248 | PEI_CORE_UNKNOW_FORMAT_FV_INFO *UnknownFvInfo;\r | |
249 | UINTN MaxUnknownFvInfoCount;\r | |
250 | UINTN UnknownFvInfoCount;\r | |
251 | \r | |
252 | ///\r | |
253 | /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.\r | |
254 | ///\r | |
255 | EFI_PEI_FILE_HANDLE *CurrentFvFileHandles;\r | |
256 | UINTN AprioriCount;\r | |
257 | UINTN CurrentPeimFvCount;\r | |
258 | UINTN CurrentPeimCount;\r | |
259 | EFI_PEI_FILE_HANDLE CurrentFileHandle;\r | |
260 | BOOLEAN PeimNeedingDispatch;\r | |
261 | BOOLEAN PeimDispatchOnThisPass;\r | |
262 | BOOLEAN PeimDispatcherReenter;\r | |
263 | EFI_PEI_HOB_POINTERS HobList;\r | |
264 | BOOLEAN SwitchStackSignal;\r | |
265 | BOOLEAN PeiMemoryInstalled;\r | |
266 | VOID *CpuIo;\r | |
267 | EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r | |
268 | EFI_PEI_SERVICES ServiceTableShadow;\r | |
269 | EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r | |
270 | EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r | |
271 | UINT64 PhysicalMemoryLength;\r | |
272 | EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r | |
273 | UINTN HeapOffset;\r | |
274 | BOOLEAN HeapOffsetPositive;\r | |
275 | UINTN StackOffset;\r | |
276 | BOOLEAN StackOffsetPositive;\r | |
277 | //\r | |
278 | // Information for migrating memory pages allocated in pre-memory phase.\r | |
279 | //\r | |
280 | HOLE_MEMORY_DATA MemoryPages;\r | |
281 | PEICORE_FUNCTION_POINTER ShadowedPeiCore;\r | |
282 | CACHE_SECTION_DATA CacheSection;\r | |
283 | //\r | |
284 | // For Loading modules at fixed address feature to cache the top address below which the\r | |
285 | // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field\r | |
286 | // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.\r | |
287 | //\r | |
288 | EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;\r | |
289 | //\r | |
290 | // The field is define for Loading modules at fixed address feature to tracker the PEI code\r | |
291 | // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page\r | |
292 | // available or not.\r | |
293 | //\r | |
294 | UINT64 *PeiCodeMemoryRangeUsageBitMap;\r | |
295 | //\r | |
296 | // This field points to the shadowed image read function\r | |
297 | //\r | |
298 | PE_COFF_LOADER_READ_FILE ShadowedImageRead;\r | |
299 | \r | |
300 | UINTN TempPeimCount;\r | |
301 | \r | |
302 | //\r | |
303 | // Pointer to the temp buffer with the TempPeimCount number of entries.\r | |
304 | //\r | |
305 | EFI_PEI_FILE_HANDLE *TempFileHandles;\r | |
306 | //\r | |
307 | // Pointer to the temp buffer with the TempPeimCount number of entries.\r | |
308 | //\r | |
309 | EFI_GUID *TempFileGuid;\r | |
310 | \r | |
311 | //\r | |
312 | // Temp Memory Range is not covered by PeiTempMem and Stack.\r | |
313 | // Those Memory Range will be migrated into physical memory.\r | |
314 | //\r | |
315 | HOLE_MEMORY_DATA HoleData[HOLE_MAX_NUMBER];\r | |
316 | };\r | |
317 | \r | |
318 | ///\r | |
319 | /// Pei Core Instance Data Macros\r | |
320 | ///\r | |
321 | #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r | |
322 | CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r | |
323 | \r | |
324 | ///\r | |
325 | /// Union of temporarily used function pointers (to save stack space)\r | |
326 | ///\r | |
327 | typedef union {\r | |
328 | PEICORE_FUNCTION_POINTER PeiCore;\r | |
329 | EFI_PEIM_ENTRY_POINT2 PeimEntry;\r | |
330 | EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r | |
331 | EFI_DXE_IPL_PPI *DxeIpl;\r | |
332 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r | |
333 | EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r | |
334 | VOID *Raw;\r | |
335 | } PEI_CORE_TEMP_POINTERS;\r | |
336 | \r | |
337 | typedef struct {\r | |
338 | CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r | |
339 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
340 | VOID *Data;\r | |
341 | } PEI_CORE_PARAMETERS;\r | |
342 | \r | |
343 | //\r | |
344 | // PeiCore function\r | |
345 | //\r | |
346 | /**\r | |
347 | \r | |
348 | The entry routine to Pei Core, invoked by PeiMain during transition\r | |
349 | from SEC to PEI. After switching stack in the PEI core, it will restart\r | |
350 | with the old core data.\r | |
351 | \r | |
352 | \r | |
353 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r | |
354 | and location of temporary RAM, the stack location and the BFV location.\r | |
355 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
356 | An empty PPI list consists of a single descriptor with the end-tag\r | |
357 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
358 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
359 | that both the PEI Foundation and any modules can leverage the associated service\r | |
360 | calls and/or code in these early PPIs\r | |
361 | @param Data Pointer to old core data that is used to initialize the\r | |
362 | core's data areas.\r | |
363 | \r | |
364 | **/\r | |
365 | VOID\r | |
366 | EFIAPI\r | |
367 | PeiCore (\r | |
368 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
369 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
370 | IN VOID *Data\r | |
371 | );\r | |
372 | \r | |
373 | //\r | |
374 | // Dispatcher support functions\r | |
375 | //\r | |
376 | \r | |
377 | /**\r | |
378 | \r | |
379 | This is the POSTFIX version of the dependency evaluator. When a\r | |
380 | PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r | |
381 | the evaluation stack. When that entry is poped from the evaluation\r | |
382 | stack, the PPI is checked if it is installed. This method allows\r | |
383 | some time savings as not all PPIs must be checked for certain\r | |
384 | operation types (AND, OR).\r | |
385 | \r | |
386 | \r | |
387 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
388 | @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r | |
389 | the BNF described above and is stored in postfix notation.\r | |
390 | \r | |
391 | @retval TRUE if it is a well-formed Grammar\r | |
392 | @retval FALSE if the dependency expression overflows the evaluation stack\r | |
393 | if the dependency expression underflows the evaluation stack\r | |
394 | if the dependency expression is not a well-formed Grammar.\r | |
395 | \r | |
396 | **/\r | |
397 | BOOLEAN\r | |
398 | PeimDispatchReadiness (\r | |
399 | IN EFI_PEI_SERVICES **PeiServices,\r | |
400 | IN VOID *DependencyExpression\r | |
401 | );\r | |
402 | \r | |
403 | /**\r | |
404 | Conduct PEIM dispatch.\r | |
405 | \r | |
406 | @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r | |
407 | @param PrivateData Pointer to the private data passed in from caller\r | |
408 | \r | |
409 | **/\r | |
410 | VOID\r | |
411 | PeiDispatcher (\r | |
412 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
413 | IN PEI_CORE_INSTANCE *PrivateData\r | |
414 | );\r | |
415 | \r | |
416 | /**\r | |
417 | Initialize the Dispatcher's data members\r | |
418 | \r | |
419 | @param PrivateData PeiCore's private data structure\r | |
420 | @param OldCoreData Old data from SecCore\r | |
421 | NULL if being run in non-permament memory mode.\r | |
422 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r | |
423 | and location of temporary RAM, the stack location and the BFV location.\r | |
424 | \r | |
425 | **/\r | |
426 | VOID\r | |
427 | InitializeDispatcherData (\r | |
428 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
429 | IN PEI_CORE_INSTANCE *OldCoreData,\r | |
430 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
431 | );\r | |
432 | \r | |
433 | /**\r | |
434 | This routine parses the Dependency Expression, if available, and\r | |
435 | decides if the module can be executed.\r | |
436 | \r | |
437 | \r | |
438 | @param Private PeiCore's private data structure\r | |
439 | @param FileHandle PEIM's file handle\r | |
440 | @param PeimCount The index of last dispatched PEIM.\r | |
441 | \r | |
442 | @retval TRUE Can be dispatched\r | |
443 | @retval FALSE Cannot be dispatched\r | |
444 | \r | |
445 | **/\r | |
446 | BOOLEAN\r | |
447 | DepexSatisfied (\r | |
448 | IN PEI_CORE_INSTANCE *Private,\r | |
449 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
450 | IN UINTN PeimCount\r | |
451 | );\r | |
452 | \r | |
453 | //\r | |
454 | // PPI support functions\r | |
455 | //\r | |
456 | /**\r | |
457 | \r | |
458 | Initialize PPI services.\r | |
459 | \r | |
460 | @param PrivateData Pointer to the PEI Core data.\r | |
461 | @param OldCoreData Pointer to old PEI Core data.\r | |
462 | NULL if being run in non-permament memory mode.\r | |
463 | \r | |
464 | **/\r | |
465 | VOID\r | |
466 | InitializePpiServices (\r | |
467 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
468 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
469 | );\r | |
470 | \r | |
471 | /**\r | |
472 | \r | |
473 | Migrate the Hob list from the temporary memory to PEI installed memory.\r | |
474 | \r | |
475 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r | |
476 | and location of temporary RAM, the stack location and the BFV location.\r | |
477 | @param PrivateData Pointer to PeiCore's private data structure.\r | |
478 | \r | |
479 | **/\r | |
480 | VOID\r | |
481 | ConvertPpiPointers (\r | |
482 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
483 | IN PEI_CORE_INSTANCE *PrivateData\r | |
484 | );\r | |
485 | \r | |
486 | /**\r | |
487 | \r | |
488 | Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r | |
489 | \r | |
490 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
491 | @param PpiList Pointer to ppi array that want to be installed.\r | |
492 | \r | |
493 | @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r | |
494 | @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r | |
495 | if any PPI in PpiList is not valid\r | |
496 | @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r | |
497 | \r | |
498 | **/\r | |
499 | EFI_STATUS\r | |
500 | EFIAPI\r | |
501 | PeiInstallPpi (\r | |
502 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
503 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
504 | );\r | |
505 | \r | |
506 | /**\r | |
507 | \r | |
508 | Re-Install PPI services.\r | |
509 | \r | |
510 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
511 | @param OldPpi Pointer to the old PEI PPI Descriptors.\r | |
512 | @param NewPpi Pointer to the new PEI PPI Descriptors.\r | |
513 | \r | |
514 | @retval EFI_SUCCESS if the operation was successful\r | |
515 | @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r | |
516 | if NewPpi is not valid\r | |
517 | @retval EFI_NOT_FOUND if the PPI was not in the database\r | |
518 | \r | |
519 | **/\r | |
520 | EFI_STATUS\r | |
521 | EFIAPI\r | |
522 | PeiReInstallPpi (\r | |
523 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
524 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
525 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
526 | );\r | |
527 | \r | |
528 | /**\r | |
529 | \r | |
530 | Locate a given named PPI.\r | |
531 | \r | |
532 | \r | |
533 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
534 | @param Guid Pointer to GUID of the PPI.\r | |
535 | @param Instance Instance Number to discover.\r | |
536 | @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r | |
537 | returns a pointer to the descriptor (includes flags, etc)\r | |
538 | @param Ppi Pointer to reference the found PPI\r | |
539 | \r | |
540 | @retval EFI_SUCCESS if the PPI is in the database\r | |
541 | @retval EFI_NOT_FOUND if the PPI is not in the database\r | |
542 | \r | |
543 | **/\r | |
544 | EFI_STATUS\r | |
545 | EFIAPI\r | |
546 | PeiLocatePpi (\r | |
547 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
548 | IN CONST EFI_GUID *Guid,\r | |
549 | IN UINTN Instance,\r | |
550 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
551 | IN OUT VOID **Ppi\r | |
552 | );\r | |
553 | \r | |
554 | /**\r | |
555 | \r | |
556 | Install a notification for a given PPI.\r | |
557 | \r | |
558 | \r | |
559 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
560 | @param NotifyList Pointer to list of Descriptors to notify upon.\r | |
561 | \r | |
562 | @retval EFI_SUCCESS if successful\r | |
563 | @retval EFI_OUT_OF_RESOURCES if no space in the database\r | |
564 | @retval EFI_INVALID_PARAMETER if not a good decriptor\r | |
565 | \r | |
566 | **/\r | |
567 | EFI_STATUS\r | |
568 | EFIAPI\r | |
569 | PeiNotifyPpi (\r | |
570 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
571 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
572 | );\r | |
573 | \r | |
574 | /**\r | |
575 | \r | |
576 | Process the Notify List at dispatch level.\r | |
577 | \r | |
578 | @param PrivateData PeiCore's private data structure.\r | |
579 | \r | |
580 | **/\r | |
581 | VOID\r | |
582 | ProcessDispatchNotifyList (\r | |
583 | IN PEI_CORE_INSTANCE *PrivateData\r | |
584 | );\r | |
585 | \r | |
586 | /**\r | |
587 | \r | |
588 | Process notifications.\r | |
589 | \r | |
590 | @param PrivateData PeiCore's private data structure\r | |
591 | @param NotifyType Type of notify to fire.\r | |
592 | @param InstallStartIndex Install Beginning index.\r | |
593 | @param InstallStopIndex Install Ending index.\r | |
594 | @param NotifyStartIndex Notify Beginning index.\r | |
595 | @param NotifyStopIndex Notify Ending index.\r | |
596 | \r | |
597 | **/\r | |
598 | VOID\r | |
599 | ProcessNotify (\r | |
600 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
601 | IN UINTN NotifyType,\r | |
602 | IN INTN InstallStartIndex,\r | |
603 | IN INTN InstallStopIndex,\r | |
604 | IN INTN NotifyStartIndex,\r | |
605 | IN INTN NotifyStopIndex\r | |
606 | );\r | |
607 | \r | |
608 | /**\r | |
609 | Process PpiList from SEC phase.\r | |
610 | \r | |
611 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
612 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
613 | These PPI's will be installed and/or immediately signaled if they are notification type.\r | |
614 | \r | |
615 | **/\r | |
616 | VOID\r | |
617 | ProcessPpiListFromSec (\r | |
618 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
619 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
620 | );\r | |
621 | \r | |
622 | //\r | |
623 | // Boot mode support functions\r | |
624 | //\r | |
625 | /**\r | |
626 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
627 | \r | |
628 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
629 | @param BootMode A pointer to contain the value of the boot mode.\r | |
630 | \r | |
631 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
632 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
633 | \r | |
634 | **/\r | |
635 | EFI_STATUS\r | |
636 | EFIAPI\r | |
637 | PeiGetBootMode (\r | |
638 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
639 | IN OUT EFI_BOOT_MODE *BootMode\r | |
640 | );\r | |
641 | \r | |
642 | /**\r | |
643 | This service enables PEIMs to update the boot mode variable.\r | |
644 | \r | |
645 | \r | |
646 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
647 | @param BootMode The value of the boot mode to set.\r | |
648 | \r | |
649 | @return EFI_SUCCESS The value was successfully updated\r | |
650 | \r | |
651 | **/\r | |
652 | EFI_STATUS\r | |
653 | EFIAPI\r | |
654 | PeiSetBootMode (\r | |
655 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
656 | IN EFI_BOOT_MODE BootMode\r | |
657 | );\r | |
658 | \r | |
659 | //\r | |
660 | // Security support functions\r | |
661 | //\r | |
662 | /**\r | |
663 | \r | |
664 | Initialize the security services.\r | |
665 | \r | |
666 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
667 | @param OldCoreData Pointer to the old core data.\r | |
668 | NULL if being run in non-permament memory mode.\r | |
669 | \r | |
670 | **/\r | |
671 | VOID\r | |
672 | InitializeSecurityServices (\r | |
673 | IN EFI_PEI_SERVICES **PeiServices,\r | |
674 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
675 | );\r | |
676 | \r | |
677 | /**\r | |
678 | Verify a Firmware volume.\r | |
679 | \r | |
680 | @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r | |
681 | \r | |
682 | @retval EFI_SUCCESS Firmware Volume is legal\r | |
683 | @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r | |
684 | \r | |
685 | **/\r | |
686 | EFI_STATUS\r | |
687 | VerifyFv (\r | |
688 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
689 | );\r | |
690 | \r | |
691 | /**\r | |
692 | Provide a callout to the security verification service.\r | |
693 | \r | |
694 | @param PrivateData PeiCore's private data structure\r | |
695 | @param VolumeHandle Handle of FV\r | |
696 | @param FileHandle Handle of PEIM's ffs\r | |
697 | @param AuthenticationStatus Authentication status\r | |
698 | \r | |
699 | @retval EFI_SUCCESS Image is OK\r | |
700 | @retval EFI_SECURITY_VIOLATION Image is illegal\r | |
701 | @retval EFI_NOT_FOUND If security PPI is not installed.\r | |
702 | **/\r | |
703 | EFI_STATUS\r | |
704 | VerifyPeim (\r | |
705 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
706 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
707 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
708 | IN UINT32 AuthenticationStatus\r | |
709 | );\r | |
710 | \r | |
711 | /**\r | |
712 | \r | |
713 | Gets the pointer to the HOB List.\r | |
714 | \r | |
715 | \r | |
716 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
717 | @param HobList Pointer to the HOB List.\r | |
718 | \r | |
719 | @retval EFI_SUCCESS Get the pointer of HOB List\r | |
720 | @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r | |
721 | @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r | |
722 | \r | |
723 | **/\r | |
724 | EFI_STATUS\r | |
725 | EFIAPI\r | |
726 | PeiGetHobList (\r | |
727 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
728 | IN OUT VOID **HobList\r | |
729 | );\r | |
730 | \r | |
731 | /**\r | |
732 | Add a new HOB to the HOB List.\r | |
733 | \r | |
734 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
735 | @param Type Type of the new HOB.\r | |
736 | @param Length Length of the new HOB to allocate.\r | |
737 | @param Hob Pointer to the new HOB.\r | |
738 | \r | |
739 | @return EFI_SUCCESS Success to create hob.\r | |
740 | @retval EFI_INVALID_PARAMETER if Hob is NULL\r | |
741 | @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
742 | @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
743 | \r | |
744 | **/\r | |
745 | EFI_STATUS\r | |
746 | EFIAPI\r | |
747 | PeiCreateHob (\r | |
748 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
749 | IN UINT16 Type,\r | |
750 | IN UINT16 Length,\r | |
751 | IN OUT VOID **Hob\r | |
752 | );\r | |
753 | \r | |
754 | /**\r | |
755 | \r | |
756 | Builds a Handoff Information Table HOB\r | |
757 | \r | |
758 | @param BootMode - Current Bootmode\r | |
759 | @param MemoryBegin - Start Memory Address.\r | |
760 | @param MemoryLength - Length of Memory.\r | |
761 | \r | |
762 | @return EFI_SUCCESS Always success to initialize HOB.\r | |
763 | \r | |
764 | **/\r | |
765 | EFI_STATUS\r | |
766 | PeiCoreBuildHobHandoffInfoTable (\r | |
767 | IN EFI_BOOT_MODE BootMode,\r | |
768 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
769 | IN UINT64 MemoryLength\r | |
770 | );\r | |
771 | \r | |
772 | /**\r | |
773 | Install SEC HOB data to the HOB List.\r | |
774 | \r | |
775 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
776 | @param SecHobList Pointer to SEC HOB List.\r | |
777 | \r | |
778 | @return EFI_SUCCESS Success to install SEC HOB data.\r | |
779 | @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.\r | |
780 | \r | |
781 | **/\r | |
782 | EFI_STATUS\r | |
783 | PeiInstallSecHobData (\r | |
784 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
785 | IN EFI_HOB_GENERIC_HEADER *SecHobList\r | |
786 | );\r | |
787 | \r | |
788 | \r | |
789 | //\r | |
790 | // FFS Fw Volume support functions\r | |
791 | //\r | |
792 | /**\r | |
793 | Searches for the next matching file in the firmware volume.\r | |
794 | \r | |
795 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
796 | @param SearchType Filter to find only files of this type.\r | |
797 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
798 | @param FvHandle Handle of firmware volume in which to search.\r | |
799 | @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start\r | |
800 | at the beginning of the firmware volume. On exit, points the file handle of the next file\r | |
801 | in the volume or NULL if there are no more files.\r | |
802 | \r | |
803 | @retval EFI_NOT_FOUND The file was not found.\r | |
804 | @retval EFI_NOT_FOUND The header checksum was not zero.\r | |
805 | @retval EFI_SUCCESS The file was found.\r | |
806 | \r | |
807 | **/\r | |
808 | EFI_STATUS\r | |
809 | EFIAPI\r | |
810 | PeiFfsFindNextFile (\r | |
811 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
812 | IN UINT8 SearchType,\r | |
813 | IN EFI_PEI_FV_HANDLE FvHandle,\r | |
814 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
815 | );\r | |
816 | \r | |
817 | /**\r | |
818 | Searches for the next matching section within the specified file.\r | |
819 | \r | |
820 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r | |
821 | @param SectionType Filter to find only sections of this type.\r | |
822 | @param FileHandle Pointer to the current file to search.\r | |
823 | @param SectionData A pointer to the discovered section, if successful.\r | |
824 | NULL if section not found\r | |
825 | \r | |
826 | @retval EFI_NOT_FOUND The section was not found.\r | |
827 | @retval EFI_SUCCESS The section was found.\r | |
828 | \r | |
829 | **/\r | |
830 | EFI_STATUS\r | |
831 | EFIAPI\r | |
832 | PeiFfsFindSectionData (\r | |
833 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
834 | IN EFI_SECTION_TYPE SectionType,\r | |
835 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
836 | OUT VOID **SectionData\r | |
837 | );\r | |
838 | \r | |
839 | /**\r | |
840 | Searches for the next matching section within the specified file.\r | |
841 | \r | |
842 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
843 | @param SectionType The value of the section type to find.\r | |
844 | @param SectionInstance Section instance to find.\r | |
845 | @param FileHandle Handle of the firmware file to search.\r | |
846 | @param SectionData A pointer to the discovered section, if successful.\r | |
847 | @param AuthenticationStatus A pointer to the authentication status for this section.\r | |
848 | \r | |
849 | @retval EFI_SUCCESS The section was found.\r | |
850 | @retval EFI_NOT_FOUND The section was not found.\r | |
851 | \r | |
852 | **/\r | |
853 | EFI_STATUS\r | |
854 | EFIAPI\r | |
855 | PeiFfsFindSectionData3 (\r | |
856 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
857 | IN EFI_SECTION_TYPE SectionType,\r | |
858 | IN UINTN SectionInstance,\r | |
859 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
860 | OUT VOID **SectionData,\r | |
861 | OUT UINT32 *AuthenticationStatus\r | |
862 | );\r | |
863 | \r | |
864 | /**\r | |
865 | Search the firmware volumes by index\r | |
866 | \r | |
867 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r | |
868 | @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware\r | |
869 | Volume (BFV).\r | |
870 | @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.\r | |
871 | \r | |
872 | @retval EFI_INVALID_PARAMETER VolumeHandle is NULL\r | |
873 | @retval EFI_NOT_FOUND The volume was not found.\r | |
874 | @retval EFI_SUCCESS The volume was found.\r | |
875 | \r | |
876 | **/\r | |
877 | EFI_STATUS\r | |
878 | EFIAPI\r | |
879 | PeiFfsFindNextVolume (\r | |
880 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
881 | IN UINTN Instance,\r | |
882 | IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r | |
883 | );\r | |
884 | \r | |
885 | //\r | |
886 | // Memory support functions\r | |
887 | //\r | |
888 | /**\r | |
889 | \r | |
890 | Initialize the memory services.\r | |
891 | \r | |
892 | @param PrivateData PeiCore's private data structure\r | |
893 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r | |
894 | and location of temporary RAM, the stack location and the BFV location.\r | |
895 | @param OldCoreData Pointer to the PEI Core data.\r | |
896 | NULL if being run in non-permament memory mode.\r | |
897 | \r | |
898 | **/\r | |
899 | VOID\r | |
900 | InitializeMemoryServices (\r | |
901 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
902 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
903 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
904 | );\r | |
905 | \r | |
906 | /**\r | |
907 | \r | |
908 | Install the permanent memory is now available.\r | |
909 | Creates HOB (PHIT and Stack).\r | |
910 | \r | |
911 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
912 | @param MemoryBegin Start of memory address.\r | |
913 | @param MemoryLength Length of memory.\r | |
914 | \r | |
915 | @return EFI_SUCCESS Always success.\r | |
916 | \r | |
917 | **/\r | |
918 | EFI_STATUS\r | |
919 | EFIAPI\r | |
920 | PeiInstallPeiMemory (\r | |
921 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
922 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
923 | IN UINT64 MemoryLength\r | |
924 | );\r | |
925 | \r | |
926 | /**\r | |
927 | Migrate memory pages allocated in pre-memory phase.\r | |
928 | Copy memory pages at temporary heap top to permanent heap top.\r | |
929 | \r | |
930 | @param[in] Private Pointer to the private data passed in from caller.\r | |
931 | @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.\r | |
932 | \r | |
933 | **/\r | |
934 | VOID\r | |
935 | MigrateMemoryPages (\r | |
936 | IN PEI_CORE_INSTANCE *Private,\r | |
937 | IN BOOLEAN TemporaryRamMigrated\r | |
938 | );\r | |
939 | \r | |
940 | /**\r | |
941 | Migrate MemoryBaseAddress in memory allocation HOBs\r | |
942 | from the temporary memory to PEI installed memory.\r | |
943 | \r | |
944 | @param[in] PrivateData Pointer to PeiCore's private data structure.\r | |
945 | \r | |
946 | **/\r | |
947 | VOID\r | |
948 | ConvertMemoryAllocationHobs (\r | |
949 | IN PEI_CORE_INSTANCE *PrivateData\r | |
950 | );\r | |
951 | \r | |
952 | /**\r | |
953 | The purpose of the service is to publish an interface that allows\r | |
954 | PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r | |
955 | \r | |
956 | Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.\r | |
957 | After InstallPeiMemory() is called, PEI will allocate pages within the region\r | |
958 | of memory provided by InstallPeiMemory() service in a best-effort fashion.\r | |
959 | Location-specific allocations are not managed by the PEI foundation code.\r | |
960 | \r | |
961 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
962 | @param MemoryType The type of memory to allocate.\r | |
963 | @param Pages The number of contiguous 4 KB pages to allocate.\r | |
964 | @param Memory Pointer to a physical address. On output, the address is set to the base\r | |
965 | of the page range that was allocated.\r | |
966 | \r | |
967 | @retval EFI_SUCCESS The memory range was successfully allocated.\r | |
968 | @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r | |
969 | @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,\r | |
970 | EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,\r | |
971 | EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.\r | |
972 | \r | |
973 | **/\r | |
974 | EFI_STATUS\r | |
975 | EFIAPI\r | |
976 | PeiAllocatePages (\r | |
977 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
978 | IN EFI_MEMORY_TYPE MemoryType,\r | |
979 | IN UINTN Pages,\r | |
980 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
981 | );\r | |
982 | \r | |
983 | /**\r | |
984 | Frees memory pages.\r | |
985 | \r | |
986 | @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
987 | @param[in] Memory The base physical address of the pages to be freed.\r | |
988 | @param[in] Pages The number of contiguous 4 KB pages to free.\r | |
989 | \r | |
990 | @retval EFI_SUCCESS The requested pages were freed.\r | |
991 | @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r | |
992 | @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r | |
993 | AllocatePages().\r | |
994 | \r | |
995 | **/\r | |
996 | EFI_STATUS\r | |
997 | EFIAPI\r | |
998 | PeiFreePages (\r | |
999 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1000 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
1001 | IN UINTN Pages\r | |
1002 | );\r | |
1003 | \r | |
1004 | /**\r | |
1005 | \r | |
1006 | Memory allocation service on the temporary memory.\r | |
1007 | \r | |
1008 | \r | |
1009 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1010 | @param Size Amount of memory required\r | |
1011 | @param Buffer Address of pointer to the buffer\r | |
1012 | \r | |
1013 | @retval EFI_SUCCESS The allocation was successful\r | |
1014 | @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
1015 | to allocate the requested size.\r | |
1016 | \r | |
1017 | **/\r | |
1018 | EFI_STATUS\r | |
1019 | EFIAPI\r | |
1020 | PeiAllocatePool (\r | |
1021 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1022 | IN UINTN Size,\r | |
1023 | OUT VOID **Buffer\r | |
1024 | );\r | |
1025 | \r | |
1026 | /**\r | |
1027 | \r | |
1028 | Routine for load image file.\r | |
1029 | \r | |
1030 | \r | |
1031 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1032 | @param FileHandle Pointer to the FFS file header of the image.\r | |
1033 | @param PeimState The dispatch state of the input PEIM handle.\r | |
1034 | @param EntryPoint Pointer to entry point of specified image file for output.\r | |
1035 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
1036 | \r | |
1037 | @retval EFI_SUCCESS Image is successfully loaded.\r | |
1038 | @retval EFI_NOT_FOUND Fail to locate necessary PPI\r | |
1039 | @retval Others Fail to load file.\r | |
1040 | \r | |
1041 | **/\r | |
1042 | EFI_STATUS\r | |
1043 | PeiLoadImage (\r | |
1044 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1045 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1046 | IN UINT8 PeimState,\r | |
1047 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
1048 | OUT UINT32 *AuthenticationState\r | |
1049 | );\r | |
1050 | \r | |
1051 | /**\r | |
1052 | \r | |
1053 | Core version of the Status Code reporter\r | |
1054 | \r | |
1055 | \r | |
1056 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1057 | @param CodeType Type of Status Code.\r | |
1058 | @param Value Value to output for Status Code.\r | |
1059 | @param Instance Instance Number of this status code.\r | |
1060 | @param CallerId ID of the caller of this status code.\r | |
1061 | @param Data Optional data associated with this status code.\r | |
1062 | \r | |
1063 | @retval EFI_SUCCESS if status code is successfully reported\r | |
1064 | @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
1065 | \r | |
1066 | **/\r | |
1067 | EFI_STATUS\r | |
1068 | EFIAPI\r | |
1069 | PeiReportStatusCode (\r | |
1070 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1071 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
1072 | IN EFI_STATUS_CODE_VALUE Value,\r | |
1073 | IN UINT32 Instance,\r | |
1074 | IN CONST EFI_GUID *CallerId,\r | |
1075 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
1076 | );\r | |
1077 | \r | |
1078 | /**\r | |
1079 | \r | |
1080 | Core version of the Reset System\r | |
1081 | \r | |
1082 | \r | |
1083 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1084 | \r | |
1085 | @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r | |
1086 | @retval EFI_DEVICE_ERROR Did not reset system.\r | |
1087 | Otherwise, resets the system.\r | |
1088 | \r | |
1089 | **/\r | |
1090 | EFI_STATUS\r | |
1091 | EFIAPI\r | |
1092 | PeiResetSystem (\r | |
1093 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
1094 | );\r | |
1095 | \r | |
1096 | /**\r | |
1097 | Resets the entire platform.\r | |
1098 | \r | |
1099 | @param[in] ResetType The type of reset to perform.\r | |
1100 | @param[in] ResetStatus The status code for the reset.\r | |
1101 | @param[in] DataSize The size, in bytes, of ResetData.\r | |
1102 | @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r | |
1103 | the data buffer starts with a Null-terminated string, optionally\r | |
1104 | followed by additional binary data. The string is a description\r | |
1105 | that the caller may use to further indicate the reason for the\r | |
1106 | system reset. ResetData is only valid if ResetStatus is something\r | |
1107 | other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific\r | |
1108 | where a minimum amount of ResetData is always required.\r | |
1109 | \r | |
1110 | **/\r | |
1111 | VOID\r | |
1112 | EFIAPI\r | |
1113 | PeiResetSystem2 (\r | |
1114 | IN EFI_RESET_TYPE ResetType,\r | |
1115 | IN EFI_STATUS ResetStatus,\r | |
1116 | IN UINTN DataSize,\r | |
1117 | IN VOID *ResetData OPTIONAL\r | |
1118 | );\r | |
1119 | \r | |
1120 | /**\r | |
1121 | \r | |
1122 | Initialize PeiCore Fv List.\r | |
1123 | \r | |
1124 | \r | |
1125 | @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r | |
1126 | @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
1127 | \r | |
1128 | **/\r | |
1129 | VOID\r | |
1130 | PeiInitializeFv (\r | |
1131 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1132 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
1133 | );\r | |
1134 | \r | |
1135 | /**\r | |
1136 | Process Firmware Volum Information once FvInfoPPI install.\r | |
1137 | \r | |
1138 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1139 | @param NotifyDescriptor Address of the notification descriptor data structure.\r | |
1140 | @param Ppi Address of the PPI that was installed.\r | |
1141 | \r | |
1142 | @retval EFI_SUCCESS if the interface could be successfully installed\r | |
1143 | \r | |
1144 | **/\r | |
1145 | EFI_STATUS\r | |
1146 | EFIAPI\r | |
1147 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
1148 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1149 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
1150 | IN VOID *Ppi\r | |
1151 | );\r | |
1152 | \r | |
1153 | /**\r | |
1154 | \r | |
1155 | Given the input VolumeHandle, search for the next matching name file.\r | |
1156 | \r | |
1157 | @param FileName File name to search.\r | |
1158 | @param VolumeHandle The current FV to search.\r | |
1159 | @param FileHandle Pointer to the file matching name in VolumeHandle.\r | |
1160 | NULL if file not found\r | |
1161 | \r | |
1162 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r | |
1163 | @retval EFI_SUCCESS Success to search given file\r | |
1164 | \r | |
1165 | **/\r | |
1166 | EFI_STATUS\r | |
1167 | EFIAPI\r | |
1168 | PeiFfsFindFileByName (\r | |
1169 | IN CONST EFI_GUID *FileName,\r | |
1170 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1171 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
1172 | );\r | |
1173 | \r | |
1174 | /**\r | |
1175 | Returns information about a specific file.\r | |
1176 | \r | |
1177 | @param FileHandle Handle of the file.\r | |
1178 | @param FileInfo Upon exit, points to the file's information.\r | |
1179 | \r | |
1180 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r | |
1181 | @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r | |
1182 | @retval EFI_SUCCESS File information returned.\r | |
1183 | \r | |
1184 | **/\r | |
1185 | EFI_STATUS\r | |
1186 | EFIAPI\r | |
1187 | PeiFfsGetFileInfo (\r | |
1188 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1189 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
1190 | );\r | |
1191 | \r | |
1192 | /**\r | |
1193 | Returns information about a specific file.\r | |
1194 | \r | |
1195 | @param FileHandle Handle of the file.\r | |
1196 | @param FileInfo Upon exit, points to the file's information.\r | |
1197 | \r | |
1198 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r | |
1199 | @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r | |
1200 | @retval EFI_SUCCESS File information returned.\r | |
1201 | \r | |
1202 | **/\r | |
1203 | EFI_STATUS\r | |
1204 | EFIAPI\r | |
1205 | PeiFfsGetFileInfo2 (\r | |
1206 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1207 | OUT EFI_FV_FILE_INFO2 *FileInfo\r | |
1208 | );\r | |
1209 | \r | |
1210 | /**\r | |
1211 | Returns information about the specified volume.\r | |
1212 | \r | |
1213 | @param VolumeHandle Handle of the volume.\r | |
1214 | @param VolumeInfo Upon exit, points to the volume's information.\r | |
1215 | \r | |
1216 | @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r | |
1217 | @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r | |
1218 | @retval EFI_SUCCESS Volume information returned.\r | |
1219 | **/\r | |
1220 | EFI_STATUS\r | |
1221 | EFIAPI\r | |
1222 | PeiFfsGetVolumeInfo (\r | |
1223 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1224 | OUT EFI_FV_INFO *VolumeInfo\r | |
1225 | );\r | |
1226 | \r | |
1227 | /**\r | |
1228 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
1229 | discovery permanent memory.\r | |
1230 | \r | |
1231 | @param FileHandle File handle of a PEIM.\r | |
1232 | \r | |
1233 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r | |
1234 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1235 | @retval EFI_SUCCESS Successfully to register itself.\r | |
1236 | \r | |
1237 | **/\r | |
1238 | EFI_STATUS\r | |
1239 | EFIAPI\r | |
1240 | PeiRegisterForShadow (\r | |
1241 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1242 | );\r | |
1243 | \r | |
1244 | /**\r | |
1245 | Initialize image service that install PeiLoadFilePpi.\r | |
1246 | \r | |
1247 | @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r | |
1248 | @param OldCoreData Pointer to Old PeiCore's private data.\r | |
1249 | If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r | |
1250 | If not NULL, PeiCore is entered at second time, stack/heap has been moved\r | |
1251 | to permanent memory.\r | |
1252 | \r | |
1253 | **/\r | |
1254 | VOID\r | |
1255 | InitializeImageServices (\r | |
1256 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1257 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
1258 | );\r | |
1259 | \r | |
1260 | /**\r | |
1261 | The wrapper function of PeiLoadImageLoadImage().\r | |
1262 | \r | |
1263 | @param This Pointer to EFI_PEI_LOAD_FILE_PPI.\r | |
1264 | @param FileHandle Pointer to the FFS file header of the image.\r | |
1265 | @param ImageAddressArg Pointer to PE/TE image.\r | |
1266 | @param ImageSizeArg Size of PE/TE image.\r | |
1267 | @param EntryPoint Pointer to entry point of specified image file for output.\r | |
1268 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
1269 | \r | |
1270 | @return Status of PeiLoadImageLoadImage().\r | |
1271 | \r | |
1272 | **/\r | |
1273 | EFI_STATUS\r | |
1274 | EFIAPI\r | |
1275 | PeiLoadImageLoadImageWrapper (\r | |
1276 | IN CONST EFI_PEI_LOAD_FILE_PPI *This,\r | |
1277 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1278 | OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL\r | |
1279 | OUT UINT64 *ImageSizeArg, OPTIONAL\r | |
1280 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
1281 | OUT UINT32 *AuthenticationState\r | |
1282 | );\r | |
1283 | \r | |
1284 | /**\r | |
1285 | \r | |
1286 | Provide a callback for when the security PPI is installed.\r | |
1287 | \r | |
1288 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1289 | @param NotifyDescriptor The descriptor for the notification event.\r | |
1290 | @param Ppi Pointer to the PPI in question.\r | |
1291 | \r | |
1292 | @return Always success\r | |
1293 | \r | |
1294 | **/\r | |
1295 | EFI_STATUS\r | |
1296 | EFIAPI\r | |
1297 | SecurityPpiNotifyCallback (\r | |
1298 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1299 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
1300 | IN VOID *Ppi\r | |
1301 | );\r | |
1302 | \r | |
1303 | /**\r | |
1304 | Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.\r | |
1305 | \r | |
1306 | @param PrivateData PeiCore's private data structure\r | |
1307 | @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.\r | |
1308 | @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.\r | |
1309 | \r | |
1310 | @retval EFI_NOT_FOUND FV image can't be found.\r | |
1311 | @retval EFI_SUCCESS Successfully to process it.\r | |
1312 | @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image\r | |
1313 | @retval EFI_SECURITY_VIOLATION Image is illegal\r | |
1314 | @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r | |
1315 | \r | |
1316 | **/\r | |
1317 | EFI_STATUS\r | |
1318 | ProcessFvFile (\r | |
1319 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1320 | IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,\r | |
1321 | IN EFI_PEI_FILE_HANDLE ParentFvFileHandle\r | |
1322 | );\r | |
1323 | \r | |
1324 | /**\r | |
1325 | Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.\r | |
1326 | \r | |
1327 | This routine also will install FvInfo ppi for FV hob in PI ways.\r | |
1328 | \r | |
1329 | @param Private Pointer of PEI_CORE_INSTANCE\r | |
1330 | @param Instance The index of FV want to be searched.\r | |
1331 | \r | |
1332 | @return Instance of PEI_CORE_FV_HANDLE.\r | |
1333 | **/\r | |
1334 | PEI_CORE_FV_HANDLE *\r | |
1335 | FindNextCoreFvHandle (\r | |
1336 | IN PEI_CORE_INSTANCE *Private,\r | |
1337 | IN UINTN Instance\r | |
1338 | );\r | |
1339 | \r | |
1340 | //\r | |
1341 | // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r | |
1342 | //\r | |
1343 | \r | |
1344 | /**\r | |
1345 | Memory-based read services.\r | |
1346 | \r | |
1347 | This function is to perform the Memory Access Read service based on installed\r | |
1348 | instance of the EFI_PEI_CPU_IO_PPI.\r | |
1349 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1350 | return EFI_NOT_YET_AVAILABLE.\r | |
1351 | \r | |
1352 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1353 | published by the PEI Foundation.\r | |
1354 | @param This Pointer to local data for the interface.\r | |
1355 | @param Width The width of the access. Enumerated in bytes.\r | |
1356 | @param Address The physical address of the access.\r | |
1357 | @param Count The number of accesses to perform.\r | |
1358 | @param Buffer A pointer to the buffer of data.\r | |
1359 | \r | |
1360 | @retval EFI_SUCCESS The function completed successfully.\r | |
1361 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1362 | **/\r | |
1363 | EFI_STATUS\r | |
1364 | EFIAPI\r | |
1365 | PeiDefaultMemRead (\r | |
1366 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1367 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1368 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1369 | IN UINT64 Address,\r | |
1370 | IN UINTN Count,\r | |
1371 | IN OUT VOID *Buffer\r | |
1372 | );\r | |
1373 | \r | |
1374 | /**\r | |
1375 | Memory-based write services.\r | |
1376 | \r | |
1377 | This function is to perform the Memory Access Write service based on installed\r | |
1378 | instance of the EFI_PEI_CPU_IO_PPI.\r | |
1379 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1380 | return EFI_NOT_YET_AVAILABLE.\r | |
1381 | \r | |
1382 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1383 | published by the PEI Foundation.\r | |
1384 | @param This Pointer to local data for the interface.\r | |
1385 | @param Width The width of the access. Enumerated in bytes.\r | |
1386 | @param Address The physical address of the access.\r | |
1387 | @param Count The number of accesses to perform.\r | |
1388 | @param Buffer A pointer to the buffer of data.\r | |
1389 | \r | |
1390 | @retval EFI_SUCCESS The function completed successfully.\r | |
1391 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1392 | **/\r | |
1393 | EFI_STATUS\r | |
1394 | EFIAPI\r | |
1395 | PeiDefaultMemWrite (\r | |
1396 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1397 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1398 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1399 | IN UINT64 Address,\r | |
1400 | IN UINTN Count,\r | |
1401 | IN OUT VOID *Buffer\r | |
1402 | );\r | |
1403 | \r | |
1404 | /**\r | |
1405 | IO-based read services.\r | |
1406 | \r | |
1407 | This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r | |
1408 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1409 | return EFI_NOT_YET_AVAILABLE.\r | |
1410 | \r | |
1411 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1412 | published by the PEI Foundation.\r | |
1413 | @param This Pointer to local data for the interface.\r | |
1414 | @param Width The width of the access. Enumerated in bytes.\r | |
1415 | @param Address The physical address of the access.\r | |
1416 | @param Count The number of accesses to perform.\r | |
1417 | @param Buffer A pointer to the buffer of data.\r | |
1418 | \r | |
1419 | @retval EFI_SUCCESS The function completed successfully.\r | |
1420 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1421 | **/\r | |
1422 | EFI_STATUS\r | |
1423 | EFIAPI\r | |
1424 | PeiDefaultIoRead (\r | |
1425 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1426 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1427 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1428 | IN UINT64 Address,\r | |
1429 | IN UINTN Count,\r | |
1430 | IN OUT VOID *Buffer\r | |
1431 | );\r | |
1432 | \r | |
1433 | /**\r | |
1434 | IO-based write services.\r | |
1435 | \r | |
1436 | This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r | |
1437 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1438 | return EFI_NOT_YET_AVAILABLE.\r | |
1439 | \r | |
1440 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1441 | published by the PEI Foundation.\r | |
1442 | @param This Pointer to local data for the interface.\r | |
1443 | @param Width The width of the access. Enumerated in bytes.\r | |
1444 | @param Address The physical address of the access.\r | |
1445 | @param Count The number of accesses to perform.\r | |
1446 | @param Buffer A pointer to the buffer of data.\r | |
1447 | \r | |
1448 | @retval EFI_SUCCESS The function completed successfully.\r | |
1449 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1450 | **/\r | |
1451 | EFI_STATUS\r | |
1452 | EFIAPI\r | |
1453 | PeiDefaultIoWrite (\r | |
1454 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1455 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1456 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1457 | IN UINT64 Address,\r | |
1458 | IN UINTN Count,\r | |
1459 | IN OUT VOID *Buffer\r | |
1460 | );\r | |
1461 | \r | |
1462 | /**\r | |
1463 | 8-bit I/O read operations.\r | |
1464 | \r | |
1465 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1466 | return 0.\r | |
1467 | \r | |
1468 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1469 | @param This Pointer to local data for the interface.\r | |
1470 | @param Address The physical address of the access.\r | |
1471 | \r | |
1472 | @return An 8-bit value returned from the I/O space.\r | |
1473 | **/\r | |
1474 | UINT8\r | |
1475 | EFIAPI\r | |
1476 | PeiDefaultIoRead8 (\r | |
1477 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1478 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1479 | IN UINT64 Address\r | |
1480 | );\r | |
1481 | \r | |
1482 | /**\r | |
1483 | Reads an 16-bit I/O port.\r | |
1484 | \r | |
1485 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1486 | return 0.\r | |
1487 | \r | |
1488 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1489 | @param This Pointer to local data for the interface.\r | |
1490 | @param Address The physical address of the access.\r | |
1491 | \r | |
1492 | @return A 16-bit value returned from the I/O space.\r | |
1493 | **/\r | |
1494 | UINT16\r | |
1495 | EFIAPI\r | |
1496 | PeiDefaultIoRead16 (\r | |
1497 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1498 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1499 | IN UINT64 Address\r | |
1500 | );\r | |
1501 | \r | |
1502 | /**\r | |
1503 | Reads an 32-bit I/O port.\r | |
1504 | \r | |
1505 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1506 | return 0.\r | |
1507 | \r | |
1508 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1509 | @param This Pointer to local data for the interface.\r | |
1510 | @param Address The physical address of the access.\r | |
1511 | \r | |
1512 | @return A 32-bit value returned from the I/O space.\r | |
1513 | **/\r | |
1514 | UINT32\r | |
1515 | EFIAPI\r | |
1516 | PeiDefaultIoRead32 (\r | |
1517 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1518 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1519 | IN UINT64 Address\r | |
1520 | );\r | |
1521 | \r | |
1522 | /**\r | |
1523 | Reads an 64-bit I/O port.\r | |
1524 | \r | |
1525 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1526 | return 0.\r | |
1527 | \r | |
1528 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1529 | @param This Pointer to local data for the interface.\r | |
1530 | @param Address The physical address of the access.\r | |
1531 | \r | |
1532 | @return A 64-bit value returned from the I/O space.\r | |
1533 | **/\r | |
1534 | UINT64\r | |
1535 | EFIAPI\r | |
1536 | PeiDefaultIoRead64 (\r | |
1537 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1538 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1539 | IN UINT64 Address\r | |
1540 | );\r | |
1541 | \r | |
1542 | /**\r | |
1543 | 8-bit I/O write operations.\r | |
1544 | \r | |
1545 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1546 | @param This Pointer to local data for the interface.\r | |
1547 | @param Address The physical address of the access.\r | |
1548 | @param Data The data to write.\r | |
1549 | **/\r | |
1550 | VOID\r | |
1551 | EFIAPI\r | |
1552 | PeiDefaultIoWrite8 (\r | |
1553 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1554 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1555 | IN UINT64 Address,\r | |
1556 | IN UINT8 Data\r | |
1557 | );\r | |
1558 | \r | |
1559 | /**\r | |
1560 | 16-bit I/O write operations.\r | |
1561 | \r | |
1562 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1563 | @param This Pointer to local data for the interface.\r | |
1564 | @param Address The physical address of the access.\r | |
1565 | @param Data The data to write.\r | |
1566 | **/\r | |
1567 | VOID\r | |
1568 | EFIAPI\r | |
1569 | PeiDefaultIoWrite16 (\r | |
1570 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1571 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1572 | IN UINT64 Address,\r | |
1573 | IN UINT16 Data\r | |
1574 | );\r | |
1575 | \r | |
1576 | /**\r | |
1577 | 32-bit I/O write operations.\r | |
1578 | \r | |
1579 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1580 | @param This Pointer to local data for the interface.\r | |
1581 | @param Address The physical address of the access.\r | |
1582 | @param Data The data to write.\r | |
1583 | **/\r | |
1584 | VOID\r | |
1585 | EFIAPI\r | |
1586 | PeiDefaultIoWrite32 (\r | |
1587 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1588 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1589 | IN UINT64 Address,\r | |
1590 | IN UINT32 Data\r | |
1591 | );\r | |
1592 | \r | |
1593 | /**\r | |
1594 | 64-bit I/O write operations.\r | |
1595 | \r | |
1596 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1597 | @param This Pointer to local data for the interface.\r | |
1598 | @param Address The physical address of the access.\r | |
1599 | @param Data The data to write.\r | |
1600 | **/\r | |
1601 | VOID\r | |
1602 | EFIAPI\r | |
1603 | PeiDefaultIoWrite64 (\r | |
1604 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1605 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1606 | IN UINT64 Address,\r | |
1607 | IN UINT64 Data\r | |
1608 | );\r | |
1609 | \r | |
1610 | /**\r | |
1611 | 8-bit memory read operations.\r | |
1612 | \r | |
1613 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1614 | return 0.\r | |
1615 | \r | |
1616 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1617 | @param This Pointer to local data for the interface.\r | |
1618 | @param Address The physical address of the access.\r | |
1619 | \r | |
1620 | @return An 8-bit value returned from the memory space.\r | |
1621 | \r | |
1622 | **/\r | |
1623 | UINT8\r | |
1624 | EFIAPI\r | |
1625 | PeiDefaultMemRead8 (\r | |
1626 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1627 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1628 | IN UINT64 Address\r | |
1629 | );\r | |
1630 | \r | |
1631 | /**\r | |
1632 | 16-bit memory read operations.\r | |
1633 | \r | |
1634 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1635 | return 0.\r | |
1636 | \r | |
1637 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1638 | @param This Pointer to local data for the interface.\r | |
1639 | @param Address The physical address of the access.\r | |
1640 | \r | |
1641 | @return An 16-bit value returned from the memory space.\r | |
1642 | \r | |
1643 | **/\r | |
1644 | UINT16\r | |
1645 | EFIAPI\r | |
1646 | PeiDefaultMemRead16 (\r | |
1647 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1648 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1649 | IN UINT64 Address\r | |
1650 | );\r | |
1651 | \r | |
1652 | /**\r | |
1653 | 32-bit memory read operations.\r | |
1654 | \r | |
1655 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1656 | return 0.\r | |
1657 | \r | |
1658 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1659 | @param This Pointer to local data for the interface.\r | |
1660 | @param Address The physical address of the access.\r | |
1661 | \r | |
1662 | @return An 32-bit value returned from the memory space.\r | |
1663 | \r | |
1664 | **/\r | |
1665 | UINT32\r | |
1666 | EFIAPI\r | |
1667 | PeiDefaultMemRead32 (\r | |
1668 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1669 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1670 | IN UINT64 Address\r | |
1671 | );\r | |
1672 | \r | |
1673 | /**\r | |
1674 | 64-bit memory read operations.\r | |
1675 | \r | |
1676 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r | |
1677 | return 0.\r | |
1678 | \r | |
1679 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1680 | @param This Pointer to local data for the interface.\r | |
1681 | @param Address The physical address of the access.\r | |
1682 | \r | |
1683 | @return An 64-bit value returned from the memory space.\r | |
1684 | \r | |
1685 | **/\r | |
1686 | UINT64\r | |
1687 | EFIAPI\r | |
1688 | PeiDefaultMemRead64 (\r | |
1689 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1690 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1691 | IN UINT64 Address\r | |
1692 | );\r | |
1693 | \r | |
1694 | /**\r | |
1695 | 8-bit memory write operations.\r | |
1696 | \r | |
1697 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1698 | @param This Pointer to local data for the interface.\r | |
1699 | @param Address The physical address of the access.\r | |
1700 | @param Data The data to write.\r | |
1701 | \r | |
1702 | **/\r | |
1703 | VOID\r | |
1704 | EFIAPI\r | |
1705 | PeiDefaultMemWrite8 (\r | |
1706 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1707 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1708 | IN UINT64 Address,\r | |
1709 | IN UINT8 Data\r | |
1710 | );\r | |
1711 | \r | |
1712 | /**\r | |
1713 | 16-bit memory write operations.\r | |
1714 | \r | |
1715 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1716 | @param This Pointer to local data for the interface.\r | |
1717 | @param Address The physical address of the access.\r | |
1718 | @param Data The data to write.\r | |
1719 | \r | |
1720 | **/\r | |
1721 | VOID\r | |
1722 | EFIAPI\r | |
1723 | PeiDefaultMemWrite16 (\r | |
1724 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1725 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1726 | IN UINT64 Address,\r | |
1727 | IN UINT16 Data\r | |
1728 | );\r | |
1729 | \r | |
1730 | /**\r | |
1731 | 32-bit memory write operations.\r | |
1732 | \r | |
1733 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1734 | @param This Pointer to local data for the interface.\r | |
1735 | @param Address The physical address of the access.\r | |
1736 | @param Data The data to write.\r | |
1737 | \r | |
1738 | **/\r | |
1739 | VOID\r | |
1740 | EFIAPI\r | |
1741 | PeiDefaultMemWrite32 (\r | |
1742 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1743 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1744 | IN UINT64 Address,\r | |
1745 | IN UINT32 Data\r | |
1746 | );\r | |
1747 | \r | |
1748 | /**\r | |
1749 | 64-bit memory write operations.\r | |
1750 | \r | |
1751 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1752 | @param This Pointer to local data for the interface.\r | |
1753 | @param Address The physical address of the access.\r | |
1754 | @param Data The data to write.\r | |
1755 | \r | |
1756 | **/\r | |
1757 | VOID\r | |
1758 | EFIAPI\r | |
1759 | PeiDefaultMemWrite64 (\r | |
1760 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1761 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1762 | IN UINT64 Address,\r | |
1763 | IN UINT64 Data\r | |
1764 | );\r | |
1765 | \r | |
1766 | extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;\r | |
1767 | \r | |
1768 | //\r | |
1769 | // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r | |
1770 | //\r | |
1771 | \r | |
1772 | /**\r | |
1773 | Reads from a given location in the PCI configuration space.\r | |
1774 | \r | |
1775 | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r | |
1776 | return EFI_NOT_YET_AVAILABLE.\r | |
1777 | \r | |
1778 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1779 | @param This Pointer to local data for the interface.\r | |
1780 | @param Width The width of the access. Enumerated in bytes.\r | |
1781 | See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r | |
1782 | @param Address The physical address of the access. The format of\r | |
1783 | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r | |
1784 | @param Buffer A pointer to the buffer of data.\r | |
1785 | \r | |
1786 | @retval EFI_SUCCESS The function completed successfully.\r | |
1787 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1788 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1789 | \r | |
1790 | **/\r | |
1791 | EFI_STATUS\r | |
1792 | EFIAPI\r | |
1793 | PeiDefaultPciCfg2Read (\r | |
1794 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1795 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1796 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1797 | IN UINT64 Address,\r | |
1798 | IN OUT VOID *Buffer\r | |
1799 | );\r | |
1800 | \r | |
1801 | /**\r | |
1802 | Write to a given location in the PCI configuration space.\r | |
1803 | \r | |
1804 | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r | |
1805 | return EFI_NOT_YET_AVAILABLE.\r | |
1806 | \r | |
1807 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1808 | @param This Pointer to local data for the interface.\r | |
1809 | @param Width The width of the access. Enumerated in bytes.\r | |
1810 | See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r | |
1811 | @param Address The physical address of the access. The format of\r | |
1812 | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r | |
1813 | @param Buffer A pointer to the buffer of data.\r | |
1814 | \r | |
1815 | @retval EFI_SUCCESS The function completed successfully.\r | |
1816 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1817 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1818 | **/\r | |
1819 | EFI_STATUS\r | |
1820 | EFIAPI\r | |
1821 | PeiDefaultPciCfg2Write (\r | |
1822 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1823 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1824 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1825 | IN UINT64 Address,\r | |
1826 | IN OUT VOID *Buffer\r | |
1827 | );\r | |
1828 | \r | |
1829 | /**\r | |
1830 | This function performs a read-modify-write operation on the contents from a given\r | |
1831 | location in the PCI configuration space.\r | |
1832 | \r | |
1833 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1834 | published by the PEI Foundation.\r | |
1835 | @param This Pointer to local data for the interface.\r | |
1836 | @param Width The width of the access. Enumerated in bytes. Type\r | |
1837 | EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r | |
1838 | @param Address The physical address of the access.\r | |
1839 | @param SetBits Points to value to bitwise-OR with the read configuration value.\r | |
1840 | The size of the value is determined by Width.\r | |
1841 | @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r | |
1842 | The size of the value is determined by Width.\r | |
1843 | \r | |
1844 | @retval EFI_SUCCESS The function completed successfully.\r | |
1845 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1846 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1847 | **/\r | |
1848 | EFI_STATUS\r | |
1849 | EFIAPI\r | |
1850 | PeiDefaultPciCfg2Modify (\r | |
1851 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1852 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1853 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1854 | IN UINT64 Address,\r | |
1855 | IN VOID *SetBits,\r | |
1856 | IN VOID *ClearBits\r | |
1857 | );\r | |
1858 | \r | |
1859 | extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;\r | |
1860 | \r | |
1861 | /**\r | |
1862 | After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r | |
1863 | be re-installed with the instance in permanent memory and all cached FvPpi pointers in\r | |
1864 | PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent\r | |
1865 | memory.\r | |
1866 | \r | |
1867 | @param PrivateData Pointer to PEI_CORE_INSTANCE.\r | |
1868 | **/\r | |
1869 | VOID\r | |
1870 | PeiReinitializeFv (\r | |
1871 | IN PEI_CORE_INSTANCE *PrivateData\r | |
1872 | );\r | |
1873 | \r | |
1874 | #endif\r |