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