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