]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Pei/PeiMain.h
Add VFR compiler Path for x64 & IPF arch.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
1 /*++
2
3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PeiMain.h
15
16 Abstract:
17
18 Definition of Pei Core Structures and Services
19
20 Revision History
21
22 --*/
23
24 #ifndef _PEI_MAIN_H_
25 #define _PEI_MAIN_H_
26
27 //
28 // Include common header file for this module.
29 //
30 #include "CommonHeader.h"
31
32 extern EFI_GUID gEfiPeiCorePrivateGuid;
33
34 //
35 // Pei Core private data structures
36 //
37 typedef union {
38 EFI_PEI_PPI_DESCRIPTOR *Ppi;
39 EFI_PEI_NOTIFY_DESCRIPTOR *Notify;
40 VOID *Raw;
41 } PEI_PPI_LIST_POINTERS;
42
43 #define PEI_STACK_SIZE 0x20000
44
45 #define MAX_PPI_DESCRIPTORS 64
46
47 typedef struct {
48 INTN PpiListEnd;
49 INTN NotifyListEnd;
50 INTN DispatchListEnd;
51 INTN LastDispatchedInstall;
52 INTN LastDispatchedNotify;
53 PEI_PPI_LIST_POINTERS PpiListPtrs[MAX_PPI_DESCRIPTORS];
54 } PEI_PPI_DATABASE;
55
56 typedef struct {
57 UINT8 CurrentPeim;
58 UINT8 CurrentFv;
59 UINT32 DispatchedPeimBitMap;
60 UINT32 PreviousPeimBitMap;
61 EFI_FFS_FILE_HEADER *CurrentPeimAddress;
62 EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress;
63 EFI_FIRMWARE_VOLUME_HEADER *BootFvAddress;
64 EFI_PEI_FIND_FV_PPI *FindFv;
65 } PEI_CORE_DISPATCH_DATA;
66
67
68 //
69 // Pei Core private data structure instance
70 //
71
72 #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
73
74 typedef struct{
75 UINTN Signature;
76 EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow
77 PEI_PPI_DATABASE PpiData;
78 PEI_CORE_DISPATCH_DATA DispatchData;
79 EFI_PEI_HOB_POINTERS HobList;
80 BOOLEAN SwitchStackSignal;
81 BOOLEAN PeiMemoryInstalled;
82 EFI_PHYSICAL_ADDRESS StackBase;
83 UINT64 StackSize;
84 VOID *BottomOfCarHeap;
85 VOID *TopOfCarHeap;
86 VOID *CpuIo;
87 EFI_PEI_SECURITY_PPI *PrivateSecurityPpi;
88 EFI_PEI_SERVICES ServiceTableShadow;
89 UINTN SizeOfCacheAsRam;
90 VOID *MaxTopOfCarHeap;
91 } PEI_CORE_INSTANCE;
92
93 //
94 // Pei Core Instance Data Macros
95 //
96
97 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
98 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
99
100 //
101 // BUGBUG: Where does this go really?
102 //
103 typedef
104 EFI_STATUS
105 (EFIAPI *PEI_CORE_ENTRY_POINT)(
106 IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
107 IN PEI_CORE_INSTANCE *OldCoreData
108 );
109
110 //
111 // Union of temporarily used function pointers (to save stack space)
112 //
113 typedef union {
114 PEI_CORE_ENTRY_POINT PeiCore;
115 EFI_PEIM_ENTRY_POINT PeimEntry;
116 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;
117 EFI_DXE_IPL_PPI *DxeIpl;
118 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
119 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
120 VOID *Raw;
121 } PEI_CORE_TEMP_POINTERS;
122
123
124 //
125 // PeiCore function
126 //
127 EFI_STATUS
128 EFIAPI
129 PeiCore (
130 IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
131 IN VOID *Data
132 )
133 /*++
134
135 Routine Description:
136
137 The entry routine to Pei Core, invoked by PeiMain during transition
138 from SEC to PEI. After switching stack in the PEI core, it will restart
139 with the old core data.
140
141 Arguments:
142
143 PeiStartupDescriptor - Information and services provided by SEC phase.
144 OldCoreData - Pointer to old core data that is used to initialize the
145 core's data areas.
146
147 Returns:
148
149 This function never returns
150 EFI_NOT_FOUND - Never reach
151
152 --*/
153 ;
154
155 //
156 // Dispatcher support functions
157 //
158
159 EFI_STATUS
160 PeimDispatchReadiness (
161 IN EFI_PEI_SERVICES **PeiServices,
162 IN VOID *DependencyExpression,
163 IN OUT BOOLEAN *Runnable
164 )
165 /*++
166
167 Routine Description:
168
169 This is the POSTFIX version of the dependency evaluator. When a
170 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
171 the evaluation stack. When that entry is poped from the evaluation
172 stack, the PPI is checked if it is installed. This method allows
173 some time savings as not all PPIs must be checked for certain
174 operation types (AND, OR).
175
176 Arguments:
177
178 PeiServices - Calling context.
179
180 DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
181 the BNF described above and is stored in postfix notation.
182 Runnable - is True if the driver can be scheduled and False if the driver
183 cannot be scheduled. This is the value that the schedulers
184 should use for deciding the state of the driver.
185
186 Returns:
187
188 Status = EFI_SUCCESS if it is a well-formed Grammar
189 EFI_INVALID_PARAMETER if the dependency expression overflows
190 the evaluation stack
191 EFI_INVALID_PARAMETER if the dependency expression underflows
192 the evaluation stack
193 EFI_INVALID_PARAMETER if the dependency expression is not a
194 well-formed Grammar.
195 --*/
196 ;
197
198
199 EFI_STATUS
200 PeiDispatcher (
201 IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
202 IN PEI_CORE_INSTANCE *PrivateData,
203 IN PEI_CORE_DISPATCH_DATA *DispatchData
204 )
205
206 /*++
207
208 Routine Description:
209
210 Conduct PEIM dispatch.
211
212 Arguments:
213
214 PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
215 PrivateData - Pointer to the private data passed in from caller
216 DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
217
218 Returns:
219
220 EFI_SUCCESS - Successfully dispatched PEIM.
221 EFI_NOT_FOUND - The dispatch failed.
222
223 --*/
224 ;
225
226
227 VOID
228 InitializeDispatcherData (
229 IN EFI_PEI_SERVICES **PeiServices,
230 IN PEI_CORE_INSTANCE *OldCoreData,
231 IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor
232 )
233 /*++
234
235 Routine Description:
236
237 Initialize the Dispatcher's data members
238
239 Arguments:
240
241 PeiServices - The PEI core services table.
242 OldCoreData - Pointer to old core data (before switching stack).
243 NULL if being run in non-permament memory mode.
244 PeiStartupDescriptor - Information and services provided by SEC phase.
245
246
247 Returns:
248
249 None
250
251 --*/
252 ;
253
254
255 EFI_STATUS
256 FindNextPeim (
257 IN EFI_PEI_SERVICES **PeiServices,
258 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
259 IN OUT EFI_FFS_FILE_HEADER **PeimFileHeader
260 )
261 /*++
262
263 Routine Description:
264 Given the input file pointer, search for the next matching file in the
265 FFS volume. The search starts from FileHeader inside
266 the Firmware Volume defined by FwVolHeader.
267
268 Arguments:
269 PeiServices - Pointer to the PEI Core Services Table.
270
271 FwVolHeader - Pointer to the FV header of the volume to search.
272 This parameter must point to a valid FFS volume.
273
274 PeimFileHeader - Pointer to the current file from which to begin searching.
275 This pointer will be updated upon return to reflect the file found.
276
277 Returns:
278 EFI_NOT_FOUND - No files matching the search criteria were found
279 EFI_SUCCESS
280
281 --*/
282 ;
283
284 BOOLEAN
285 Dispatched (
286 IN UINT8 CurrentPeim,
287 IN UINT32 DispatchedPeimBitMap
288 )
289 /*++
290
291 Routine Description:
292
293 This routine checks to see if a particular PEIM has been dispatched during
294 the PEI core dispatch.
295
296 Arguments:
297 CurrentPeim - The PEIM/FV in the bit array to check.
298 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
299
300 Returns:
301 TRUE if PEIM already dispatched
302 FALSE if not
303
304 --*/
305 ;
306
307 VOID
308 SetDispatched (
309 IN EFI_PEI_SERVICES **PeiServices,
310 IN UINT8 CurrentPeim,
311 OUT UINT32 *DispatchedPeimBitMap
312 )
313 /*++
314
315 Routine Description:
316
317 This routine sets a PEIM as having been dispatched once its entry
318 point has been invoked.
319
320 Arguments:
321
322 PeiServices - The PEI core services table.
323 CurrentPeim - The PEIM/FV in the bit array to check.
324 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
325
326 Returns:
327 None
328
329 --*/
330 ;
331
332 BOOLEAN
333 DepexSatisfied (
334 IN EFI_PEI_SERVICES **PeiServices,
335 IN VOID *CurrentPeimAddress
336 )
337 /*++
338
339 Routine Description:
340
341 This routine parses the Dependency Expression, if available, and
342 decides if the module can be executed.
343
344 Arguments:
345 PeiServices - The PEI Service Table
346 CurrentPeimAddress - Address of the PEIM Firmware File under investigation
347
348 Returns:
349 TRUE - Can be dispatched
350 FALSE - Cannot be dispatched
351
352 --*/
353 ;
354
355 #if defined (MDE_CPU_IPF)
356 //
357 // In Ipf we should make special changes for the PHIT pointers to support
358 // recovery boot in cache mode.
359 //
360 #define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)
361 #define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL
362 VOID
363 SwitchToCacheMode (
364 IN PEI_CORE_INSTANCE *CoreData
365 )
366 /*++
367
368 Routine Description:
369
370 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
371
372 Arguments:
373
374 CoreData - The PEI core Private Data
375
376 Returns:
377
378 --*/
379 ;
380
381 #else
382
383 #define SWITCH_TO_CACHE_MODE(CoreData)
384
385 #endif
386
387 //
388 // PPI support functions
389 //
390 VOID
391 InitializePpiServices (
392 IN EFI_PEI_SERVICES **PeiServices,
393 IN PEI_CORE_INSTANCE *OldCoreData
394 )
395 /*++
396
397 Routine Description:
398
399 Initialize PPI services.
400
401 Arguments:
402
403 PeiServices - The PEI core services table.
404 OldCoreData - Pointer to the PEI Core data.
405 NULL if being run in non-permament memory mode.
406
407 Returns:
408 Nothing
409
410 --*/
411 ;
412
413 VOID
414 ConvertPpiPointers (
415 IN EFI_PEI_SERVICES **PeiServices,
416 IN EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob,
417 IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob
418 )
419 /*++
420
421 Routine Description:
422
423 Migrate the Hob list from the CAR stack to PEI installed memory.
424
425 Arguments:
426
427 PeiServices - The PEI core services table.
428 OldHandOffHob - The old handoff HOB list.
429 NewHandOffHob - The new handoff HOB list.
430
431 Returns:
432
433 --*/
434 ;
435
436 EFI_STATUS
437 EFIAPI
438 PeiInstallPpi (
439 IN EFI_PEI_SERVICES **PeiServices,
440 IN EFI_PEI_PPI_DESCRIPTOR *PpiList
441 )
442 /*++
443
444 Routine Description:
445
446 Install PPI services.
447
448 Arguments:
449
450 PeiServices - Pointer to the PEI Service Table
451 PpiList - Pointer to a list of PEI PPI Descriptors.
452
453 Returns:
454
455 EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
456 EFI_INVALID_PARAMETER - if PpiList is NULL pointer
457 EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
458 EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
459
460 --*/
461 ;
462
463 EFI_STATUS
464 EFIAPI
465 PeiReInstallPpi (
466 IN EFI_PEI_SERVICES **PeiServices,
467 IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
468 IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
469 )
470 /*++
471
472 Routine Description:
473
474 Re-Install PPI services.
475
476 Arguments:
477
478 PeiServices - Pointer to the PEI Service Table
479 OldPpi - Pointer to the old PEI PPI Descriptors.
480 NewPpi - Pointer to the new PEI PPI Descriptors.
481
482 Returns:
483
484 EFI_SUCCESS - if the operation was successful
485 EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
486 EFI_INVALID_PARAMETER - if NewPpi is not valid
487 EFI_NOT_FOUND - if the PPI was not in the database
488
489 --*/
490 ;
491
492 EFI_STATUS
493 EFIAPI
494 PeiLocatePpi (
495 IN EFI_PEI_SERVICES **PeiServices,
496 IN EFI_GUID *Guid,
497 IN UINTN Instance,
498 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
499 IN OUT VOID **Ppi
500 )
501 /*++
502
503 Routine Description:
504
505 Locate a given named PPI.
506
507 Arguments:
508
509 PeiServices - Pointer to the PEI Service Table
510 Guid - Pointer to GUID of the PPI.
511 Instance - Instance Number to discover.
512 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
513 returns a pointer to the descriptor (includes flags, etc)
514 Ppi - Pointer to reference the found PPI
515
516 Returns:
517
518 Status - EFI_SUCCESS if the PPI is in the database
519 EFI_NOT_FOUND if the PPI is not in the database
520 --*/
521 ;
522
523 EFI_STATUS
524 EFIAPI
525 PeiNotifyPpi (
526 IN EFI_PEI_SERVICES **PeiServices,
527 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
528 )
529 /*++
530
531 Routine Description:
532
533 Install a notification for a given PPI.
534
535 Arguments:
536
537 PeiServices - Pointer to the PEI Service Table
538 NotifyList - Pointer to list of Descriptors to notify upon.
539
540 Returns:
541
542 Status - EFI_SUCCESS if successful
543 EFI_OUT_OF_RESOURCES if no space in the database
544 EFI_INVALID_PARAMETER if not a good decriptor
545
546 --*/
547 ;
548
549 VOID
550 ProcessNotifyList (
551 IN EFI_PEI_SERVICES **PeiServices
552 )
553 /*++
554
555 Routine Description:
556
557 Process the Notify List at dispatch level.
558
559 Arguments:
560
561 PeiServices - Pointer to the PEI Service Table
562
563 Returns:
564
565 --*/
566 ;
567
568 VOID
569 DispatchNotify (
570 IN EFI_PEI_SERVICES **PeiServices,
571 IN UINTN NotifyType,
572 IN INTN InstallStartIndex,
573 IN INTN InstallStopIndex,
574 IN INTN NotifyStartIndex,
575 IN INTN NotifyStopIndex
576 )
577 /*++
578
579 Routine Description:
580
581 Dispatch notifications.
582
583 Arguments:
584
585 PeiServices - Pointer to the PEI Service Table
586 NotifyType - Type of notify to fire.
587 InstallStartIndex - Install Beginning index.
588 InstallStopIndex - Install Ending index.
589 NotifyStartIndex - Notify Beginning index.
590 NotifyStopIndex - Notify Ending index.
591
592 Returns: None
593
594 --*/
595 ;
596
597 //
598 // Boot mode support functions
599 //
600 EFI_STATUS
601 EFIAPI
602 PeiGetBootMode (
603 IN EFI_PEI_SERVICES **PeiServices,
604 IN OUT EFI_BOOT_MODE *BootMode
605 )
606 /*++
607
608 Routine Description:
609
610 This service enables PEIMs to ascertain the present value of the boot mode.
611
612 Arguments:
613
614 PeiServices - The PEI core services table.
615 BootMode - A pointer to contain the value of the boot mode.
616
617 Returns:
618
619 EFI_SUCCESS - The boot mode was returned successfully.
620 EFI_INVALID_PARAMETER - BootMode is NULL.
621
622 --*/
623 ;
624
625 EFI_STATUS
626 EFIAPI
627 PeiSetBootMode (
628 IN EFI_PEI_SERVICES **PeiServices,
629 IN EFI_BOOT_MODE BootMode
630 )
631 /*++
632
633 Routine Description:
634
635 This service enables PEIMs to update the boot mode variable.
636
637 Arguments:
638
639 PeiServices - The PEI core services table.
640 BootMode - The value of the boot mode to set.
641
642 Returns:
643
644 EFI_SUCCESS - The value was successfully updated
645
646 --*/
647 ;
648
649 //
650 // Security support functions
651 //
652 VOID
653 InitializeSecurityServices (
654 IN EFI_PEI_SERVICES **PeiServices,
655 IN PEI_CORE_INSTANCE *OldCoreData
656 )
657 /*++
658
659 Routine Description:
660
661 Initialize the security services.
662
663 Arguments:
664
665 PeiServices - The PEI core services table.
666 OldCoreData - Pointer to the old core data.
667 NULL if being run in non-permament memory mode.
668 Returns:
669
670 None
671
672 --*/
673 ;
674
675 EFI_STATUS
676 VerifyFv (
677 IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
678 )
679 /*++
680
681 Routine Description:
682
683 Provide a callout to the OEM FV verification service.
684
685 Arguments:
686
687 CurrentFvAddress - Pointer to the FV under investigation.
688
689 Returns:
690
691 Status - EFI_SUCCESS
692
693 --*/
694 ;
695
696
697 EFI_STATUS
698 VerifyPeim (
699 IN EFI_PEI_SERVICES **PeiServices,
700 IN EFI_FFS_FILE_HEADER *CurrentPeimAddress
701 )
702 /*++
703
704 Routine Description:
705
706 Provide a callout to the security verification service.
707
708 Arguments:
709
710 PeiServices - The PEI core services table.
711 CurrentPeimAddress - Pointer to the Firmware File under investigation.
712
713 Returns:
714
715 EFI_SUCCESS - Image is OK
716 EFI_SECURITY_VIOLATION - Image is illegal
717
718 --*/
719 ;
720
721
722 EFI_STATUS
723 EFIAPI
724 PeiGetHobList (
725 IN EFI_PEI_SERVICES **PeiServices,
726 IN OUT VOID **HobList
727 )
728 /*++
729
730 Routine Description:
731
732 Gets the pointer to the HOB List.
733
734 Arguments:
735
736 PeiServices - The PEI core services table.
737 HobList - Pointer to the HOB List.
738
739 Returns:
740
741 EFI_SUCCESS - Get the pointer of HOB List
742 EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
743 EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
744
745 --*/
746 ;
747
748 EFI_STATUS
749 EFIAPI
750 PeiCreateHob (
751 IN EFI_PEI_SERVICES **PeiServices,
752 IN UINT16 Type,
753 IN UINT16 Length,
754 IN OUT VOID **Hob
755 )
756 /*++
757
758 Routine Description:
759
760 Add a new HOB to the HOB List.
761
762 Arguments:
763
764 PeiServices - The PEI core services table.
765 Type - Type of the new HOB.
766 Length - Length of the new HOB to allocate.
767 Hob - Pointer to the new HOB.
768
769 Returns:
770
771 Status - EFI_SUCCESS
772 - EFI_INVALID_PARAMETER if Hob is NULL
773 - EFI_NOT_AVAILABLE_YET if HobList is still not available.
774 - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
775
776 --*/
777 ;
778
779 EFI_STATUS
780 PeiCoreBuildHobHandoffInfoTable (
781 IN EFI_BOOT_MODE BootMode,
782 IN EFI_PHYSICAL_ADDRESS MemoryBegin,
783 IN UINT64 MemoryLength
784 )
785 /*++
786
787 Routine Description:
788
789 Builds a Handoff Information Table HOB
790
791 Arguments:
792
793 BootMode - Current Bootmode
794 MemoryBegin - Start Memory Address.
795 MemoryLength - Length of Memory.
796
797 Returns:
798
799 EFI_SUCCESS
800
801 --*/
802 ;
803
804
805 //
806 // FFS Fw Volume support functions
807 //
808 EFI_STATUS
809 EFIAPI
810 PeiFfsFindNextFile (
811 IN EFI_PEI_SERVICES **PeiServices,
812 IN UINT8 SearchType,
813 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
814 IN OUT EFI_FFS_FILE_HEADER **FileHeader
815 )
816 /*++
817
818 Routine Description:
819 Given the input file pointer, search for the next matching file in the
820 FFS volume as defined by SearchType. The search starts from FileHeader inside
821 the Firmware Volume defined by FwVolHeader.
822
823 Arguments:
824 PeiServices - Pointer to the PEI Core Services Table.
825
826 SearchType - Filter to find only files of this type.
827 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
828
829 FwVolHeader - Pointer to the FV header of the volume to search.
830 This parameter must point to a valid FFS volume.
831
832 FileHeader - Pointer to the current file from which to begin searching.
833 This pointer will be updated upon return to reflect the file found.
834
835 Returns:
836 EFI_NOT_FOUND - No files matching the search criteria were found
837 EFI_SUCCESS
838
839 --*/
840 ;
841
842 EFI_STATUS
843 EFIAPI
844 PeiFfsFindSectionData (
845 IN EFI_PEI_SERVICES **PeiServices,
846 IN EFI_SECTION_TYPE SectionType,
847 IN EFI_FFS_FILE_HEADER *FfsFileHeader,
848 IN OUT VOID **SectionData
849 )
850 /*++
851
852 Routine Description:
853 Given the input file pointer, search for the next matching section in the
854 FFS volume.
855
856 Arguments:
857 PeiServices - Pointer to the PEI Core Services Table.
858 SearchType - Filter to find only sections of this type.
859 FfsFileHeader - Pointer to the current file to search.
860 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
861 - NULL if section not found
862
863 Returns:
864 EFI_NOT_FOUND - No files matching the search criteria were found
865 EFI_SUCCESS
866
867 --*/
868 ;
869
870 EFI_STATUS
871 EFIAPI
872 PeiFvFindNextVolume (
873 IN EFI_PEI_SERVICES **PeiServices,
874 IN UINTN Instance,
875 IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
876 )
877 /*++
878
879 Routine Description:
880
881 Return the BFV location
882
883 BugBug -- Move this to the location of this code to where the
884 other FV and FFS support code lives.
885 Also, update to use FindFV for instances #'s >= 1.
886
887 Arguments:
888
889 PeiServices - The PEI core services table.
890 Instance - Instance of FV to find
891 FwVolHeader - Pointer to contain the data to return
892
893 Returns:
894 Pointer to the Firmware Volume instance requested
895
896 EFI_INVALID_PARAMETER - FwVolHeader is NULL
897
898 EFI_SUCCESS - Firmware volume instance successfully found.
899
900 --*/
901 ;
902
903 //
904 // Memory support functions
905 //
906 VOID
907 InitializeMemoryServices (
908 IN EFI_PEI_SERVICES **PeiServices,
909 IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
910 IN PEI_CORE_INSTANCE *OldCoreData
911 )
912 /*++
913
914 Routine Description:
915
916 Initialize the memory services.
917
918 Arguments:
919
920 PeiServices - The PEI core services table.
921 PeiStartupDescriptor - Information and services provided by SEC phase.
922 OldCoreData - Pointer to the PEI Core data.
923 NULL if being run in non-permament memory mode.
924
925 Returns:
926
927 None
928
929 --*/
930 ;
931
932 EFI_STATUS
933 EFIAPI
934 PeiInstallPeiMemory (
935 IN EFI_PEI_SERVICES **PeiServices,
936 IN EFI_PHYSICAL_ADDRESS MemoryBegin,
937 IN UINT64 MemoryLength
938 )
939 /*++
940
941 Routine Description:
942
943 Install the permanent memory is now available.
944 Creates HOB (PHIT and Stack).
945
946 Arguments:
947
948 PeiServices - The PEI core services table.
949 MemoryBegin - Start of memory address.
950 MemoryLength - Length of memory.
951
952 Returns:
953
954 Status - EFI_SUCCESS
955
956 --*/
957 ;
958
959 EFI_STATUS
960 EFIAPI
961 PeiAllocatePages (
962 IN EFI_PEI_SERVICES **PeiServices,
963 IN EFI_MEMORY_TYPE MemoryType,
964 IN UINTN Pages,
965 OUT EFI_PHYSICAL_ADDRESS *Memory
966 )
967 /*++
968
969 Routine Description:
970
971 Memory allocation service on permanent memory,
972 not usable prior to the memory installation.
973
974 Arguments:
975
976 PeiServices - The PEI core services table.
977 Type - Type of allocation.
978 MemoryType - Type of memory to allocate.
979 Pages - Number of pages to allocate.
980 Memory - Pointer of memory allocated.
981
982 Returns:
983
984 Status - EFI_SUCCESS The allocation was successful
985 EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
986 EFI_NOT_AVAILABLE_YET Called with permanent memory not available
987 EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
988 to allocate the number of pages.
989
990 --*/
991 ;
992
993 EFI_STATUS
994 EFIAPI
995 PeiAllocatePool (
996 IN EFI_PEI_SERVICES **PeiServices,
997 IN UINTN Size,
998 OUT VOID **Buffer
999 )
1000 /*++
1001
1002 Routine Description:
1003
1004 Memory allocation service on the CAR.
1005
1006 Arguments:
1007
1008 PeiServices - The PEI core services table.
1009
1010 Size - Amount of memory required
1011
1012 Buffer - Address of pointer to the buffer
1013
1014 Returns:
1015
1016 Status - EFI_SUCCESS The allocation was successful
1017 EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1018 to allocate the requested size.
1019
1020 --*/
1021 ;
1022
1023 EFI_STATUS
1024 PeiLoadImage (
1025 IN EFI_PEI_SERVICES **PeiServices,
1026 IN EFI_FFS_FILE_HEADER *PeimFileHeader,
1027 OUT VOID **EntryPoint
1028 )
1029 /*++
1030
1031 Routine Description:
1032
1033 Get entry point of a Peim file.
1034
1035 Arguments:
1036
1037 PeiServices - Calling context.
1038
1039 PeimFileHeader - Peim file's header.
1040
1041 EntryPoint - Entry point of that Peim file.
1042
1043 Returns:
1044
1045 Status code.
1046
1047 --*/
1048 ;
1049
1050
1051 EFI_STATUS
1052 EFIAPI
1053 PeiReportStatusCode (
1054 IN EFI_PEI_SERVICES **PeiServices,
1055 IN EFI_STATUS_CODE_TYPE CodeType,
1056 IN EFI_STATUS_CODE_VALUE Value,
1057 IN UINT32 Instance,
1058 IN EFI_GUID *CallerId,
1059 IN EFI_STATUS_CODE_DATA *Data OPTIONAL
1060 )
1061 /*++
1062
1063 Routine Description:
1064
1065 Core version of the Status Code reporter
1066
1067 Arguments:
1068
1069 PeiServices - The PEI core services table.
1070
1071 CodeType - Type of Status Code.
1072
1073 Value - Value to output for Status Code.
1074
1075 Instance - Instance Number of this status code.
1076
1077 CallerId - ID of the caller of this status code.
1078
1079 Data - Optional data associated with this status code.
1080
1081 Returns:
1082
1083 Status - EFI_SUCCESS if status code is successfully reported
1084 - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1085
1086 --*/
1087 ;
1088
1089
1090 EFI_STATUS
1091 EFIAPI
1092 PeiResetSystem (
1093 IN EFI_PEI_SERVICES **PeiServices
1094 )
1095 /*++
1096
1097 Routine Description:
1098
1099 Core version of the Reset System
1100
1101 Arguments:
1102
1103 PeiServices - The PEI core services table.
1104
1105 Returns:
1106
1107 Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
1108 - EFI_DEVICE_ERROR. Did not reset system.
1109
1110 Otherwise, resets the system.
1111
1112 --*/
1113 ;
1114
1115 /**
1116 Transfers control to a function starting with a new stack.
1117
1118 Transfers control to the function specified by EntryPoint using the new stack
1119 specified by NewStack and passing in the parameters specified by Context1 and
1120 Context2. Context1 and Context2 are optional and may be NULL. The function
1121 EntryPoint must never return.
1122
1123 If EntryPoint is NULL, then ASSERT().
1124 If NewStack is NULL, then ASSERT().
1125
1126 @param EntryPoint A pointer to function to call with the new stack.
1127 @param Context1 A pointer to the context to pass into the EntryPoint
1128 function.
1129 @param Context2 A pointer to the context to pass into the EntryPoint
1130 function.
1131 @param NewStack A pointer to the new stack to use for the EntryPoint
1132 function.
1133 @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
1134 Reserved on other architectures.
1135
1136 **/
1137 VOID
1138 EFIAPI
1139 PeiSwitchStacks (
1140 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
1141 IN VOID *Context1, OPTIONAL
1142 IN VOID *Context2, OPTIONAL
1143 IN VOID *NewStack,
1144 IN VOID *NewBsp
1145 );
1146
1147 #endif