]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Ppi/Ppi.c
Modify all file header to follow doxygen format
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Ppi / Ppi.c
index 2ee45c44f7c1e5f387565ee9f82e85f171150ac6..1e400225fb385a8482a7a18f6d48f410a45e5356 100644 (file)
@@ -1,13 +1,13 @@
-/*++\r
+/** @file\r
+\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -19,7 +19,7 @@ Abstract:
 \r
 Revision History\r
 \r
---*/\r
+**/\r
 \r
 #include <PeiMain.h>\r
 \r
@@ -50,14 +50,15 @@ Returns:
     PrivateData->PpiData.DispatchListEnd = MAX_PPI_DESCRIPTORS-1;\r
     PrivateData->PpiData.LastDispatchedNotify = MAX_PPI_DESCRIPTORS-1;\r
   }\r
\r
-  return;   \r
+\r
+  return;\r
 }\r
 \r
 VOID\r
 ConvertPpiPointers (\r
   IN CONST EFI_PEI_SERVICES                     **PeiServices,\r
-  IN EFI_HOB_HANDOFF_INFO_TABLE    *OldHandOffHob,\r
+  IN UINTN                         OldCheckingBottom,\r
+  IN UINTN                         OldCheckingTop,\r
   IN EFI_HOB_HANDOFF_INFO_TABLE    *NewHandOffHob\r
   )\r
 /*++\r
@@ -68,12 +69,13 @@ Routine Description:
 \r
 Arguments:\r
 \r
-  PeiServices   - The PEI core services table.\r
-  OldHandOffHob - The old handoff HOB list.\r
-  NewHandOffHob - The new handoff HOB list.\r
+  PeiServices       - The PEI core services table.\r
+  OldCheckingBottom - The old checking bottom.\r
+  OldCheckingTop    - The old checking top.\r
+  NewHandOffHob     - The new handoff HOB list.\r
 \r
 Returns:\r
-            \r
+\r
 --*/\r
 {\r
   PEI_CORE_INSTANCE     *PrivateData;\r
@@ -83,15 +85,15 @@ Returns:
 \r
   PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
 \r
-  Fixup = (UINTN)NewHandOffHob - (UINTN)OldHandOffHob;\r
-  \r
+  Fixup = (UINTN)NewHandOffHob - OldCheckingBottom;\r
+\r
   for (Index = 0; Index < MAX_PPI_DESCRIPTORS; Index++) {\r
     if (Index < PrivateData->PpiData.PpiListEnd ||\r
         Index > PrivateData->PpiData.NotifyListEnd) {\r
       PpiPointer = &PrivateData->PpiData.PpiListPtrs[Index];\r
-      \r
-      if (((UINTN)PpiPointer->Raw < (UINTN)OldHandOffHob->EfiFreeMemoryBottom) && \r
-          ((UINTN)PpiPointer->Raw >= (UINTN)OldHandOffHob)) {\r
+\r
+      if (((UINTN)PpiPointer->Raw < OldCheckingTop) &&\r
+          ((UINTN)PpiPointer->Raw >= OldCheckingBottom)) {\r
         //\r
         // Convert the pointer to the PEIM descriptor from the old HOB heap\r
         // to the relocated HOB heap.\r
@@ -102,9 +104,9 @@ Returns:
         // Only when the PEIM descriptor is in the old HOB should it be necessary\r
         // to try to convert the pointers in the PEIM descriptor\r
         //\r
-        \r
-        if (((UINTN)PpiPointer->Ppi->Guid < (UINTN)OldHandOffHob->EfiFreeMemoryBottom) && \r
-            ((UINTN)PpiPointer->Ppi->Guid >= (UINTN)OldHandOffHob)) {\r
+\r
+        if (((UINTN)PpiPointer->Ppi->Guid < OldCheckingTop) &&\r
+            ((UINTN)PpiPointer->Ppi->Guid >= OldCheckingBottom)) {\r
           //\r
           // Convert the pointer to the GUID in the PPI or NOTIFY descriptor\r
           // from the old HOB heap to the relocated HOB heap.\r
@@ -117,13 +119,13 @@ Returns:
         // the notification function in the NOTIFY descriptor needs not be converted.\r
         //\r
         if (Index < PrivateData->PpiData.PpiListEnd &&\r
-            (UINTN)PpiPointer->Ppi->Ppi < (UINTN)OldHandOffHob->EfiFreeMemoryBottom &&\r
-            (UINTN)PpiPointer->Ppi->Ppi >= (UINTN)OldHandOffHob) {\r
+            (UINTN)PpiPointer->Ppi->Ppi < OldCheckingTop &&\r
+            (UINTN)PpiPointer->Ppi->Ppi >= OldCheckingBottom) {\r
             //\r
             // Convert the pointer to the PPI interface structure in the PPI descriptor\r
             // from the old HOB heap to the relocated HOB heap.\r
             //\r
-            PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi+ Fixup);   \r
+            PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi+ Fixup);\r
         }\r
       }\r
     }\r
@@ -177,7 +179,7 @@ Returns:
   // by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last\r
   // EFI_PEI_PPI_DESCRIPTOR in the list.\r
   //\r
-    \r
+\r
   for (;;) {\r
     //\r
     // Since PpiData is used for NotifyList and InstallList, max resource\r
@@ -187,7 +189,7 @@ Returns:
       return  EFI_OUT_OF_RESOURCES;\r
     }\r
     //\r
-    // Check if it is a valid PPI. \r
+    // Check if it is a valid PPI.\r
     // If not, rollback list to exclude all in this list.\r
     // Try to indicate which item failed.\r
     //\r
@@ -197,14 +199,14 @@ Returns:
       return  EFI_INVALID_PARAMETER;\r
     }\r
 \r
-    DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid)); \r
-    PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList;    \r
+    DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid));\r
+    PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList;\r
     PrivateData->PpiData.PpiListEnd++;\r
