/** @file\r
\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
- 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
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
//\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