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