-    \r
+\r
     //\r
     // Continue until the end of the PPI List.\r
     //\r
-    if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==  \r
+    if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==\r
         EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {\r
       break;\r
     }\r
@@ -220,7 +222,7 @@ Returns:
     EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
     LastCallbackInstall,\r
     PrivateData->PpiData.PpiListEnd,\r
-    PrivateData->PpiData.DispatchListEnd,                 \r
+    PrivateData->PpiData.DispatchListEnd,\r
     PrivateData->PpiData.NotifyListEnd\r
     );\r
 \r
@@ -286,7 +288,7 @@ Returns:
 \r
   //\r
   // Remove the old PPI from the database, add the new one.\r
-  // \r
+  //\r
   DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));\r
   PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi;\r
 \r
@@ -298,7 +300,7 @@ Returns:
     EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
     Index,\r
     Index+1,\r
-    PrivateData->PpiData.DispatchListEnd,                 \r
+    PrivateData->PpiData.DispatchListEnd,\r
     PrivateData->PpiData.NotifyListEnd\r
     );\r
 \r
@@ -333,7 +335,7 @@ Arguments:
 \r
 Returns:\r
 \r
-  Status -  EFI_SUCCESS   if the PPI is in the database           \r
+  Status -  EFI_SUCCESS   if the PPI is in the database\r
             EFI_NOT_FOUND if the PPI is not in the database\r
 --*/\r
 {\r
@@ -342,7 +344,7 @@ Returns:
   EFI_GUID            *CheckGuid;\r
   EFI_PEI_PPI_DESCRIPTOR  *TempPtr;\r
 \r
-  \r
+\r
   PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
 \r
   //\r
@@ -440,7 +442,7 @@ Returns:
     if (Index == PrivateData->PpiData.PpiListEnd - 1) {\r
       return  EFI_OUT_OF_RESOURCES;\r
     }\r
-    \r
+\r
     //\r
     // If some of the PPI data is invalid restore original Notify PPI database value\r
     //\r
@@ -449,13 +451,13 @@ Returns:
         DEBUG((EFI_D_ERROR, "ERROR -> InstallNotify: %g %x\n", NotifyList->Guid, NotifyList->Notify));\r
       return  EFI_INVALID_PARAMETER;\r
     }\r
-     \r
+\r
     if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {\r
-      NotifyDispatchCount ++; \r
-    }        \r
-    \r
-    PrivateData->PpiData.PpiListPtrs[Index].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList;      \r
-   \r
+      NotifyDispatchCount ++;\r
+    }\r
+\r
+    PrivateData->PpiData.PpiListPtrs[Index].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList;\r
+\r
     PrivateData->PpiData.NotifyListEnd--;\r
     DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));\r
     if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==\r
