]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspPkg/FspDxeIpl/DxeIpl.c
IntelFspPkg: Remove the const condition if statement to refine the code.
[mirror_edk2.git] / IntelFspPkg / FspDxeIpl / DxeIpl.c
index cddc29e054b55227a5f14783aad32814bfe18ea1..9ccd3ca94b127a6a4fe83de659149a3efda758ea 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2015, 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
@@ -301,67 +301,58 @@ Decompress (
   //\r
   switch (CompressionType) {\r
   case EFI_STANDARD_COMPRESSION:\r
-    if (TRUE) {\r
-      //\r
-      // Load EFI standard compression.\r
-      // For compressed data, decompress them to destination buffer.\r
-      //\r
-      Status = UefiDecompressGetInfo (\r
-                 CompressionSource,\r
-                 CompressionSourceSize,\r
-                 &DstBufferSize,\r
-                 &ScratchBufferSize\r
-                 );\r
-      if (EFI_ERROR (Status)) {\r
-        //\r
-        // GetInfo failed\r
-        //\r
-        DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));\r
-        return EFI_NOT_FOUND;\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
-      // Allocate destination buffer, extra one page for adjustment\r
-      //\r
-      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);\r
-      if (DstBuffer == NULL) {\r
-        return EFI_OUT_OF_RESOURCES;\r
-      }\r
-      //\r
-      // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header\r
-      // to make section data at page alignment.\r
-      //\r
-      DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);\r
+    //\r
+    // Load EFI standard compression.\r
+    // For compressed data, decompress them to destination buffer.\r
+    //\r
+    Status = UefiDecompressGetInfo (\r
+               CompressionSource,\r
+               CompressionSourceSize,\r
+               &DstBufferSize,\r
+               &ScratchBufferSize\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
       //\r
-      // Call decompress function\r
+      // GetInfo failed\r
       //\r
-      Status = UefiDecompress (\r
-                  CompressionSource,\r
-                  DstBuffer,\r
-                  ScratchBuffer\r
-                  );\r
-      if (EFI_ERROR (Status)) {\r
-        //\r
-        // Decompress failed\r
-        //\r
-        DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));\r
-        return EFI_NOT_FOUND;\r
-      }\r
-      break;\r
-    } else {\r
+      DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));\r
+      return EFI_NOT_FOUND;\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
+    // Allocate destination buffer, extra one page for adjustment\r
+    //\r
+    DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);\r
+    if (DstBuffer == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    //\r
+    // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header\r
+    // to make section data at page alignment.\r
+    //\r
+    DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);\r
+    //\r
+    // Call decompress function\r
+    //\r
+    Status = UefiDecompress (\r
+                CompressionSource,\r
+                DstBuffer,\r
+                ScratchBuffer\r
+                );\r
+    if (EFI_ERROR (Status)) {\r
       //\r
-      // PcdDxeIplSupportUefiDecompress is FALSE\r
-      // Don't support UEFI decompression algorithm.\r
+      // Decompress failed\r
       //\r
-      ASSERT (FALSE);\r
+      DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));\r
       return EFI_NOT_FOUND;\r
     }\r
+    break;\r
 \r
   case EFI_NOT_COMPRESSED:\r
     //\r
@@ -430,13 +421,13 @@ DxeLoadCore (
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // Give control back to bootloader after FspInit\r
+  // Give control back to BootLoader after FspInit\r
   //\r
   DEBUG ((DEBUG_INFO | DEBUG_INIT, "FSP is waiting for NOTIFY\n"));\r
   FspInitDone ();\r
 \r
   //\r
-  // Bootloader called FSP again through NotifyPhase\r
+  // BootLoader called FSP again through NotifyPhase\r
   //\r
   FspWaitForNotify ();\r
 \r