mirror of https://github.com/acidanthera/audk.git
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:
parent
61e61e3d30
commit
30f80dd8de
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004, Intel Corporation
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@ -11,24 +11,47 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
Module Name:
|
||||
|
||||
EfiCompress.h
|
||||
Compress.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for compression routine
|
||||
Header file for compression routine.
|
||||
Providing both EFI and Tiano Compress algorithms.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFICOMPRESS_H
|
||||
#define _EFICOMPRESS_H
|
||||
#ifndef _COMPRESS_H_
|
||||
#define _COMPRESS_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Tiano compression routine.
|
||||
|
||||
--*/
|
||||
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 UINT32 SrcSize,
|
||||
IN UINT8 *DstBuffer,
|
||||
|
@ -55,6 +78,8 @@ Returns:
|
|||
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
|
||||
DstSize contains the size needed.
|
||||
EFI_SUCCESS - Compression is successful.
|
||||
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
||||
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
||||
|
||||
--*/
|
||||
typedef
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -15,11 +15,11 @@
|
|||
typedef long long __int64;/*For cygwin build*/
|
||||
#endif
|
||||
#include "CompressDll.h"
|
||||
#include "EfiCompress.h"
|
||||
#include "Compress.h"
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
Compress (
|
||||
TianoCompress (
|
||||
IN UINT8 *SrcBuffer,
|
||||
IN UINT32 SrcSize,
|
||||
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
|
||||
//
|
||||
|
||||
Result = Compress (
|
||||
Result = TianoCompress (
|
||||
(char*) InputBuffer,
|
||||
SourceSize,
|
||||
DestBuffer,
|
||||
|
@ -61,7 +61,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCo
|
|||
//
|
||||
// Second call compress and get the DestBuffer value
|
||||
//
|
||||
Result = Compress(
|
||||
Result = TianoCompress(
|
||||
(char*) InputBuffer,
|
||||
SourceSize,
|
||||
DestBuffer,
|
||||
|
|
|
@ -27,7 +27,7 @@ Abstract:
|
|||
#include <stdio.h>
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
#include "EfiCompress.h"
|
||||
#include "Compress.h"
|
||||
|
||||
#define UTILITY_NAME "EfiCompress"
|
||||
#define UTILITY_MAJOR_VERSION 1
|
||||
|
@ -176,14 +176,14 @@ Returns:
|
|||
// Get destination data size and do the compression
|
||||
//
|
||||
DstSize = 0;
|
||||
Status = Compress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
|
||||
Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
if ((DstBuffer = malloc (DstSize)) == NULL) {
|
||||
printf ("Can't allocate memory\n");
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = Compress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
|
||||
Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
|
@ -31,7 +31,7 @@ Abstract:
|
|||
|
||||
#include <IndustryStandard/pci22.h> // for option ROM header structures
|
||||
|
||||
#include "EfiCompress.h"
|
||||
#include "Compress.h"
|
||||
#include "CommonLib.h"
|
||||
|
||||
//
|
||||
|
@ -633,7 +633,7 @@ Returns:
|
|||
}
|
||||
|
||||
CompressedFileSize = FileSize;
|
||||
Status = Compress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize);
|
||||
Status = EfiCompress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize);
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
fprintf (stdout, "ERROR: Compression failed\n");
|
||||
goto BailOut;
|
||||
|
|
|
@ -38,7 +38,7 @@ Abstract:
|
|||
#include <Common/FirmwareVolumeImageFormat.h>
|
||||
|
||||
#include "ParseInf.h"
|
||||
#include "EfiCompress.h"
|
||||
#include "Compress.h"
|
||||
#include "EfiCustomizedCompress.h"
|
||||
#include "Crc32.h"
|
||||
#include "GenFfsFile.h"
|
||||
|
@ -591,14 +591,14 @@ Returns:
|
|||
// Added "Dummy" to keep backward compatibility.
|
||||
//
|
||||
CompressionType = EFI_STANDARD_COMPRESSION;
|
||||
CompressFunction = (COMPRESS_FUNCTION) Compress;
|
||||
CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
|
||||
|
||||
} else if (strcmpi (Type, "LZH") == 0) {
|
||||
//
|
||||
// EFI stardard compression (LZH)
|
||||
//
|
||||
CompressionType = EFI_STANDARD_COMPRESSION;
|
||||
CompressFunction = (COMPRESS_FUNCTION) Compress;
|
||||
CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
|
||||
|
||||
} else {
|
||||
//
|
||||
|
|
|
@ -28,7 +28,7 @@ Abstract:
|
|||
#include <Protocol/GuidedSectionExtraction.h>
|
||||
|
||||
#include "CommonLib.h"
|
||||
#include "EfiCompress.h"
|
||||
#include "Compress.h"
|
||||
#include "EfiCustomizedCompress.h"
|
||||
#include "Crc32.h"
|
||||
#include "EfiUtilityMsgs.h"
|
||||
|
@ -429,7 +429,7 @@ Returns:
|
|||
break;
|
||||
|
||||
case EFI_STANDARD_COMPRESSION:
|
||||
CompressFunction = (COMPRESS_FUNCTION) Compress;
|
||||
CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
|
||||
break;
|
||||
|
||||
case EFI_CUSTOMIZED_COMPRESSION:
|
||||
|
|
Loading…
Reference in New Issue