@@ -468,26 +470,26 @@ Returns:
     NotifyList++;\r
     Index--;\r
   }\r
\r
+\r
   //\r
-  // If there is Dispatch Notify PPI installed put them on the bottom \r
+  // If there is Dispatch Notify PPI installed put them on the bottom\r
   //\r
   if (NotifyDispatchCount > 0) {\r
-    for (NotifyIndex = LastCallbackNotify; NotifyIndex > PrivateData->PpiData.NotifyListEnd; NotifyIndex--) {             \r
+    for (NotifyIndex = LastCallbackNotify; NotifyIndex > PrivateData->PpiData.NotifyListEnd; NotifyIndex--) {\r
       if ((PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {\r
         NotifyPtr = PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify;\r
-        \r
+\r
         for (Index = NotifyIndex; Index < PrivateData->PpiData.DispatchListEnd; Index++){\r
           PrivateData->PpiData.PpiListPtrs[Index].Notify = PrivateData->PpiData.PpiListPtrs[Index + 1].Notify;\r
         }\r
         PrivateData->PpiData.PpiListPtrs[Index].Notify = NotifyPtr;\r
-        PrivateData->PpiData.DispatchListEnd--;                \r
+        PrivateData->PpiData.DispatchListEnd--;\r
       }\r
     }\r
-    \r
-    LastCallbackNotify -= NotifyDispatchCount;        \r
+\r
+    LastCallbackNotify -= NotifyDispatchCount;\r
   }\r
-  \r
+\r
   //\r
   // Dispatch any callback level notifies for all previously installed PPIs.\r
   //\r
@@ -499,8 +501,8 @@ Returns:
     LastCallbackNotify,\r
     PrivateData->PpiData.NotifyListEnd\r
     );\r
-  \r
-  \r
+\r
+\r
   return  EFI_SUCCESS;\r
 }\r
 \r
@@ -525,13 +527,13 @@ Returns:
 \r
 {\r
   INTN                    TempValue;\r
\r
+\r
   while (TRUE) {\r
     //\r
     // Check if the PEIM that was just dispatched resulted in any\r
     // Notifies getting installed.  If so, go process any dispatch\r
     // level Notifies that match the previouly installed PPIs.\r
-    // Use "while" instead of "if" since DispatchNotify can modify \r
+    // Use "while" instead of "if" since DispatchNotify can modify\r
     // DispatchListEnd (with NotifyPpi) so we have to iterate until the same.\r
     //\r
     while (PrivateData->PpiData.LastDispatchedNotify != PrivateData->PpiData.DispatchListEnd) {\r
@@ -546,13 +548,13 @@ Returns:
         );\r
       PrivateData->PpiData.LastDispatchedNotify = TempValue;\r
     }\r
-    \r
-    \r
+\r
+\r
     //\r
     // Check if the PEIM that was just dispatched resulted in any\r
     // PPIs getting installed.  If so, go process any dispatch\r
     // level Notifies that match the installed PPIs.\r
-    // Use "while" instead of "if" since DispatchNotify can modify \r
+    // Use "while" instead of "if" since DispatchNotify can modify\r
     // PpiListEnd (with InstallPpi) so we have to iterate until the same.\r
     //\r
     while (PrivateData->PpiData.LastDispatchedInstall != PrivateData->PpiData.PpiListEnd) {\r
@@ -567,11 +569,11 @@ Returns:
         );\r
       PrivateData->PpiData.LastDispatchedInstall = TempValue;\r
     }\r
-    \r
+\r
     if (PrivateData->PpiData.LastDispatchedNotify == PrivateData->PpiData.DispatchListEnd) {\r
       break;\r
     }\r
-  } \r
+  }\r
   return;\r
 }\r
 \r
@@ -629,8 +631,8 @@ Returns:  None
           (((INT32 *)SearchGuid)[1] == ((INT32 *)CheckGuid)[1]) &&\r
           (((INT32 *)SearchGuid)[2] == ((INT32 *)CheckGuid)[2]) &&\r
           (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3])) {\r
-        DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %x\n", \r
-          SearchGuid, \r
+        DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %x\n",\r
+          SearchGuid,\r
           NotifyDescriptor->Notify\r
           ));\r
         NotifyDescriptor->Notify (\r