]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/Ppi/Ppi.c
Fix the ICC waring for unreachable code.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Ppi / Ppi.c
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 EFI PEI Core PPI services\r
3 \r
58dcdada 4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
192f6d4c 12\r
b1f6a7c6 13**/\r
192f6d4c 14\r
b1f6a7c6 15#include <PeiMain.h>\r
192f6d4c 16\r
b1f6a7c6 17/**\r
192f6d4c 18\r
b1f6a7c6 19 Initialize PPI services.\r
192f6d4c 20\r
192f6d4c 21\r
b1f6a7c6 22 @param PrivateData Pointer to the PEI Core data.\r
23 @param OldCoreData Pointer to old PEI Core data. \r
24 NULL if being run in non-permament memory mode.\r
192f6d4c 25\r
b1f6a7c6 26**/\r
192f6d4c 27VOID\r
28InitializePpiServices (\r
b0d803fe 29 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 30 IN PEI_CORE_INSTANCE *OldCoreData\r
31 )\r
192f6d4c 32{\r
192f6d4c 33 if (OldCoreData == NULL) {\r
eaf539d0
LG
34 PrivateData->PpiData.NotifyListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;\r
35 PrivateData->PpiData.DispatchListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;\r
36 PrivateData->PpiData.LastDispatchedNotify = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;\r
192f6d4c 37 }\r
192f6d4c 38}\r
39\r
b1f6a7c6 40/**\r
41\r
42 Migrate the Hob list from the CAR stack to PEI installed memory.\r
43\r
44 @param PeiServices The PEI core services table.\r
45 @param OldCheckingBottom The old checking bottom.\r
46 @param OldCheckingTop The old checking top.\r
47 @param NewHandOffHob The new handoff HOB list.\r
48\r
49**/\r
192f6d4c 50VOID\r
51ConvertPpiPointers (\r
0c2b5da8 52 IN CONST EFI_PEI_SERVICES **PeiServices,\r
58dcdada 53 IN UINTN OldCheckingBottom,\r
54 IN UINTN OldCheckingTop,\r
192f6d4c 55 IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob\r
56 )\r
192f6d4c 57{\r
58 PEI_CORE_INSTANCE *PrivateData;\r
59 UINT8 Index;\r
60 PEI_PPI_LIST_POINTERS *PpiPointer;\r
61 UINTN Fixup;\r
62\r
63 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
64\r
58dcdada 65 Fixup = (UINTN)NewHandOffHob - OldCheckingBottom;\r
66\r
eaf539d0 67 for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxPpiSupported); Index++) {\r
192f6d4c 68 if (Index < PrivateData->PpiData.PpiListEnd ||\r
69 Index > PrivateData->PpiData.NotifyListEnd) {\r
70 PpiPointer = &PrivateData->PpiData.PpiListPtrs[Index];\r
58dcdada 71\r
72 if (((UINTN)PpiPointer->Raw < OldCheckingTop) &&\r
73 ((UINTN)PpiPointer->Raw >= OldCheckingBottom)) {\r
192f6d4c 74 //\r
75 // Convert the pointer to the PEIM descriptor from the old HOB heap\r
76 // to the relocated HOB heap.\r
77 //\r
78 PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw + Fixup);\r
79\r
80 //\r
81 // Only when the PEIM descriptor is in the old HOB should it be necessary\r
82 // to try to convert the pointers in the PEIM descriptor\r
83 //\r
58dcdada 84\r
85 if (((UINTN)PpiPointer->Ppi->Guid < OldCheckingTop) &&\r
86 ((UINTN)PpiPointer->Ppi->Guid >= OldCheckingBottom)) {\r
192f6d4c 87 //\r
88 // Convert the pointer to the GUID in the PPI or NOTIFY descriptor\r
89 // from the old HOB heap to the relocated HOB heap.\r
90 //\r
91 PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + Fixup);\r
92 }\r
93\r
94 //\r
95 // Assume that no code is located in the temporary memory, so the pointer to\r
96 // the notification function in the NOTIFY descriptor needs not be converted.\r
97 //\r
98 if (Index < PrivateData->PpiData.PpiListEnd &&\r
58dcdada 99 (UINTN)PpiPointer->Ppi->Ppi < OldCheckingTop &&\r
100 (UINTN)PpiPointer->Ppi->Ppi >= OldCheckingBottom) {\r
192f6d4c 101 //\r
102 // Convert the pointer to the PPI interface structure in the PPI descriptor\r
103 // from the old HOB heap to the relocated HOB heap.\r
104 //\r
58dcdada 105 PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi+ Fixup);\r
192f6d4c 106 }\r
107 }\r
108 }\r
109 }\r
110}\r
111\r
b1f6a7c6 112/**\r
192f6d4c 113\r
b1f6a7c6 114 Install PPI services.\r
192f6d4c 115\r
b1f6a7c6 116 @param PeiServices - Pointer to the PEI Service Table\r
117 @param PpiList - Pointer to a list of PEI PPI Descriptors.\r
118\r
119 @retval EFI_SUCCESS - if all PPIs in PpiList are successfully installed.\r
120 @retval EFI_INVALID_PARAMETER - if PpiList is NULL pointer\r
121 @retval EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid\r
122 @retval EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI\r
123\r
124**/\r
192f6d4c 125EFI_STATUS\r
126EFIAPI\r
127PeiInstallPpi (\r
0c2b5da8 128 IN CONST EFI_PEI_SERVICES **PeiServices,\r
129 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
192f6d4c 130 )\r
192f6d4c 131{\r
132 PEI_CORE_INSTANCE *PrivateData;\r
133 INTN Index;\r
134 INTN LastCallbackInstall;\r
135\r
136\r
137 if (PpiList == NULL) {\r
138 return EFI_INVALID_PARAMETER;\r
139 }\r
140\r
141 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
142\r
143 Index = PrivateData->PpiData.PpiListEnd;\r
144 LastCallbackInstall = Index;\r
145\r
146 //\r
147 // This is loop installs all PPI descriptors in the PpiList. It is terminated\r
148 // by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last\r
149 // EFI_PEI_PPI_DESCRIPTOR in the list.\r
150 //\r
58dcdada 151\r
192f6d4c 152 for (;;) {\r
153 //\r
154 // Since PpiData is used for NotifyList and InstallList, max resource\r
155 // is reached if the Install reaches the NotifyList\r
156 //\r
157 if (Index == PrivateData->PpiData.NotifyListEnd + 1) {\r
158 return EFI_OUT_OF_RESOURCES;\r
159 }\r
160 //\r
58dcdada 161 // Check if it is a valid PPI.\r
192f6d4c 162 // If not, rollback list to exclude all in this list.\r
163 // Try to indicate which item failed.\r
164 //\r
165 if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {\r
166 PrivateData->PpiData.PpiListEnd = LastCallbackInstall;\r
167 DEBUG((EFI_D_ERROR, "ERROR -> InstallPpi: %g %x\n", PpiList->Guid, PpiList->Ppi));\r
168 return EFI_INVALID_PARAMETER;\r
169 }\r
170\r
58dcdada 171 DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid));\r
172 PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList;\r
192f6d4c 173 PrivateData->PpiData.PpiListEnd++;\r
58dcdada 174\r
192f6d4c 175 //\r
176 // Continue until the end of the PPI List.\r
177 //\r
58dcdada 178 if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==\r
192f6d4c 179 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {\r
180 break;\r
181 }\r
182 PpiList++;\r
183 Index++;\r
184 }\r
185\r
186 //\r
187 // Dispatch any callback level notifies for newly installed PPIs.\r
188 //\r
189 DispatchNotify (\r
b0d803fe 190 PrivateData,\r
192f6d4c 191 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
192 LastCallbackInstall,\r
193 PrivateData->PpiData.PpiListEnd,\r
58dcdada 194 PrivateData->PpiData.DispatchListEnd,\r
192f6d4c 195 PrivateData->PpiData.NotifyListEnd\r
196 );\r
197\r
198\r
199 return EFI_SUCCESS;\r
200}\r
201\r
b1f6a7c6 202/**\r
203\r
204 Re-Install PPI services.\r
205\r
206 @param PeiServices - Pointer to the PEI Service Table\r
207 @param OldPpi - Pointer to the old PEI PPI Descriptors.\r
208 @param NewPpi - Pointer to the new PEI PPI Descriptors.\r
192f6d4c 209\r
b1f6a7c6 210 @retval EFI_SUCCESS - if the operation was successful\r
211 @retval EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL\r
212 @retval EFI_INVALID_PARAMETER - if NewPpi is not valid\r
213 @retval EFI_NOT_FOUND - if the PPI was not in the database\r
214\r
215**/\r
192f6d4c 216EFI_STATUS\r
217EFIAPI\r
218PeiReInstallPpi (\r
0c2b5da8 219 IN CONST EFI_PEI_SERVICES **PeiServices,\r
220 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
221 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
192f6d4c 222 )\r
192f6d4c 223{\r
224 PEI_CORE_INSTANCE *PrivateData;\r
225 INTN Index;\r
226\r
227\r
228 if ((OldPpi == NULL) || (NewPpi == NULL)) {\r
229 return EFI_INVALID_PARAMETER;\r
230 }\r
231\r
232 if ((NewPpi->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {\r
233 return EFI_INVALID_PARAMETER;\r
234 }\r
235\r
236 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
237\r
238 //\r
239 // Find the old PPI instance in the database. If we can not find it,\r
240 // return the EFI_NOT_FOUND error.\r
241 //\r
242 for (Index = 0; Index < PrivateData->PpiData.PpiListEnd; Index++) {\r
243 if (OldPpi == PrivateData->PpiData.PpiListPtrs[Index].Ppi) {\r
244 break;\r
245 }\r
246 }\r
247 if (Index == PrivateData->PpiData.PpiListEnd) {\r
248 return EFI_NOT_FOUND;\r
249 }\r
250\r
251 //\r
252 // Remove the old PPI from the database, add the new one.\r
58dcdada 253 //\r
192f6d4c 254 DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));\r
0c2b5da8 255 PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi;\r
192f6d4c 256\r
257 //\r
258 // Dispatch any callback level notifies for the newly installed PPI.\r
259 //\r
260 DispatchNotify (\r
b0d803fe 261 PrivateData,\r
192f6d4c 262 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
263 Index,\r
264 Index+1,\r
58dcdada 265 PrivateData->PpiData.DispatchListEnd,\r
192f6d4c 266 PrivateData->PpiData.NotifyListEnd\r
267 );\r
268\r
269\r
270 return EFI_SUCCESS;\r
271}\r
272\r
b1f6a7c6 273/**\r
274\r
275 Locate a given named PPI.\r
276\r
192f6d4c 277\r
b1f6a7c6 278 @param PeiServices - Pointer to the PEI Service Table\r
279 @param Guid - Pointer to GUID of the PPI.\r
280 @param Instance - Instance Number to discover.\r
281 @param PpiDescriptor - Pointer to reference the found descriptor. If not NULL,\r
282 returns a pointer to the descriptor (includes flags, etc)\r
283 @param Ppi - Pointer to reference the found PPI\r
284\r
285 @retval EFI_SUCCESS if the PPI is in the database\r
286 @retval EFI_NOT_FOUND if the PPI is not in the database\r
287\r
288**/\r
192f6d4c 289EFI_STATUS\r
290EFIAPI\r
291PeiLocatePpi (\r
0c2b5da8 292 IN CONST EFI_PEI_SERVICES **PeiServices,\r
293 IN CONST EFI_GUID *Guid,\r
192f6d4c 294 IN UINTN Instance,\r
295 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
296 IN OUT VOID **Ppi\r
297 )\r
192f6d4c 298{\r
299 PEI_CORE_INSTANCE *PrivateData;\r
300 INTN Index;\r
301 EFI_GUID *CheckGuid;\r
302 EFI_PEI_PPI_DESCRIPTOR *TempPtr;\r
303\r
58dcdada 304\r
192f6d4c 305 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
306\r
307 //\r
308 // Search the data base for the matching instance of the GUIDed PPI.\r
309 //\r
310 for (Index = 0; Index < PrivateData->PpiData.PpiListEnd; Index++) {\r
311 TempPtr = PrivateData->PpiData.PpiListPtrs[Index].Ppi;\r
312 CheckGuid = TempPtr->Guid;\r
313\r
314 //\r
315 // Don't use CompareGuid function here for performance reasons.\r
316 // Instead we compare the GUID as INT32 at a time and branch\r
317 // on the first failed comparison.\r
318 //\r
319 if ((((INT32 *)Guid)[0] == ((INT32 *)CheckGuid)[0]) &&\r
320 (((INT32 *)Guid)[1] == ((INT32 *)CheckGuid)[1]) &&\r
321 (((INT32 *)Guid)[2] == ((INT32 *)CheckGuid)[2]) &&\r
322 (((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3])) {\r
323 if (Instance == 0) {\r
324\r
325 if (PpiDescriptor != NULL) {\r
326 *PpiDescriptor = TempPtr;\r
327 }\r
328\r
329 if (Ppi != NULL) {\r
330 *Ppi = TempPtr->Ppi;\r
331 }\r
332\r
333\r
334 return EFI_SUCCESS;\r
335 }\r
336 Instance--;\r
337 }\r
338 }\r
339\r
340 return EFI_NOT_FOUND;\r
341}\r
342\r
b1f6a7c6 343/**\r
192f6d4c 344\r
b1f6a7c6 345 Install a notification for a given PPI.\r
346\r
347\r
348 @param PeiServices - Pointer to the PEI Service Table\r
349 @param NotifyList - Pointer to list of Descriptors to notify upon.\r
350\r
351 @retval EFI_SUCCESS if successful\r
352 @retval EFI_OUT_OF_RESOURCES if no space in the database\r
353 @retval EFI_INVALID_PARAMETER if not a good decriptor\r
354\r
355**/\r
192f6d4c 356EFI_STATUS\r
357EFIAPI\r
358PeiNotifyPpi (\r
0c2b5da8 359 IN CONST EFI_PEI_SERVICES **PeiServices,\r
360 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
192f6d4c 361 )\r
192f6d4c 362{\r
363 PEI_CORE_INSTANCE *PrivateData;\r
364 INTN Index;\r
365 INTN NotifyIndex;\r
366 INTN LastCallbackNotify;\r
367 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyPtr;\r
368 UINTN NotifyDispatchCount;\r
369\r
370\r
371 NotifyDispatchCount = 0;\r
372\r
373 if (NotifyList == NULL) {\r
374 return EFI_INVALID_PARAMETER;\r
375 }\r
376\r
377 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
378\r
379 Index = PrivateData->PpiData.NotifyListEnd;\r
380 LastCallbackNotify = Index;\r
381\r
382 //\r
383 // This is loop installs all Notify descriptors in the NotifyList. It is\r
384 // terminated by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last\r
385 // EFI_PEI_NOTIFY_DESCRIPTOR in the list.\r
386 //\r
387\r
388 for (;;) {\r
389 //\r
390 // Since PpiData is used for NotifyList and InstallList, max resource\r
391 // is reached if the Install reaches the PpiList\r
392 //\r
393 if (Index == PrivateData->PpiData.PpiListEnd - 1) {\r
394 return EFI_OUT_OF_RESOURCES;\r
395 }\r
58dcdada 396\r
192f6d4c 397 //\r
398 // If some of the PPI data is invalid restore original Notify PPI database value\r
399 //\r
400 if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) == 0) {\r
401 PrivateData->PpiData.NotifyListEnd = LastCallbackNotify;\r
402 DEBUG((EFI_D_ERROR, "ERROR -> InstallNotify: %g %x\n", NotifyList->Guid, NotifyList->Notify));\r
403 return EFI_INVALID_PARAMETER;\r
404 }\r
58dcdada 405\r
192f6d4c 406 if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {\r
58dcdada 407 NotifyDispatchCount ++;\r
408 }\r
409\r
410 PrivateData->PpiData.PpiListPtrs[Index].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList;\r
411\r
192f6d4c 412 PrivateData->PpiData.NotifyListEnd--;\r
413 DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));\r
414 if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==\r
415 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {\r
416 break;\r
417 }\r
418 //\r
419 // Go the next descriptor. Remember the NotifyList moves down.\r
420 //\r
421 NotifyList++;\r
422 Index--;\r
423 }\r
58dcdada 424\r
192f6d4c 425 //\r
58dcdada 426 // If there is Dispatch Notify PPI installed put them on the bottom\r
192f6d4c 427 //\r
428 if (NotifyDispatchCount > 0) {\r
58dcdada 429 for (NotifyIndex = LastCallbackNotify; NotifyIndex > PrivateData->PpiData.NotifyListEnd; NotifyIndex--) {\r
192f6d4c 430 if ((PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {\r
431 NotifyPtr = PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify;\r
58dcdada 432\r
192f6d4c 433 for (Index = NotifyIndex; Index < PrivateData->PpiData.DispatchListEnd; Index++){\r
434 PrivateData->PpiData.PpiListPtrs[Index].Notify = PrivateData->PpiData.PpiListPtrs[Index + 1].Notify;\r
435 }\r
436 PrivateData->PpiData.PpiListPtrs[Index].Notify = NotifyPtr;\r
58dcdada 437 PrivateData->PpiData.DispatchListEnd--;\r
192f6d4c 438 }\r
439 }\r
58dcdada 440\r
441 LastCallbackNotify -= NotifyDispatchCount;\r
192f6d4c 442 }\r
58dcdada 443\r
192f6d4c 444 //\r
445 // Dispatch any callback level notifies for all previously installed PPIs.\r
446 //\r
447 DispatchNotify (\r
b0d803fe 448 PrivateData,\r
192f6d4c 449 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
450 0,\r
451 PrivateData->PpiData.PpiListEnd,\r
452 LastCallbackNotify,\r
453 PrivateData->PpiData.NotifyListEnd\r
454 );\r
58dcdada 455\r
456\r
192f6d4c 457 return EFI_SUCCESS;\r
458}\r
459\r
460\r
b1f6a7c6 461/**\r
192f6d4c 462\r
463 Process the Notify List at dispatch level.\r
464\r
b1f6a7c6 465 @param PrivateData PeiCore's private data structure.\r
192f6d4c 466\r
b1f6a7c6 467**/\r
468VOID\r
469ProcessNotifyList (\r
470 IN PEI_CORE_INSTANCE *PrivateData\r
471 )\r
192f6d4c 472{\r
192f6d4c 473 INTN TempValue;\r
58dcdada 474\r
192f6d4c 475 while (TRUE) {\r
476 //\r
477 // Check if the PEIM that was just dispatched resulted in any\r
478 // Notifies getting installed. If so, go process any dispatch\r
479 // level Notifies that match the previouly installed PPIs.\r
58dcdada 480 // Use "while" instead of "if" since DispatchNotify can modify\r
192f6d4c 481 // DispatchListEnd (with NotifyPpi) so we have to iterate until the same.\r
482 //\r
483 while (PrivateData->PpiData.LastDispatchedNotify != PrivateData->PpiData.DispatchListEnd) {\r
484 TempValue = PrivateData->PpiData.DispatchListEnd;\r
485 DispatchNotify (\r
b0d803fe 486 PrivateData,\r
192f6d4c 487 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH,\r
488 0,\r
489 PrivateData->PpiData.LastDispatchedInstall,\r
490 PrivateData->PpiData.LastDispatchedNotify,\r
491 PrivateData->PpiData.DispatchListEnd\r
492 );\r
493 PrivateData->PpiData.LastDispatchedNotify = TempValue;\r
494 }\r
58dcdada 495\r
496\r
192f6d4c 497 //\r
498 // Check if the PEIM that was just dispatched resulted in any\r
499 // PPIs getting installed. If so, go process any dispatch\r
500 // level Notifies that match the installed PPIs.\r
58dcdada 501 // Use "while" instead of "if" since DispatchNotify can modify\r
192f6d4c 502 // PpiListEnd (with InstallPpi) so we have to iterate until the same.\r
503 //\r
504 while (PrivateData->PpiData.LastDispatchedInstall != PrivateData->PpiData.PpiListEnd) {\r
505 TempValue = PrivateData->PpiData.PpiListEnd;\r
506 DispatchNotify (\r
b0d803fe 507 PrivateData,\r
192f6d4c 508 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH,\r
509 PrivateData->PpiData.LastDispatchedInstall,\r
510 PrivateData->PpiData.PpiListEnd,\r
eaf539d0 511 FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1,\r
192f6d4c 512 PrivateData->PpiData.DispatchListEnd\r
513 );\r
514 PrivateData->PpiData.LastDispatchedInstall = TempValue;\r
515 }\r
58dcdada 516\r
192f6d4c 517 if (PrivateData->PpiData.LastDispatchedNotify == PrivateData->PpiData.DispatchListEnd) {\r
518 break;\r
519 }\r
58dcdada 520 }\r
192f6d4c 521 return;\r
522}\r
523\r
b1f6a7c6 524/**\r
525\r
526 Dispatch notifications.\r
527\r
528 @param PrivateData PeiCore's private data structure\r
529 @param NotifyType Type of notify to fire.\r
530 @param InstallStartIndex Install Beginning index.\r
531 @param InstallStopIndex Install Ending index.\r
532 @param NotifyStartIndex Notify Beginning index.\r
533 @param NotifyStopIndex Notify Ending index.\r
534\r
535**/\r
192f6d4c 536VOID\r
537DispatchNotify (\r
b0d803fe 538 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 539 IN UINTN NotifyType,\r
540 IN INTN InstallStartIndex,\r
541 IN INTN InstallStopIndex,\r
542 IN INTN NotifyStartIndex,\r
543 IN INTN NotifyStopIndex\r
544 )\r
192f6d4c 545{\r
192f6d4c 546 INTN Index1;\r
547 INTN Index2;\r
548 EFI_GUID *SearchGuid;\r
549 EFI_GUID *CheckGuid;\r
550 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r
551\r
192f6d4c 552 //\r
553 // Remember that Installs moves up and Notifies moves down.\r
554 //\r
555 for (Index1 = NotifyStartIndex; Index1 > NotifyStopIndex; Index1--) {\r
556 NotifyDescriptor = PrivateData->PpiData.PpiListPtrs[Index1].Notify;\r
557\r
558 CheckGuid = NotifyDescriptor->Guid;\r
559\r
560 for (Index2 = InstallStartIndex; Index2 < InstallStopIndex; Index2++) {\r
561 SearchGuid = PrivateData->PpiData.PpiListPtrs[Index2].Ppi->Guid;\r
562 //\r
563 // Don't use CompareGuid function here for performance reasons.\r
564 // Instead we compare the GUID as INT32 at a time and branch\r
565 // on the first failed comparison.\r
566 //\r
567 if ((((INT32 *)SearchGuid)[0] == ((INT32 *)CheckGuid)[0]) &&\r
568 (((INT32 *)SearchGuid)[1] == ((INT32 *)CheckGuid)[1]) &&\r
569 (((INT32 *)SearchGuid)[2] == ((INT32 *)CheckGuid)[2]) &&\r
570 (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3])) {\r
58dcdada 571 DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %x\n",\r
572 SearchGuid,\r
192f6d4c 573 NotifyDescriptor->Notify\r
574 ));\r
575 NotifyDescriptor->Notify (\r
b0d803fe 576 GetPeiServicesTablePointer (),\r
192f6d4c 577 NotifyDescriptor,\r
578 (PrivateData->PpiData.PpiListPtrs[Index2].Ppi)->Ppi\r
579 );\r
580 }\r
581 }\r
582 }\r
583\r
584 return;\r
585}\r
586\r