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