2 EFI PEI Core PPI services
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Initialize PPI services.
21 @param PrivateData Pointer to the PEI Core data.
22 @param OldCoreData Pointer to old PEI Core data.
23 NULL if being run in non-permament memory mode.
27 InitializePpiServices (
28 IN PEI_CORE_INSTANCE
*PrivateData
,
29 IN PEI_CORE_INSTANCE
*OldCoreData
32 if (OldCoreData
== NULL
) {
33 PrivateData
->PpiData
.NotifyListEnd
= PcdGet32 (PcdPeiCoreMaxPpiSupported
)-1;
34 PrivateData
->PpiData
.DispatchListEnd
= PcdGet32 (PcdPeiCoreMaxPpiSupported
)-1;
35 PrivateData
->PpiData
.LastDispatchedNotify
= PcdGet32 (PcdPeiCoreMaxPpiSupported
)-1;
41 Migrate Pointer from the temporary memory to PEI installed memory.
43 @param Pointer Pointer to the Pointer needs to be converted.
44 @param TempBottom Base of old temporary memory
45 @param TempTop Top of old temporary memory
46 @param Offset Offset of new memory to old temporary memory.
47 @param OffsetPositive Positive flag of Offset value.
52 IN OUT VOID
**Pointer
,
56 IN BOOLEAN OffsetPositive
59 if (((UINTN
) *Pointer
< TempTop
) &&
60 ((UINTN
) *Pointer
>= TempBottom
)) {
62 *Pointer
= (VOID
*) ((UINTN
) *Pointer
+ Offset
);
64 *Pointer
= (VOID
*) ((UINTN
) *Pointer
- Offset
);
71 Migrate Pointer in ranges of the temporary memory to PEI installed memory.
73 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
74 and location of temporary RAM, the stack location and the BFV location.
75 @param PrivateData Pointer to PeiCore's private data structure.
76 @param Pointer Pointer to the Pointer needs to be converted.
80 ConvertPointerInRanges (
81 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
82 IN PEI_CORE_INSTANCE
*PrivateData
,
88 if (PrivateData
->MemoryPages
.Size
!= 0) {
90 // Convert PPI pointer in old memory pages
91 // It needs to be done before Convert PPI pointer in old Heap
95 (UINTN
)PrivateData
->MemoryPages
.Base
,
96 (UINTN
)PrivateData
->MemoryPages
.Base
+ PrivateData
->MemoryPages
.Size
,
97 PrivateData
->MemoryPages
.Offset
,
98 PrivateData
->MemoryPages
.OffsetPositive
103 // Convert PPI pointer in old Heap
107 (UINTN
)SecCoreData
->PeiTemporaryRamBase
,
108 (UINTN
)SecCoreData
->PeiTemporaryRamBase
+ SecCoreData
->PeiTemporaryRamSize
,
109 PrivateData
->HeapOffset
,
110 PrivateData
->HeapOffsetPositive
114 // Convert PPI pointer in old Stack
118 (UINTN
)SecCoreData
->StackBase
,
119 (UINTN
)SecCoreData
->StackBase
+ SecCoreData
->StackSize
,
120 PrivateData
->StackOffset
,
121 PrivateData
->StackOffsetPositive
125 // Convert PPI pointer in old TempRam Hole
127 for (IndexHole
= 0; IndexHole
< HOLE_MAX_NUMBER
; IndexHole
++) {
128 if (PrivateData
->HoleData
[IndexHole
].Size
== 0) {
134 (UINTN
)PrivateData
->HoleData
[IndexHole
].Base
,
135 (UINTN
)PrivateData
->HoleData
[IndexHole
].Base
+ PrivateData
->HoleData
[IndexHole
].Size
,
136 PrivateData
->HoleData
[IndexHole
].Offset
,
137 PrivateData
->HoleData
[IndexHole
].OffsetPositive
144 Migrate Single PPI Pointer from the temporary memory to PEI installed memory.
146 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
147 and location of temporary RAM, the stack location and the BFV location.
148 @param PrivateData Pointer to PeiCore's private data structure.
149 @param PpiPointer Pointer to Ppi
153 ConvertSinglePpiPointer (
154 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
155 IN PEI_CORE_INSTANCE
*PrivateData
,
156 IN PEI_PPI_LIST_POINTERS
*PpiPointer
160 // 1. Convert the pointer to the PPI descriptor from the old TempRam
161 // to the relocated physical memory.
162 // It (for the pointer to the PPI descriptor) needs to be done before 2 (for
163 // the pointer to the GUID) and 3 (for the pointer to the PPI interface structure).
165 ConvertPointerInRanges (SecCoreData
, PrivateData
, &PpiPointer
->Raw
);
167 // 2. Convert the pointer to the GUID in the PPI or NOTIFY descriptor
168 // from the old TempRam to the relocated physical memory.
170 ConvertPointerInRanges (SecCoreData
, PrivateData
, (VOID
**) &PpiPointer
->Ppi
->Guid
);
172 // 3. Convert the pointer to the PPI interface structure in the PPI descriptor
173 // from the old TempRam to the relocated physical memory.
175 ConvertPointerInRanges (SecCoreData
, PrivateData
, (VOID
**) &PpiPointer
->Ppi
->Ppi
);
180 Migrate PPI Pointers from the temporary memory to PEI installed memory.
182 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
183 and location of temporary RAM, the stack location and the BFV location.
184 @param PrivateData Pointer to PeiCore's private data structure.
189 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
190 IN PEI_CORE_INSTANCE
*PrivateData
195 for (Index
= 0; Index
< PcdGet32 (PcdPeiCoreMaxPpiSupported
); Index
++) {
196 if (Index
< PrivateData
->PpiData
.PpiListEnd
|| Index
> PrivateData
->PpiData
.NotifyListEnd
) {
197 ConvertSinglePpiPointer (
200 &PrivateData
->PpiData
.PpiListPtrs
[Index
]
208 This function installs an interface in the PEI PPI database by GUID.
209 The purpose of the service is to publish an interface that other parties
210 can use to call additional PEIMs.
212 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
213 @param PpiList Pointer to a list of PEI PPI Descriptors.
214 @param Single TRUE if only single entry in the PpiList.
215 FALSE if the PpiList is ended with an entry which has the
216 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set in its Flags field.
218 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
219 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
220 if any PPI in PpiList is not valid
221 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
225 InternalPeiInstallPpi (
226 IN CONST EFI_PEI_SERVICES
**PeiServices
,
227 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
231 PEI_CORE_INSTANCE
*PrivateData
;
233 INTN LastCallbackInstall
;
236 if (PpiList
== NULL
) {
237 return EFI_INVALID_PARAMETER
;
240 PrivateData
= PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices
);
242 Index
= PrivateData
->PpiData
.PpiListEnd
;
243 LastCallbackInstall
= Index
;
246 // This is loop installs all PPI descriptors in the PpiList. It is terminated
247 // by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last
248 // EFI_PEI_PPI_DESCRIPTOR in the list.
253 // Since PpiData is used for NotifyList and PpiList, max resource
254 // is reached if the Install reaches the NotifyList
255 // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more PPI requirement.
257 if (Index
== PrivateData
->PpiData
.NotifyListEnd
+ 1) {
258 return EFI_OUT_OF_RESOURCES
;
261 // Check if it is a valid PPI.
262 // If not, rollback list to exclude all in this list.
263 // Try to indicate which item failed.
265 if ((PpiList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_PPI
) == 0) {
266 PrivateData
->PpiData
.PpiListEnd
= LastCallbackInstall
;
267 DEBUG((EFI_D_ERROR
, "ERROR -> InstallPpi: %g %p\n", PpiList
->Guid
, PpiList
->Ppi
));
268 return EFI_INVALID_PARAMETER
;
271 DEBUG((EFI_D_INFO
, "Install PPI: %g\n", PpiList
->Guid
));
272 PrivateData
->PpiData
.PpiListPtrs
[Index
].Ppi
= (EFI_PEI_PPI_DESCRIPTOR
*) PpiList
;
273 PrivateData
->PpiData
.PpiListEnd
++;
277 // Only single entry in the PpiList.
280 } else if ((PpiList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) ==
281 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) {
283 // Continue until the end of the PPI List.
292 // Dispatch any callback level notifies for newly installed PPIs.
296 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
,
298 PrivateData
->PpiData
.PpiListEnd
,
299 PrivateData
->PpiData
.DispatchListEnd
,
300 PrivateData
->PpiData
.NotifyListEnd
309 This function installs an interface in the PEI PPI database by GUID.
310 The purpose of the service is to publish an interface that other parties
311 can use to call additional PEIMs.
313 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
314 @param PpiList Pointer to a list of PEI PPI Descriptors.
316 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
317 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
318 if any PPI in PpiList is not valid
319 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
325 IN CONST EFI_PEI_SERVICES
**PeiServices
,
326 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
329 return InternalPeiInstallPpi (PeiServices
, PpiList
, FALSE
);
334 This function reinstalls an interface in the PEI PPI database by GUID.
335 The purpose of the service is to publish an interface that other parties can
336 use to replace an interface of the same name in the protocol database with a
339 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
340 @param OldPpi Pointer to the old PEI PPI Descriptors.
341 @param NewPpi Pointer to the new PEI PPI Descriptors.
343 @retval EFI_SUCCESS if the operation was successful
344 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
345 @retval EFI_INVALID_PARAMETER if NewPpi is not valid
346 @retval EFI_NOT_FOUND if the PPI was not in the database
352 IN CONST EFI_PEI_SERVICES
**PeiServices
,
353 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
354 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
357 PEI_CORE_INSTANCE
*PrivateData
;
361 if ((OldPpi
== NULL
) || (NewPpi
== NULL
)) {
362 return EFI_INVALID_PARAMETER
;
365 if ((NewPpi
->Flags
& EFI_PEI_PPI_DESCRIPTOR_PPI
) == 0) {
366 return EFI_INVALID_PARAMETER
;
369 PrivateData
= PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices
);
372 // Find the old PPI instance in the database. If we can not find it,
373 // return the EFI_NOT_FOUND error.
375 for (Index
= 0; Index
< PrivateData
->PpiData
.PpiListEnd
; Index
++) {
376 if (OldPpi
== PrivateData
->PpiData
.PpiListPtrs
[Index
].Ppi
) {
380 if (Index
== PrivateData
->PpiData
.PpiListEnd
) {
381 return EFI_NOT_FOUND
;
385 // Remove the old PPI from the database, add the new one.
387 DEBUG((EFI_D_INFO
, "Reinstall PPI: %g\n", NewPpi
->Guid
));
388 ASSERT (Index
< (INTN
)(PcdGet32 (PcdPeiCoreMaxPpiSupported
)));
389 PrivateData
->PpiData
.PpiListPtrs
[Index
].Ppi
= (EFI_PEI_PPI_DESCRIPTOR
*) NewPpi
;
392 // Dispatch any callback level notifies for the newly installed PPI.
396 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
,
399 PrivateData
->PpiData
.DispatchListEnd
,
400 PrivateData
->PpiData
.NotifyListEnd
409 Locate a given named PPI.
412 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
413 @param Guid Pointer to GUID of the PPI.
414 @param Instance Instance Number to discover.
415 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
416 returns a pointer to the descriptor (includes flags, etc)
417 @param Ppi Pointer to reference the found PPI
419 @retval EFI_SUCCESS if the PPI is in the database
420 @retval EFI_NOT_FOUND if the PPI is not in the database
426 IN CONST EFI_PEI_SERVICES
**PeiServices
,
427 IN CONST EFI_GUID
*Guid
,
429 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
433 PEI_CORE_INSTANCE
*PrivateData
;
436 EFI_PEI_PPI_DESCRIPTOR
*TempPtr
;
439 PrivateData
= PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices
);
442 // Search the data base for the matching instance of the GUIDed PPI.
444 for (Index
= 0; Index
< PrivateData
->PpiData
.PpiListEnd
; Index
++) {
445 TempPtr
= PrivateData
->PpiData
.PpiListPtrs
[Index
].Ppi
;
446 CheckGuid
= TempPtr
->Guid
;
449 // Don't use CompareGuid function here for performance reasons.
450 // Instead we compare the GUID as INT32 at a time and branch
451 // on the first failed comparison.
453 if ((((INT32
*)Guid
)[0] == ((INT32
*)CheckGuid
)[0]) &&
454 (((INT32
*)Guid
)[1] == ((INT32
*)CheckGuid
)[1]) &&
455 (((INT32
*)Guid
)[2] == ((INT32
*)CheckGuid
)[2]) &&
456 (((INT32
*)Guid
)[3] == ((INT32
*)CheckGuid
)[3])) {
459 if (PpiDescriptor
!= NULL
) {
460 *PpiDescriptor
= TempPtr
;
474 return EFI_NOT_FOUND
;
479 This function installs a notification service to be called back when a given
480 interface is installed or reinstalled. The purpose of the service is to publish
481 an interface that other parties can use to call additional PPIs that may materialize later.
483 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
484 @param NotifyList Pointer to list of Descriptors to notify upon.
485 @param Single TRUE if only single entry in the NotifyList.
486 FALSE if the NotifyList is ended with an entry which has the
487 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set in its Flags field.
489 @retval EFI_SUCCESS if successful
490 @retval EFI_OUT_OF_RESOURCES if no space in the database
491 @retval EFI_INVALID_PARAMETER if not a good descriptor
495 InternalPeiNotifyPpi (
496 IN CONST EFI_PEI_SERVICES
**PeiServices
,
497 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
,
501 PEI_CORE_INSTANCE
*PrivateData
;
504 INTN LastCallbackNotify
;
505 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyPtr
;
506 UINTN NotifyDispatchCount
;
509 NotifyDispatchCount
= 0;
511 if (NotifyList
== NULL
) {
512 return EFI_INVALID_PARAMETER
;
515 PrivateData
= PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices
);
517 Index
= PrivateData
->PpiData
.NotifyListEnd
;
518 LastCallbackNotify
= Index
;
521 // This is loop installs all Notify descriptors in the NotifyList. It is
522 // terminated by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last
523 // EFI_PEI_NOTIFY_DESCRIPTOR in the list.
528 // Since PpiData is used for NotifyList and InstallList, max resource
529 // is reached if the Install reaches the PpiList
530 // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more Notify PPIs requirement.
532 if (Index
== PrivateData
->PpiData
.PpiListEnd
- 1) {
533 return EFI_OUT_OF_RESOURCES
;
537 // If some of the PPI data is invalid restore original Notify PPI database value
539 if ((NotifyList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES
) == 0) {
540 PrivateData
->PpiData
.NotifyListEnd
= LastCallbackNotify
;
541 DEBUG((EFI_D_ERROR
, "ERROR -> InstallNotify: %g %p\n", NotifyList
->Guid
, NotifyList
->Notify
));
542 return EFI_INVALID_PARAMETER
;
545 if ((NotifyList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH
) != 0) {
546 NotifyDispatchCount
++;
549 PrivateData
->PpiData
.PpiListPtrs
[Index
].Notify
= (EFI_PEI_NOTIFY_DESCRIPTOR
*) NotifyList
;
551 PrivateData
->PpiData
.NotifyListEnd
--;
552 DEBUG((EFI_D_INFO
, "Register PPI Notify: %g\n", NotifyList
->Guid
));
555 // Only single entry in the NotifyList.
558 } else if ((NotifyList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) ==
559 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) {
561 // Continue until the end of the Notify List.
566 // Go the next descriptor. Remember the NotifyList moves down.
573 // If there is Dispatch Notify PPI installed put them on the bottom
575 if (NotifyDispatchCount
> 0) {
576 for (NotifyIndex
= LastCallbackNotify
; NotifyIndex
> PrivateData
->PpiData
.NotifyListEnd
; NotifyIndex
--) {
577 if ((PrivateData
->PpiData
.PpiListPtrs
[NotifyIndex
].Notify
->Flags
& EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH
) != 0) {
578 NotifyPtr
= PrivateData
->PpiData
.PpiListPtrs
[NotifyIndex
].Notify
;
580 for (Index
= NotifyIndex
; Index
< PrivateData
->PpiData
.DispatchListEnd
; Index
++){
581 PrivateData
->PpiData
.PpiListPtrs
[Index
].Notify
= PrivateData
->PpiData
.PpiListPtrs
[Index
+ 1].Notify
;
583 PrivateData
->PpiData
.PpiListPtrs
[Index
].Notify
= NotifyPtr
;
584 PrivateData
->PpiData
.DispatchListEnd
--;
588 LastCallbackNotify
-= NotifyDispatchCount
;
592 // Dispatch any callback level notifies for all previously installed PPIs.
596 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
,
598 PrivateData
->PpiData
.PpiListEnd
,
600 PrivateData
->PpiData
.NotifyListEnd
608 This function installs a notification service to be called back when a given
609 interface is installed or reinstalled. The purpose of the service is to publish
610 an interface that other parties can use to call additional PPIs that may materialize later.
612 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
613 @param NotifyList Pointer to list of Descriptors to notify upon.
615 @retval EFI_SUCCESS if successful
616 @retval EFI_OUT_OF_RESOURCES if no space in the database
617 @retval EFI_INVALID_PARAMETER if not a good descriptor
623 IN CONST EFI_PEI_SERVICES
**PeiServices
,
624 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
627 return InternalPeiNotifyPpi (PeiServices
, NotifyList
, FALSE
);
633 Process the Notify List at dispatch level.
635 @param PrivateData PeiCore's private data structure.
640 IN PEI_CORE_INSTANCE
*PrivateData
647 // Check if the PEIM that was just dispatched resulted in any
648 // Notifies getting installed. If so, go process any dispatch
649 // level Notifies that match the previouly installed PPIs.
650 // Use "while" instead of "if" since DispatchNotify can modify
651 // DispatchListEnd (with NotifyPpi) so we have to iterate until the same.
653 while (PrivateData
->PpiData
.LastDispatchedNotify
!= PrivateData
->PpiData
.DispatchListEnd
) {
654 TempValue
= PrivateData
->PpiData
.DispatchListEnd
;
657 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH
,
659 PrivateData
->PpiData
.LastDispatchedInstall
,
660 PrivateData
->PpiData
.LastDispatchedNotify
,
661 PrivateData
->PpiData
.DispatchListEnd
663 PrivateData
->PpiData
.LastDispatchedNotify
= TempValue
;
668 // Check if the PEIM that was just dispatched resulted in any
669 // PPIs getting installed. If so, go process any dispatch
670 // level Notifies that match the installed PPIs.
671 // Use "while" instead of "if" since DispatchNotify can modify
672 // PpiListEnd (with InstallPpi) so we have to iterate until the same.
674 while (PrivateData
->PpiData
.LastDispatchedInstall
!= PrivateData
->PpiData
.PpiListEnd
) {
675 TempValue
= PrivateData
->PpiData
.PpiListEnd
;
678 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH
,
679 PrivateData
->PpiData
.LastDispatchedInstall
,
680 PrivateData
->PpiData
.PpiListEnd
,
681 PcdGet32 (PcdPeiCoreMaxPpiSupported
)-1,
682 PrivateData
->PpiData
.DispatchListEnd
684 PrivateData
->PpiData
.LastDispatchedInstall
= TempValue
;
687 if (PrivateData
->PpiData
.LastDispatchedNotify
== PrivateData
->PpiData
.DispatchListEnd
) {
696 Dispatch notifications.
698 @param PrivateData PeiCore's private data structure
699 @param NotifyType Type of notify to fire.
700 @param InstallStartIndex Install Beginning index.
701 @param InstallStopIndex Install Ending index.
702 @param NotifyStartIndex Notify Beginning index.
703 @param NotifyStopIndex Notify Ending index.
708 IN PEI_CORE_INSTANCE
*PrivateData
,
710 IN INTN InstallStartIndex
,
711 IN INTN InstallStopIndex
,
712 IN INTN NotifyStartIndex
,
713 IN INTN NotifyStopIndex
718 EFI_GUID
*SearchGuid
;
720 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
723 // Remember that Installs moves up and Notifies moves down.
725 for (Index1
= NotifyStartIndex
; Index1
> NotifyStopIndex
; Index1
--) {
726 NotifyDescriptor
= PrivateData
->PpiData
.PpiListPtrs
[Index1
].Notify
;
728 CheckGuid
= NotifyDescriptor
->Guid
;
730 for (Index2
= InstallStartIndex
; Index2
< InstallStopIndex
; Index2
++) {
731 SearchGuid
= PrivateData
->PpiData
.PpiListPtrs
[Index2
].Ppi
->Guid
;
733 // Don't use CompareGuid function here for performance reasons.
734 // Instead we compare the GUID as INT32 at a time and branch
735 // on the first failed comparison.
737 if ((((INT32
*)SearchGuid
)[0] == ((INT32
*)CheckGuid
)[0]) &&
738 (((INT32
*)SearchGuid
)[1] == ((INT32
*)CheckGuid
)[1]) &&
739 (((INT32
*)SearchGuid
)[2] == ((INT32
*)CheckGuid
)[2]) &&
740 (((INT32
*)SearchGuid
)[3] == ((INT32
*)CheckGuid
)[3])) {
741 DEBUG ((EFI_D_INFO
, "Notify: PPI Guid: %g, Peim notify entry point: %p\n",
743 NotifyDescriptor
->Notify
745 NotifyDescriptor
->Notify (
746 (EFI_PEI_SERVICES
**) GetPeiServicesTablePointer (),
748 (PrivateData
->PpiData
.PpiListPtrs
[Index2
].Ppi
)->Ppi
756 Process PpiList from SEC phase.
758 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
759 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
760 These PPI's will be installed and/or immediately signaled if they are notification type.
764 ProcessPpiListFromSec (
765 IN CONST EFI_PEI_SERVICES
**PeiServices
,
766 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
770 EFI_SEC_HOB_DATA_PPI
*SecHobDataPpi
;
771 EFI_HOB_GENERIC_HEADER
*SecHobList
;
774 if ((PpiList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES
) != 0) {
776 // It is a notification PPI.
778 Status
= InternalPeiNotifyPpi (PeiServices
, (CONST EFI_PEI_NOTIFY_DESCRIPTOR
*) PpiList
, TRUE
);
779 ASSERT_EFI_ERROR (Status
);
782 // It is a normal PPI.
784 Status
= InternalPeiInstallPpi (PeiServices
, PpiList
, TRUE
);
785 ASSERT_EFI_ERROR (Status
);
788 if ((PpiList
->Flags
& EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) == EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
) {
790 // Continue until the end of the PPI List.
799 // If the EFI_SEC_HOB_DATA_PPI is in the list of PPIs passed to the PEI entry point,
800 // the PEI Foundation will call the GetHobs() member function and install all HOBs
801 // returned into the HOB list. It does this after installing all PPIs passed from SEC
802 // into the PPI database and before dispatching any PEIMs.
804 Status
= PeiLocatePpi (PeiServices
, &gEfiSecHobDataPpiGuid
, 0, NULL
, (VOID
**) &SecHobDataPpi
);
805 if (!EFI_ERROR (Status
)) {
806 Status
= SecHobDataPpi
->GetHobs (SecHobDataPpi
, &SecHobList
);
807 if (!EFI_ERROR (Status
)) {
808 Status
= PeiInstallSecHobData (PeiServices
, SecHobList
);
809 ASSERT_EFI_ERROR (Status
);