]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Ppi/Ppi.c
Clean up DEC files:
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Ppi / Ppi.c
index 556a970f8b3e6910cfe6b2e9889293220fc7c993..65dc5be9fcd96ae5519c15b769f44dee5a117277 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   EFI PEI Core PPI services\r
   \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -38,7 +38,7 @@ InitializePpiServices (
 \r
 /**\r
 \r
-  Migrate the Hob list from the CAR stack to PEI installed memory.\r
+  Migrate the Hob list from the temporary memory stack to PEI installed memory.\r
 \r
   @param PrivateData         Pointer to PeiCore's private data structure.\r
   @param OldCheckingBottom   Bottom of temporary memory range. All Ppi in this range\r
@@ -47,6 +47,8 @@ InitializePpiServices (
                              will be fixup for PpiData and PpiDescriptor.\r
   @param Fixup               The address difference between\r
                              the new Hob list and old Hob list.\r
+  @param FixupPositive       TRUE if new Hob list is above the old Hob list.  \r
+                             Otherwise FALSE.\r
 \r
 **/\r
 VOID\r
@@ -54,7 +56,8 @@ ConvertPpiPointers (
   IN PEI_CORE_INSTANCE       *PrivateData,\r
   IN UINTN                   OldCheckingBottom,\r
   IN UINTN                   OldCheckingTop,\r
-  IN INTN                    Fixup\r
+  IN UINTN                   Fixup,\r
+  IN BOOLEAN                 FixupPositive\r
   )\r
 {\r
   UINT8                 Index;\r
@@ -71,7 +74,11 @@ ConvertPpiPointers (
         // Convert the pointer to the PEIM descriptor from the old HOB heap\r
         // to the relocated HOB heap.\r
         //\r
-        PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw + Fixup);\r
+        if (FixupPositive) {\r
+          PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw + Fixup);\r
+        } else {\r
+          PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw - Fixup);\r
+        }\r
 \r
         //\r
         // Only when the PEIM descriptor is in the old HOB should it be necessary\r
@@ -84,7 +91,11 @@ ConvertPpiPointers (
           // Convert the pointer to the GUID in the PPI or NOTIFY descriptor\r
           // from the old HOB heap to the relocated HOB heap.\r
           //\r
-          PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + Fixup);\r
+          if (FixupPositive) {\r
+            PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + Fixup);\r
+          } else {\r
+            PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid - Fixup);\r
+          }\r
         }\r
 \r
         //\r
@@ -98,7 +109,11 @@ ConvertPpiPointers (
             // 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
+            if (FixupPositive) {\r
+              PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + Fixup);\r
+            } else {\r
+              PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - Fixup);\r
+            }\r
         }\r
       }\r
     }\r
@@ -151,6 +166,7 @@ PeiInstallPpi (
     //\r
     // Since PpiData is used for NotifyList and PpiList, max resource\r
     // is reached if the Install reaches the NotifyList\r
+    // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more PPI requirement.\r
     //\r
     if (Index == PrivateData->PpiData.NotifyListEnd + 1) {\r
       return  EFI_OUT_OF_RESOURCES;\r
@@ -167,7 +183,6 @@ PeiInstallPpi (
     }\r
 \r
     DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid));\r
-    ASSERT (Index < FixedPcdGet32 (PcdPeiCoreMaxPpiSupported));\r
     PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList;\r
     PrivateData->PpiData.PpiListEnd++;\r
 \r
@@ -254,6 +269,7 @@ PeiReInstallPpi (
   // Remove the old PPI from the database, add the new one.\r
   //\r
   DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));\r
+  ASSERT (Index < (INTN)(FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)));\r
   PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi;\r
 \r
   //\r
@@ -392,6 +408,7 @@ PeiNotifyPpi (
     //\r
     // Since PpiData is used for NotifyList and InstallList, max resource\r
     // is reached if the Install reaches the PpiList\r
+    // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more Notify PPIs requirement.\r
     //\r
     if (Index == PrivateData->PpiData.PpiListEnd - 1) {\r
       return  EFI_OUT_OF_RESOURCES;\r