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