The main issue want to be resolve is that some tools need EfiCompress and other tools need TianoCompress, but only common Compress(indeed is TianoCompress) is provided in tool/CCode/Common.

EfiCompress and TianoCompress are all originated from LZ77 algorithms and they have very little different, that different position set for Huffman code.
	EfiCompress is defined in EFI 1.1 spec and EfiRom tool need it to create a recognized compressed EFI driver.
	TianoCompress is for pursuer more size saving and it used be GenFfs and GenSection tools.
	So this patch:
	1) Split EfiComress and TianoCompress in edkII’s tools
	2) Change EfiRom tool use EfiCompress and GenFfs/GenSection use TianoCompress


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2064 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-12-07 05:29:07 +00:00
parent 61e61e3d30
commit 30f80dd8de
8 changed files with 2520 additions and 888 deletions

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2004, Intel Corporation Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -11,24 +11,47 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
EfiCompress.h Compress.h
Abstract: Abstract:
Header file for compression routine Header file for compression routine.
Providing both EFI and Tiano Compress algorithms.
--*/ --*/
#ifndef _EFICOMPRESS_H #ifndef _COMPRESS_H_
#define _EFICOMPRESS_H #define _COMPRESS_H_
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>
/*++
Routine Description:
Tiano compression routine.
--*/
EFI_STATUS EFI_STATUS
Compress ( TianoCompress (
IN UINT8 *SrcBuffer,
IN UINT32 SrcSize,
IN UINT8 *DstBuffer,
IN OUT UINT32 *DstSize
)
;
/*++
Routine Description:
Efi compression routine.
--*/
EFI_STATUS
EfiCompress (
IN UINT8 *SrcBuffer, IN UINT8 *SrcBuffer,
IN UINT32 SrcSize, IN UINT32 SrcSize,
IN UINT8 *DstBuffer, IN UINT8 *DstBuffer,
@ -55,6 +78,8 @@ Returns:
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case, EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
DstSize contains the size needed. DstSize contains the size needed.
EFI_SUCCESS - Compression is successful. EFI_SUCCESS - Compression is successful.
EFI_OUT_OF_RESOURCES - No resource to complete function.
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
--*/ --*/
typedef typedef

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,11 +15,11 @@
typedef long long __int64;/*For cygwin build*/ typedef long long __int64;/*For cygwin build*/
#endif #endif
#include "CompressDll.h" #include "CompressDll.h"
#include "EfiCompress.h" #include "Compress.h"
extern extern
EFI_STATUS EFI_STATUS
Compress ( TianoCompress (
IN UINT8 *SrcBuffer, IN UINT8 *SrcBuffer,
IN UINT32 SrcSize, IN UINT32 SrcSize,
IN UINT8 *DstBuffer, IN UINT8 *DstBuffer,
@ -47,7 +47,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCo
// First call compress function and get need buffer size // First call compress function and get need buffer size
// //
Result = Compress ( Result = TianoCompress (
(char*) InputBuffer, (char*) InputBuffer,
SourceSize, SourceSize,
DestBuffer, DestBuffer,
@ -61,7 +61,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCo
// //
// Second call compress and get the DestBuffer value // Second call compress and get the DestBuffer value
// //
Result = Compress( Result = TianoCompress(
(char*) InputBuffer, (char*) InputBuffer,
SourceSize, SourceSize,
DestBuffer, DestBuffer,

View File

@ -27,7 +27,7 @@ Abstract:
#include <stdio.h> #include <stdio.h>
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>
#include "EfiCompress.h" #include "Compress.h"
#define UTILITY_NAME "EfiCompress" #define UTILITY_NAME "EfiCompress"
#define UTILITY_MAJOR_VERSION 1 #define UTILITY_MAJOR_VERSION 1
@ -176,14 +176,14 @@ Returns:
// Get destination data size and do the compression // Get destination data size and do the compression
// //
DstSize = 0; DstSize = 0;
Status = Compress (SrcBuffer, SrcSize, DstBuffer, &DstSize); Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {
if ((DstBuffer = malloc (DstSize)) == NULL) { if ((DstBuffer = malloc (DstSize)) == NULL) {
printf ("Can't allocate memory\n"); printf ("Can't allocate memory\n");
goto Done; goto Done;
} }
Status = Compress (SrcBuffer, SrcSize, DstBuffer, &DstSize); Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {

View File

@ -31,7 +31,7 @@ Abstract:
#include <IndustryStandard/pci22.h> // for option ROM header structures #include <IndustryStandard/pci22.h> // for option ROM header structures
#include "EfiCompress.h" #include "Compress.h"
#include "CommonLib.h" #include "CommonLib.h"
// //
@ -633,7 +633,7 @@ Returns:
} }
CompressedFileSize = FileSize; CompressedFileSize = FileSize;
Status = Compress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize); Status = EfiCompress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize);
if (Status != STATUS_SUCCESS) { if (Status != STATUS_SUCCESS) {
fprintf (stdout, "ERROR: Compression failed\n"); fprintf (stdout, "ERROR: Compression failed\n");
goto BailOut; goto BailOut;

View File

@ -38,7 +38,7 @@ Abstract:
#include <Common/FirmwareVolumeImageFormat.h> #include <Common/FirmwareVolumeImageFormat.h>
#include "ParseInf.h" #include "ParseInf.h"
#include "EfiCompress.h" #include "Compress.h"
#include "EfiCustomizedCompress.h" #include "EfiCustomizedCompress.h"
#include "Crc32.h" #include "Crc32.h"
#include "GenFfsFile.h" #include "GenFfsFile.h"
@ -591,14 +591,14 @@ Returns:
// Added "Dummy" to keep backward compatibility. // Added "Dummy" to keep backward compatibility.
// //
CompressionType = EFI_STANDARD_COMPRESSION; CompressionType = EFI_STANDARD_COMPRESSION;
CompressFunction = (COMPRESS_FUNCTION) Compress; CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
} else if (strcmpi (Type, "LZH") == 0) { } else if (strcmpi (Type, "LZH") == 0) {
// //
// EFI stardard compression (LZH) // EFI stardard compression (LZH)
// //
CompressionType = EFI_STANDARD_COMPRESSION; CompressionType = EFI_STANDARD_COMPRESSION;
CompressFunction = (COMPRESS_FUNCTION) Compress; CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
} else { } else {
// //

View File

@ -28,7 +28,7 @@ Abstract:
#include <Protocol/GuidedSectionExtraction.h> #include <Protocol/GuidedSectionExtraction.h>
#include "CommonLib.h" #include "CommonLib.h"
#include "EfiCompress.h" #include "Compress.h"
#include "EfiCustomizedCompress.h" #include "EfiCustomizedCompress.h"
#include "Crc32.h" #include "Crc32.h"
#include "EfiUtilityMsgs.h" #include "EfiUtilityMsgs.h"
@ -429,7 +429,7 @@ Returns:
break; break;
case EFI_STANDARD_COMPRESSION: case EFI_STANDARD_COMPRESSION:
CompressFunction = (COMPRESS_FUNCTION) Compress; CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
break; break;
case EFI_CUSTOMIZED_COMPRESSION: case EFI_CUSTOMIZED_COMPRESSION: