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