mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
(1) Using EfiCompress in place of TianoCompress as EFI_STANDARD_COMPRESSION type to conform to spec.
(2) Remove unused library class EdkPeCoffLoaderX64Lib and library instance EdkPeCoffLoaderX64Lib, because current BasePeCoffLib can supports IA32, EBC, & X64 images all. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2069 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
77206d75ad
commit
4afc6a7bf2
@ -805,7 +805,7 @@ Returns:
|
|||||||
// Decompress the stream
|
// Decompress the stream
|
||||||
//
|
//
|
||||||
if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {
|
if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {
|
||||||
Status = CoreLocateProtocol (&gEfiTianoDecompressProtocolGuid, NULL, (VOID **)&Decompress);
|
Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
|
||||||
} else {
|
} else {
|
||||||
Status = CoreLocateProtocol (&gEfiCustomizedDecompressProtocolGuid, NULL, (VOID **)&Decompress);
|
Status = CoreLocateProtocol (&gEfiCustomizedDecompressProtocolGuid, NULL, (VOID **)&Decompress);
|
||||||
}
|
}
|
||||||
|
@ -669,6 +669,13 @@ Returns:
|
|||||||
EFI_COMPRESSION_SECTION *CompressionSection;
|
EFI_COMPRESSION_SECTION *CompressionSection;
|
||||||
UINT32 FvAlignment;
|
UINT32 FvAlignment;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize local variables.
|
||||||
|
//
|
||||||
|
DecompressLibrary = NULL;
|
||||||
|
DstBuffer = NULL;
|
||||||
|
DstBufferSize = 0;
|
||||||
|
|
||||||
Status = PeiServicesFfsFindSectionData (
|
Status = PeiServicesFfsFindSectionData (
|
||||||
EFI_SECTION_COMPRESSION,
|
EFI_SECTION_COMPRESSION,
|
||||||
FfsFileHeader,
|
FfsFileHeader,
|
||||||
@ -784,8 +791,11 @@ Returns:
|
|||||||
|
|
||||||
switch (CompressionSection->CompressionType) {
|
switch (CompressionSection->CompressionType) {
|
||||||
case EFI_STANDARD_COMPRESSION:
|
case EFI_STANDARD_COMPRESSION:
|
||||||
|
//
|
||||||
|
// Load EFI standard compression.
|
||||||
|
//
|
||||||
if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {
|
if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {
|
||||||
DecompressLibrary = &gTianoDecompress;
|
DecompressLibrary = &gEfiDecompress;
|
||||||
} else {
|
} else {
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
@ -794,7 +804,7 @@ Returns:
|
|||||||
|
|
||||||
case EFI_CUSTOMIZED_COMPRESSION:
|
case EFI_CUSTOMIZED_COMPRESSION:
|
||||||
//
|
//
|
||||||
// Load user customized compression protocol.
|
// Load user customized compression.
|
||||||
//
|
//
|
||||||
if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {
|
if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {
|
||||||
DecompressLibrary = &gCustomDecompress;
|
DecompressLibrary = &gCustomDecompress;
|
||||||
@ -805,52 +815,71 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_NOT_COMPRESSED:
|
case EFI_NOT_COMPRESSED:
|
||||||
|
//
|
||||||
|
// Allocate destination buffer
|
||||||
|
//
|
||||||
|
DstBufferSize = CompressionSection->UncompressedLength;
|
||||||
|
DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
|
||||||
|
if (DstBuffer == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// stream is not actually compressed, just encapsulated. So just copy it.
|
||||||
|
//
|
||||||
|
CopyMem (DstBuffer, CompressionSection + 1, DstBufferSize);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
// Need to support not compressed file
|
// Don't support other unknown compression type.
|
||||||
//
|
//
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = DecompressLibrary->GetInfo (
|
if (CompressionSection->CompressionType != EFI_NOT_COMPRESSED) {
|
||||||
(UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
|
|
||||||
(UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),
|
|
||||||
&DstBufferSize,
|
|
||||||
&ScratchBufferSize
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
//
|
||||||
// GetInfo failed
|
// For compressed data, decompress them to dstbuffer.
|
||||||
//
|
//
|
||||||
return EFI_NOT_FOUND;
|
Status = DecompressLibrary->GetInfo (
|
||||||
|
(UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
|
||||||
|
(UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),
|
||||||
|
&DstBufferSize,
|
||||||
|
&ScratchBufferSize
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// GetInfo failed
|
||||||
|
//
|
||||||
|
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
|
||||||
|
//
|
||||||
|
DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
|
||||||
|
if (DstBuffer == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call decompress function
|
||||||
|
//
|
||||||
|
Status = DecompressLibrary->Decompress (
|
||||||
|
(CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
|
||||||
|
DstBuffer,
|
||||||
|
ScratchBuffer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate scratch buffer
|
|
||||||
//
|
|
||||||
ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
|
|
||||||
if (ScratchBuffer == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate destination buffer
|
|
||||||
//
|
|
||||||
DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
|
|
||||||
if (DstBuffer == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Call decompress function
|
|
||||||
//
|
|
||||||
Status = DecompressLibrary->Decompress (
|
|
||||||
(CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
|
|
||||||
DstBuffer,
|
|
||||||
ScratchBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;
|
CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;
|
||||||
if (CmpSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
|
if (CmpSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
|
||||||
//
|
//
|
||||||
@ -909,7 +938,6 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -44,10 +44,6 @@
|
|||||||
<IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
|
<IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
|
||||||
<HelpText/>
|
<HelpText/>
|
||||||
</LibraryClass>
|
</LibraryClass>
|
||||||
<LibraryClass Name="EdkPeCoffLoaderX64Lib">
|
|
||||||
<IncludeHeader>Include/Library/EdkPeCoffLoaderX64Lib.h</IncludeHeader>
|
|
||||||
<HelpText/>
|
|
||||||
</LibraryClass>
|
|
||||||
<LibraryClass Name="EdkScsiLib">
|
<LibraryClass Name="EdkScsiLib">
|
||||||
<IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
|
<IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
|
||||||
<HelpText/>
|
<HelpText/>
|
||||||
@ -210,10 +206,6 @@
|
|||||||
<IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
|
<IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
|
||||||
<HelpText/>
|
<HelpText/>
|
||||||
</IndustryStdHeader>
|
</IndustryStdHeader>
|
||||||
<IndustryStdHeader Name="EdkPeCoffLoaderX64Lib">
|
|
||||||
<IncludeHeader>Include/Library/EdkPeCoffLoaderX64Lib.h</IncludeHeader>
|
|
||||||
<HelpText/>
|
|
||||||
</IndustryStdHeader>
|
|
||||||
<IndustryStdHeader Name="EdkScsiLib">
|
<IndustryStdHeader Name="EdkScsiLib">
|
||||||
<IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
|
<IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
|
||||||
<HelpText/>
|
<HelpText/>
|
||||||
@ -399,7 +391,6 @@
|
|||||||
<Filename>Library/EdkIfrSupportLib/EdkIfrSupportLib.msa</Filename>
|
<Filename>Library/EdkIfrSupportLib/EdkIfrSupportLib.msa</Filename>
|
||||||
<Filename>Library/EdkNullCustomizedDecompressLib/EdkNullCustomizedDecompressLib.msa</Filename>
|
<Filename>Library/EdkNullCustomizedDecompressLib/EdkNullCustomizedDecompressLib.msa</Filename>
|
||||||
<Filename>Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa</Filename>
|
<Filename>Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa</Filename>
|
||||||
<Filename>Library/EdkPeCoffLoaderX64Lib/EdkPeCoffLoaderX64Lib.msa</Filename>
|
|
||||||
<Filename>Library/PeiPerformanceLib/PeiPerformanceLib.msa</Filename>
|
<Filename>Library/PeiPerformanceLib/PeiPerformanceLib.msa</Filename>
|
||||||
<Filename>Library/EdkScsiLib/EdkScsiLib.msa</Filename>
|
<Filename>Library/EdkScsiLib/EdkScsiLib.msa</Filename>
|
||||||
<Filename>Library/EdkUefiDebugLibConOut/EdkUefiDebugLibConOut.msa</Filename>
|
<Filename>Library/EdkUefiDebugLibConOut/EdkUefiDebugLibConOut.msa</Filename>
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
/*++
|
|
||||||
|
|
||||||
Copyright (c) 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
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
EdkPeCoffLoaderX64Lib.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
Wrap the Base PE/COFF loader with the PE COFF Protocol
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
#ifndef __EDK_PE_COFF_LOADER_X64_LIB__
|
|
||||||
#define __EDK_PE_COFF_LOADER_X64_LIB__
|
|
||||||
|
|
||||||
EFI_PEI_PE_COFF_LOADER_PROTOCOL *
|
|
||||||
EFIAPI
|
|
||||||
GetPeCoffLoaderX64Protocol (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -11,15 +11,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
EfiDecompress.c
|
Decompress.c
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
|
Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
|
||||||
|
for Efi and Tiano compress algorithm.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "EfiDecompress.h"
|
#include "Decompress.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Decompression algorithm begins here
|
// Decompression algorithm begins here
|
||||||
@ -33,11 +34,12 @@ Abstract:
|
|||||||
//
|
//
|
||||||
// C: Char&Len Set; P: Position Set; T: exTra Set
|
// C: Char&Len Set; P: Position Set; T: exTra Set
|
||||||
//
|
//
|
||||||
#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
|
#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
|
||||||
#define CBIT 9
|
#define CBIT 9
|
||||||
#define PBIT 5
|
#define EFIPBIT 4
|
||||||
#define TBIT 5
|
#define MAXPBIT 5
|
||||||
#define MAXNP ((1U << PBIT) - 1)
|
#define TBIT 5
|
||||||
|
#define MAXNP ((1U << MAXPBIT) - 1)
|
||||||
#define NT (CODE_BIT + 3)
|
#define NT (CODE_BIT + 3)
|
||||||
#if NT > MAXNP
|
#if NT > MAXNP
|
||||||
#define NPT NT
|
#define NPT NT
|
||||||
@ -68,6 +70,8 @@ typedef struct {
|
|||||||
UINT16 mPTTable[256];
|
UINT16 mPTTable[256];
|
||||||
} SCRATCH_DATA;
|
} SCRATCH_DATA;
|
||||||
|
|
||||||
|
STATIC UINT16 mPbit = EFIPBIT;
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
FillBuf (
|
FillBuf (
|
||||||
@ -556,7 +560,7 @@ Returns:
|
|||||||
|
|
||||||
ReadCLen (Sd);
|
ReadCLen (Sd);
|
||||||
|
|
||||||
Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, PBIT, (UINT16) (-1));
|
Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
|
||||||
if (Sd->mBadTableFlag != 0) {
|
if (Sd->mBadTableFlag != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -706,11 +710,10 @@ Decompress (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation of EFI_DECOMPRESS_PROTOCOL.Decompress().
|
The implementation Efi and Tiano Decompress().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
This - The protocol instance pointer
|
|
||||||
Source - The source buffer containing the compressed data.
|
Source - The source buffer containing the compressed data.
|
||||||
SrcSize - The size of source buffer
|
SrcSize - The size of source buffer
|
||||||
Destination - The destination buffer to store the decompressed data
|
Destination - The destination buffer to store the decompressed data
|
||||||
@ -788,3 +791,133 @@ Returns:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EfiGetInfo (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
OUT UINT32 *DstSize,
|
||||||
|
OUT UINT32 *ScratchSize
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation Efi Decompress GetInfo().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
return GetInfo (Source, SrcSize, DstSize, ScratchSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
TianoGetInfo (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
OUT UINT32 *DstSize,
|
||||||
|
OUT UINT32 *ScratchSize
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation Tiano Decompress GetInfo().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
return GetInfo (Source, SrcSize, DstSize, ScratchSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EfiDecompress (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
IN OUT VOID *Destination,
|
||||||
|
IN UINT32 DstSize,
|
||||||
|
IN OUT VOID *Scratch,
|
||||||
|
IN UINT32 ScratchSize
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation of Efi Decompress().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
Destination - The destination buffer to store the decompressed data
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - Decompression is successfull
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mPbit = EFIPBIT;
|
||||||
|
return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
TianoDecompress (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
IN OUT VOID *Destination,
|
||||||
|
IN UINT32 DstSize,
|
||||||
|
IN OUT VOID *Scratch,
|
||||||
|
IN UINT32 ScratchSize
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation of Tiano Decompress().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
Destination - The destination buffer to store the decompressed data
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - Decompression is successfull
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mPbit = MAXPBIT;
|
||||||
|
return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004, Intel Corporation
|
Copyright (c) 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,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
EfiDecompress.h
|
Decompress.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
@ -25,18 +25,17 @@ Abstract:
|
|||||||
#include <Common/UefiBaseTypes.h>
|
#include <Common/UefiBaseTypes.h>
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetInfo (
|
EfiGetInfo (
|
||||||
IN VOID *Source,
|
IN VOID *Source,
|
||||||
IN UINT32 SrcSize,
|
IN UINT32 SrcSize,
|
||||||
OUT UINT32 *DstSize,
|
OUT UINT32 *DstSize,
|
||||||
OUT UINT32 *ScratchSize
|
OUT UINT32 *ScratchSize
|
||||||
);
|
);
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
|
The implementation Efi Decompress GetInfo().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
@ -51,26 +50,24 @@ Returns:
|
|||||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
Decompress (
|
EfiDecompress (
|
||||||
IN VOID *Source,
|
IN VOID *Source,
|
||||||
IN UINT32 SrcSize,
|
IN UINT32 SrcSize,
|
||||||
IN OUT VOID *Destination,
|
IN OUT VOID *Destination,
|
||||||
IN UINT32 DstSize,
|
IN UINT32 DstSize,
|
||||||
IN OUT VOID *Scratch,
|
IN OUT VOID *Scratch,
|
||||||
IN UINT32 ScratchSize
|
IN UINT32 ScratchSize
|
||||||
)
|
);
|
||||||
;
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation of EFI_DECOMPRESS_PROTOCOL.Decompress().
|
The implementation of Efi Decompress().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
This - The protocol instance pointer
|
|
||||||
Source - The source buffer containing the compressed data.
|
Source - The source buffer containing the compressed data.
|
||||||
SrcSize - The size of source buffer
|
SrcSize - The size of source buffer
|
||||||
Destination - The destination buffer to store the decompressed data
|
Destination - The destination buffer to store the decompressed data
|
||||||
@ -84,6 +81,65 @@ Returns:
|
|||||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
TianoGetInfo (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
OUT UINT32 *DstSize,
|
||||||
|
OUT UINT32 *ScratchSize
|
||||||
|
);
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation Tiano Decompress GetInfo().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
TianoDecompress (
|
||||||
|
IN VOID *Source,
|
||||||
|
IN UINT32 SrcSize,
|
||||||
|
IN OUT VOID *Destination,
|
||||||
|
IN UINT32 DstSize,
|
||||||
|
IN OUT VOID *Scratch,
|
||||||
|
IN UINT32 ScratchSize
|
||||||
|
);
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
The implementation of Tiano Decompress().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Source - The source buffer containing the compressed data.
|
||||||
|
SrcSize - The size of source buffer
|
||||||
|
Destination - The destination buffer to store the decompressed data
|
||||||
|
DstSize - The size of destination buffer.
|
||||||
|
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||||
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - Decompression is successfull
|
||||||
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(*GETINFO_FUNCTION) (
|
(*GETINFO_FUNCTION) (
|
@ -19,7 +19,7 @@ typedef long long __int64;/*For cygwin build*/
|
|||||||
|
|
||||||
extern
|
extern
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
TianoCompress (
|
EfiCompress (
|
||||||
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 = TianoCompress (
|
Result = EfiCompress (
|
||||||
(char*) InputBuffer,
|
(char*) InputBuffer,
|
||||||
SourceSize,
|
SourceSize,
|
||||||
DestBuffer,
|
DestBuffer,
|
||||||
@ -61,12 +61,12 @@ 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 = TianoCompress(
|
Result = EfiCompress(
|
||||||
(char*) InputBuffer,
|
(char*) InputBuffer,
|
||||||
SourceSize,
|
SourceSize,
|
||||||
DestBuffer,
|
DestBuffer,
|
||||||
&DestSize
|
&DestSize
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// new a MV array to store the return compressed buffer
|
// new a MV array to store the return compressed buffer
|
||||||
|
@ -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) TianoCompress;
|
CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
|
||||||
|
|
||||||
} 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) TianoCompress;
|
CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -429,7 +429,7 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_STANDARD_COMPRESSION:
|
case EFI_STANDARD_COMPRESSION:
|
||||||
CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
|
CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_CUSTOMIZED_COMPRESSION:
|
case EFI_CUSTOMIZED_COMPRESSION:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user