Revision: 18124
http://sourceforge.net/p/edk2/code/18124
Author: shenshushi
Date: 2015-08-03 02:59:55 +0000 (Mon, 03 Aug 2015)
Log Message:
-----------
IntelFspPkg: Remove the const condition if statement to refine the code.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: "Yao, Jiewen" <[email protected]>
Modified Paths:
--------------
trunk/edk2/IntelFspPkg/FspDxeIpl/DxeIpl.c
Modified: trunk/edk2/IntelFspPkg/FspDxeIpl/DxeIpl.c
===================================================================
--- trunk/edk2/IntelFspPkg/FspDxeIpl/DxeIpl.c 2015-08-02 04:02:37 UTC (rev
18123)
+++ trunk/edk2/IntelFspPkg/FspDxeIpl/DxeIpl.c 2015-08-03 02:59:55 UTC (rev
18124)
@@ -301,67 +301,58 @@
//
switch (CompressionType) {
case EFI_STANDARD_COMPRESSION:
- if (TRUE) {
+ //
+ // Load EFI standard compression.
+ // For compressed data, decompress them to destination buffer.
+ //
+ Status = UefiDecompressGetInfo (
+ CompressionSource,
+ CompressionSourceSize,
+ &DstBufferSize,
+ &ScratchBufferSize
+ );
+ if (EFI_ERROR (Status)) {
//
- // Load EFI standard compression.
- // For compressed data, decompress them to destination buffer.
+ // GetInfo failed
//
- Status = UefiDecompressGetInfo (
- CompressionSource,
- CompressionSourceSize,
- &DstBufferSize,
- &ScratchBufferSize
- );
- if (EFI_ERROR (Status)) {
- //
- // GetInfo failed
- //
- DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
+ DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Allocate scratch buffer
+ //
+ ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
+ if (ScratchBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Allocate destination buffer, extra one page for adjustment
+ //
+ DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+ if (DstBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI
section header
+ // to make section data at page alignment.
+ //
+ DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
+ //
+ // Call decompress function
+ //
+ Status = UefiDecompress (
+ CompressionSource,
+ DstBuffer,
+ ScratchBuffer
+ );
+ if (EFI_ERROR (Status)) {
//
- // Allocate scratch buffer
+ // Decompress failed
//
- ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
- if (ScratchBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Allocate destination buffer, extra one page for adjustment
- //
- DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
- if (DstBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI
section header
- // to make section data at page alignment.
- //
- DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof
(EFI_COMMON_SECTION_HEADER);
- //
- // Call decompress function
- //
- Status = UefiDecompress (
- CompressionSource,
- DstBuffer,
- ScratchBuffer
- );
- if (EFI_ERROR (Status)) {
- //
- // Decompress failed
- //
- DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
- break;
- } else {
- //
- // PcdDxeIplSupportUefiDecompress is FALSE
- // Don't support UEFI decompression algorithm.
- //
- ASSERT (FALSE);
+ DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
return EFI_NOT_FOUND;
}
+ break;
case EFI_NOT_COMPRESSED:
//
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits