]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/DxeIplPeim/DxeLoad.c
add <SupModuleList> in <LibraryClass> item for TimerLib. Inform build tool this timer...
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / DxeLoad.c
index 8dbc3763d656cd4e97481df19abfd6cbb2eea2b0..b157b9304ce590855991e23ca2c6d73b74b004dc 100644 (file)
@@ -241,14 +241,6 @@ Returns:
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Transfer control to the DXE Core\r
-  // The handoff state is simply a pointer to the HOB list\r
-  //\r
-\r
-  Status = PeiServicesInstallPpi (&mPpiSignal);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\r
   // Add HOB for the DXE Core\r
   //\r
@@ -309,8 +301,13 @@ Returns:
       );\r
   }\r
 \r
+  //\r
+  // Transfer control to the DXE Core\r
+  // The handoff state is simply a pointer to the HOB list\r
+  //\r
+\r
   DEBUG ((EFI_D_INFO, "DXE Core Entry Point 0x%08x\n", (UINTN) DxeCoreEntryPoint));\r
-  HandOffToDxeCore (DxeCoreEntryPoint, HobList);\r
+  HandOffToDxeCore (DxeCoreEntryPoint, HobList, &mPpiSignal);\r
   //\r
   // If we get here, then the DXE Core returned.  This is an error\r
   // Dxe Core should not return.\r
@@ -669,6 +666,13 @@ Returns:
   EFI_COMPRESSION_SECTION         *CompressionSection;\r
   UINT32                          FvAlignment;\r
 \r
+  //\r
+  // Initialize local variables.\r
+  //\r
+  DecompressLibrary = NULL;\r
+  DstBuffer         = NULL;\r
+  DstBufferSize     = 0;\r
+\r
   Status = PeiServicesFfsFindSectionData (\r
              EFI_SECTION_COMPRESSION,\r
              FfsFileHeader,\r
@@ -784,8 +788,11 @@ Returns:
 \r
         switch (CompressionSection->CompressionType) {\r
         case EFI_STANDARD_COMPRESSION:\r
+          //\r
+          // Load EFI standard compression.\r
+          //\r
           if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {\r
-            DecompressLibrary = &gTianoDecompress;\r
+            DecompressLibrary = &gEfiDecompress;\r
           } else {\r
             ASSERT (FALSE);\r
             return EFI_NOT_FOUND;\r
@@ -794,7 +801,7 @@ Returns:
 \r
         case EFI_CUSTOMIZED_COMPRESSION:\r
           //\r
-          // Load user customized compression protocol.\r
+          // Load user customized compression.\r
           //\r
           if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {\r
             DecompressLibrary = &gCustomDecompress;\r
@@ -805,52 +812,79 @@ Returns:
           break;\r
 \r
         case EFI_NOT_COMPRESSED:\r
+          //\r
+          // Allocate destination buffer\r
+          //\r
+          DstBufferSize = CompressionSection->UncompressedLength;\r
+          DstBuffer     = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));\r
+          if (DstBuffer == NULL) {\r
+            return EFI_OUT_OF_RESOURCES;\r
+          }\r
+          //\r
+          // stream is not actually compressed, just encapsulated.  So just copy it.\r
+          //\r
+          CopyMem (DstBuffer, CompressionSection + 1, DstBufferSize);\r
+          break;\r
+\r
         default:\r
           //\r
-          // Need to support not compressed file\r
+          // Don't support other unknown compression type.\r
           //\r
           ASSERT_EFI_ERROR (Status);\r
           return EFI_NOT_FOUND;\r
         }\r
-\r
-        Status = DecompressLibrary->GetInfo (\r
-                   (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
-                   (UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),\r
-                   &DstBufferSize,\r
-                   &ScratchBufferSize\r
-                   );\r
-        if (EFI_ERROR (Status)) {\r
+        \r
+        if (CompressionSection->CompressionType != EFI_NOT_COMPRESSED) {\r
           //\r
-          // GetInfo failed\r
+          // For compressed data, decompress them to dstbuffer.\r
           //\r
-          return EFI_NOT_FOUND;\r
-        }\r
-\r
-        //\r
-        // Allocate scratch buffer\r
-        //\r
-        ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));\r
-        if (ScratchBuffer == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
-        }\r
-\r
-        //\r
-        // Allocate destination buffer\r
-        //\r
-        DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));\r
-        if (DstBuffer == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
+          Status = DecompressLibrary->GetInfo (\r
+                     (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
+                     (UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),\r
+                     &DstBufferSize,\r
+                     &ScratchBufferSize\r
+                     );\r
+          if (EFI_ERROR (Status)) {\r
+            //\r
+            // GetInfo failed\r
+            //\r
+            DEBUG ((EFI_D_ERROR, "Decompress GetInfo Failed - %r\n", Status));\r
+            return EFI_NOT_FOUND;\r
+          }\r
+  \r
+          //\r
+          // Allocate scratch buffer\r
+          //\r
+          ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));\r
+          if (ScratchBuffer == NULL) {\r
+            return EFI_OUT_OF_RESOURCES;\r
+          }\r
+  \r
+          //\r
+          // Allocate destination buffer\r
+          //\r
+          DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));\r
+          if (DstBuffer == NULL) {\r
+            return EFI_OUT_OF_RESOURCES;\r
+          }\r
+  \r
+          //\r
+          // Call decompress function\r
+          //\r
+          Status = DecompressLibrary->Decompress (\r
+                      (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
+                      DstBuffer,\r
+                      ScratchBuffer\r
+                      );\r
+          if (EFI_ERROR (Status)) {\r
+            //\r
+            // Decompress failed\r
+            //\r
+            DEBUG ((EFI_D_ERROR, "Decompress Failed - %r\n", Status));\r
+            return EFI_NOT_FOUND;\r
+          }\r
         }\r
-\r
-        //\r
-        // Call decompress function\r
-        //\r
-        Status = DecompressLibrary->Decompress (\r
-                    (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
-                    DstBuffer,\r
-                    ScratchBuffer\r
-                    );\r
-\r
+        \r
         CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;\r
         if (CmpSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {\r
           // \r
@@ -909,7 +943,6 @@ Returns:
             } else {\r
               return EFI_NOT_FOUND;\r
             }\r
-\r
           }\r
         }\r
         //\r