Update code style and comments
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8640 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
736e104fa3
commit
b4b6c8de1e
@ -1,6 +1,7 @@
|
|||||||
/*++
|
/** @file
|
||||||
|
Lzma Custom decompress algorithm Guid definition
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2009, 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
|
||||||
@ -9,15 +10,7 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
**/
|
||||||
|
|
||||||
LzmaDecompress.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Lzma Custom decompress algorithm Guid definitions
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
#ifndef __LZMA_DECOMPRESS_GUID_H__
|
#ifndef __LZMA_DECOMPRESS_GUID_H__
|
||||||
#define __LZMA_DECOMPRESS_GUID_H__
|
#define __LZMA_DECOMPRESS_GUID_H__
|
||||||
|
@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __EFI_CUSTOM_DECOMPRESS_GUID_H__
|
#ifndef __TIANO_CUSTOM_DECOMPRESS_GUID_H__
|
||||||
#define __EFI_CUSTOM_DECOMPRESS_GUID_H__
|
#define __TIANO_CUSTOM_DECOMPRESS_GUID_H__
|
||||||
|
|
||||||
#define TIANO_CUSTOM_DECOMPRESS_GUID \
|
#define TIANO_CUSTOM_DECOMPRESS_GUID \
|
||||||
{ 0xA31280AD, 0x481E, 0x41B6, { 0x95, 0xE8, 0x12, 0x7F, 0x4C, 0x98, 0x47, 0x79 } }
|
{ 0xA31280AD, 0x481E, 0x41B6, { 0x95, 0xE8, 0x12, 0x7F, 0x4C, 0x98, 0x47, 0x79 } }
|
||||||
|
@ -551,9 +551,9 @@ DevicePathToStr (
|
|||||||
// Internal definitions
|
// Internal definitions
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CHAR16 *str;
|
CHAR16 *Str;
|
||||||
UINTN len;
|
UINTN Len;
|
||||||
UINTN maxlen;
|
UINTN Maxlen;
|
||||||
} POOL_PRINT;
|
} POOL_PRINT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1045,7 +1045,7 @@ DevPathVendor (
|
|||||||
The caller must free the resulting buffer.
|
The caller must free the resulting buffer.
|
||||||
|
|
||||||
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
|
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
|
||||||
@param fmt The format string
|
@param Fmt The format string
|
||||||
@param ... The data will be printed.
|
@param ... The data will be printed.
|
||||||
|
|
||||||
@return Allocated buffer with the formatted string printed in it.
|
@return Allocated buffer with the formatted string printed in it.
|
||||||
@ -1057,7 +1057,7 @@ CHAR16 *
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CatPrint (
|
CatPrint (
|
||||||
IN OUT POOL_PRINT *Str,
|
IN OUT POOL_PRINT *Str,
|
||||||
IN CHAR16 *fmt,
|
IN CHAR16 *Fmt,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
UEFI and Custom Decompress Library
|
UEFI and Tiano Custom Decompress Library
|
||||||
The function of UefiTianoDecompress() is interface for this module,
|
Tt will do Tiano or UEFI decompress with different verison parameter.
|
||||||
it will do tiano or uefi decompress with different verison parameter.
|
|
||||||
See EFI specification 1.1 Chapter 17 to get LZ77 compress/decompress.
|
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -29,8 +27,14 @@ FillBuf (
|
|||||||
IN UINT16 NumOfBits
|
IN UINT16 NumOfBits
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Left shift NumOfBits of bits in advance
|
||||||
|
//
|
||||||
Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
|
Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy data needed in bytes into mSbuBitBuf
|
||||||
|
//
|
||||||
while (NumOfBits > Sd->mBitCount) {
|
while (NumOfBits > Sd->mBitCount) {
|
||||||
|
|
||||||
Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
|
Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
|
||||||
@ -54,7 +58,14 @@ FillBuf (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Caculate additional bit count read to update mBitCount
|
||||||
|
//
|
||||||
Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
|
Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy NumOfBits of bits from mSubBitBuf into mBitBuf
|
||||||
|
//
|
||||||
Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
|
Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +90,14 @@ GetBits (
|
|||||||
{
|
{
|
||||||
UINT32 OutBits;
|
UINT32 OutBits;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Pop NumOfBits of Bits from Left
|
||||||
|
//
|
||||||
OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
|
OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fill up mBitBuf from source
|
||||||
|
//
|
||||||
FillBuf (Sd, NumOfBits);
|
FillBuf (Sd, NumOfBits);
|
||||||
|
|
||||||
return OutBits;
|
return OutBits;
|
||||||
@ -96,7 +113,7 @@ GetBits (
|
|||||||
@param NumOfChar Number of symbols in the symbol set
|
@param NumOfChar Number of symbols in the symbol set
|
||||||
@param BitLen Code length array
|
@param BitLen Code length array
|
||||||
@param TableBits The width of the mapping table
|
@param TableBits The width of the mapping table
|
||||||
@param Table The table
|
@param Table The table to be created.
|
||||||
|
|
||||||
@retval 0 OK.
|
@retval 0 OK.
|
||||||
@retval BAD_TABLE The table is corrupted.
|
@retval BAD_TABLE The table is corrupted.
|
||||||
@ -227,6 +244,8 @@ MakeTable (
|
|||||||
/**
|
/**
|
||||||
Decodes a position value.
|
Decodes a position value.
|
||||||
|
|
||||||
|
Get a position value according to Position Huffman Table.
|
||||||
|
|
||||||
@param Sd the global scratch data
|
@param Sd the global scratch data
|
||||||
|
|
||||||
@return The position value decoded.
|
@return The position value decoded.
|
||||||
@ -247,7 +266,7 @@ DecodeP (
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (Sd->mBitBuf & Mask) {
|
if ((Sd->mBitBuf & Mask) != 0) {
|
||||||
Val = Sd->mRight[Val];
|
Val = Sd->mRight[Val];
|
||||||
} else {
|
} else {
|
||||||
Val = Sd->mLeft[Val];
|
Val = Sd->mLeft[Val];
|
||||||
@ -471,21 +490,38 @@ DecodeC (
|
|||||||
if (Sd->mBlockSize == 0) {
|
if (Sd->mBlockSize == 0) {
|
||||||
//
|
//
|
||||||
// Starting a new block
|
// Starting a new block
|
||||||
|
// Read BlockSize from block header
|
||||||
//
|
//
|
||||||
Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
|
Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read in the Extra Set Code Length Arrary,
|
||||||
|
// Generate the Huffman code mapping table for Extra Set.
|
||||||
|
//
|
||||||
Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
|
Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
|
||||||
if (Sd->mBadTableFlag != 0) {
|
if (Sd->mBadTableFlag != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read in and decode the Char&Len Set Code Length Arrary,
|
||||||
|
// Generate the Huffman code mapping table for Char&Len Set.
|
||||||
|
//
|
||||||
ReadCLen (Sd);
|
ReadCLen (Sd);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read in the Position Set Code Length Arrary,
|
||||||
|
// Generate the Huffman code mapping table for the Position Set.
|
||||||
|
//
|
||||||
Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
|
Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
|
||||||
if (Sd->mBadTableFlag != 0) {
|
if (Sd->mBadTableFlag != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get one code according to Code&Set Huffman Table
|
||||||
|
//
|
||||||
Sd->mBlockSize--;
|
Sd->mBlockSize--;
|
||||||
Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
|
Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
|
||||||
|
|
||||||
@ -493,7 +529,7 @@ DecodeC (
|
|||||||
Mask = 1U << (BITBUFSIZ - 1 - 12);
|
Mask = 1U << (BITBUFSIZ - 1 - 12);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (Sd->mBitBuf & Mask) {
|
if ((Sd->mBitBuf & Mask) != 0) {
|
||||||
Index2 = Sd->mRight[Index2];
|
Index2 = Sd->mRight[Index2];
|
||||||
} else {
|
} else {
|
||||||
Index2 = Sd->mLeft[Index2];
|
Index2 = Sd->mLeft[Index2];
|
||||||
@ -511,9 +547,9 @@ DecodeC (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decode the source data ad put the resulting data into the destination buffer.
|
Decode the source data and put the resulting data into the destination buffer.
|
||||||
|
|
||||||
@param Sd - The global scratch data
|
@param Sd The global scratch data
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Decode (
|
Decode (
|
||||||
@ -529,6 +565,9 @@ Decode (
|
|||||||
DataIdx = 0;
|
DataIdx = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
//
|
||||||
|
// Get one code from mBitBuf
|
||||||
|
//
|
||||||
CharC = DecodeC (Sd);
|
CharC = DecodeC (Sd);
|
||||||
if (Sd->mBadTableFlag != 0) {
|
if (Sd->mBadTableFlag != 0) {
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -541,6 +580,9 @@ Decode (
|
|||||||
if (Sd->mOutBuf >= Sd->mOrigSize) {
|
if (Sd->mOutBuf >= Sd->mOrigSize) {
|
||||||
goto Done;
|
goto Done;
|
||||||
} else {
|
} else {
|
||||||
|
//
|
||||||
|
// Write orignal character into mDstBase
|
||||||
|
//
|
||||||
Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
|
Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,10 +592,19 @@ Decode (
|
|||||||
//
|
//
|
||||||
CharC = (UINT16) (CharC - (BIT8 - THRESHOLD));
|
CharC = (UINT16) (CharC - (BIT8 - THRESHOLD));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get string length
|
||||||
|
//
|
||||||
BytesRemain = CharC;
|
BytesRemain = CharC;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate string position
|
||||||
|
//
|
||||||
DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
|
DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write BytesRemain of bytes into mDstBase
|
||||||
|
//
|
||||||
BytesRemain--;
|
BytesRemain--;
|
||||||
while ((INT16) (BytesRemain) >= 0) {
|
while ((INT16) (BytesRemain) >= 0) {
|
||||||
Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
|
Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
|
||||||
@ -571,15 +622,43 @@ Done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
|
Given a compressed source buffer, this function retrieves the size of
|
||||||
|
the uncompressed buffer and the size of the scratch buffer required
|
||||||
|
to decompress the compressed source buffer.
|
||||||
|
|
||||||
|
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
|
||||||
|
required to decompress the buffer specified by Source and SourceSize.
|
||||||
|
If the size of the uncompressed buffer or the size of the scratch buffer cannot
|
||||||
|
be determined from the compressed data specified by Source and SourceData,
|
||||||
|
then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
|
||||||
|
buffer is returned in DestinationSize, the size of the scratch buffer is returned
|
||||||
|
in ScratchSize, and RETURN_SUCCESS is returned.
|
||||||
|
This function does not have scratch buffer available to perform a thorough
|
||||||
|
checking of the validity of the source data. It just retrieves the "Original Size"
|
||||||
|
field from the beginning bytes of the source data and output it as DestinationSize.
|
||||||
|
And ScratchSize is specific to the decompression implementation.
|
||||||
|
|
||||||
|
If Source is NULL, then ASSERT().
|
||||||
|
If DestinationSize is NULL, then ASSERT().
|
||||||
|
If ScratchSize is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Source The source buffer containing the compressed data.
|
@param Source The source buffer containing the compressed data.
|
||||||
@param SourceSize The size of source buffer
|
@param SourceSize The size, in bytes, of the source buffer.
|
||||||
@param DestinationSize The size of destination buffer.
|
@param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
|
||||||
@param ScratchSize The size of scratch buffer.
|
that will be generated when the compressed buffer specified
|
||||||
|
by Source and SourceSize is decompressed..
|
||||||
|
@param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
|
||||||
|
is required to decompress the compressed buffer specified
|
||||||
|
by Source and SourceSize.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
|
@retval RETURN_SUCCESS The size of the uncompressed data was returned
|
||||||
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
|
in DestinationSize and the size of the scratch
|
||||||
|
buffer was returned in ScratchSize.
|
||||||
|
@retval RETURN_INVALID_PARAMETER
|
||||||
|
The size of the uncompressed data or the size of
|
||||||
|
the scratch buffer cannot be determined from
|
||||||
|
the compressed data specified by Source
|
||||||
|
and SourceSize.
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -612,15 +691,34 @@ UefiDecompressGetInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
|
Decompresses a compressed source buffer by EFI or Tiano algorithm.
|
||||||
|
|
||||||
|
Extracts decompressed data to its original form.
|
||||||
|
This function is designed so that the decompression algorithm can be implemented
|
||||||
|
without using any memory services. As a result, this function is not allowed to
|
||||||
|
call any memory allocation services in its implementation. It is the caller's
|
||||||
|
responsibility to allocate and free the Destination and Scratch buffers.
|
||||||
|
If the compressed source data specified by Source is successfully decompressed
|
||||||
|
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
|
||||||
|
specified by Source is not in a valid compressed data format,
|
||||||
|
then RETURN_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
|
If Source is NULL, then ASSERT().
|
||||||
|
If Destination is NULL, then ASSERT().
|
||||||
|
If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Source The source buffer containing the compressed data.
|
@param Source The source buffer containing the compressed data.
|
||||||
@param Destination The destination buffer to store the decompressed data
|
@param Destination The destination buffer to store the decompressed data
|
||||||
@param Scratch The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
@param Scratch A temporary scratch buffer that is used to perform the decompression.
|
||||||
@param Version 1 for UEFI Decompress algoruthm, 2 for Tiano Decompess algorithm
|
This is an optional parameter that may be NULL if the
|
||||||
|
required scratch buffer size is 0.
|
||||||
|
@param Version 1 for UEFI Decompress algoruthm, 2 for Tiano Decompess algorithm.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Decompression is successfull
|
@retval RETURN_SUCCESS Decompression completed successfully, and
|
||||||
@retval RETURN_INVALID_PARAMETER The source data is corrupted
|
the uncompressed buffer is returned in Destination.
|
||||||
|
@retval RETURN_INVALID_PARAMETER
|
||||||
|
The source buffer specified by Source is corrupted
|
||||||
|
(not in a valid compressed format).
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -677,6 +775,9 @@ UefiTianoDecompress (
|
|||||||
}
|
}
|
||||||
Sd->mSrcBase = (UINT8 *)Src;
|
Sd->mSrcBase = (UINT8 *)Src;
|
||||||
Sd->mDstBase = Dst;
|
Sd->mDstBase = Dst;
|
||||||
|
//
|
||||||
|
// CompSize and OrigSize are caculated in bytes
|
||||||
|
//
|
||||||
Sd->mCompSize = CompSize;
|
Sd->mCompSize = CompSize;
|
||||||
Sd->mOrigSize = OrigSize;
|
Sd->mOrigSize = OrigSize;
|
||||||
|
|
||||||
@ -701,14 +802,33 @@ UefiTianoDecompress (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
|
Decompresses a UEFI compressed source buffer.
|
||||||
|
|
||||||
@param Source - The source buffer containing the compressed data.
|
Extracts decompressed data to its original form.
|
||||||
@param Destination - The destination buffer to store the decompressed data
|
This function is designed so that the decompression algorithm can be implemented
|
||||||
@param Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
without using any memory services. As a result, this function is not allowed to
|
||||||
|
call any memory allocation services in its implementation. It is the caller's
|
||||||
|
responsibility to allocate and free the Destination and Scratch buffers.
|
||||||
|
If the compressed source data specified by Source is successfully decompressed
|
||||||
|
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
|
||||||
|
specified by Source is not in a valid compressed data format,
|
||||||
|
then RETURN_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS - Decompression is successfull
|
If Source is NULL, then ASSERT().
|
||||||
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
|
If Destination is NULL, then ASSERT().
|
||||||
|
If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Source The source buffer containing the compressed data.
|
||||||
|
@param Destination The destination buffer to store the decompressed data
|
||||||
|
@param Scratch A temporary scratch buffer that is used to perform the decompression.
|
||||||
|
This is an optional parameter that may be NULL if the
|
||||||
|
required scratch buffer size is 0.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS Decompression completed successfully, and
|
||||||
|
the uncompressed buffer is returned in Destination.
|
||||||
|
@retval RETURN_INVALID_PARAMETER
|
||||||
|
The source buffer specified by Source is corrupted
|
||||||
|
(not in a valid compressed format).
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -722,16 +842,37 @@ UefiDecompress (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The internal implementation of Tiano decompress GetInfo.
|
Examines a GUIDed section and returns the size of the decoded buffer and the
|
||||||
|
size of an optional scratch buffer required to actually decode the data in a GUIDed section.
|
||||||
|
|
||||||
@param InputSection Buffer containing the input GUIDed section to be processed.
|
Examines a GUIDed section specified by InputSection.
|
||||||
@param OutputBufferSize The size of OutputBuffer.
|
If GUID for InputSection does not match the GUID that this handler supports,
|
||||||
@param ScratchBufferSize The size of ScratchBuffer.
|
then RETURN_UNSUPPORTED is returned.
|
||||||
@param SectionAttribute The attribute of the input guided section.
|
If the required information can not be retrieved from InputSection,
|
||||||
|
then RETURN_INVALID_PARAMETER is returned.
|
||||||
|
If the GUID of InputSection does match the GUID that this handler supports,
|
||||||
|
then the size required to hold the decoded buffer is returned in OututBufferSize,
|
||||||
|
the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field
|
||||||
|
from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.
|
||||||
|
|
||||||
|
If InputSection is NULL, then ASSERT().
|
||||||
|
If OutputBufferSize is NULL, then ASSERT().
|
||||||
|
If ScratchBufferSize is NULL, then ASSERT().
|
||||||
|
If SectionAttribute is NULL, then ASSERT().
|
||||||
|
|
||||||
|
|
||||||
|
@param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
|
||||||
|
@param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required
|
||||||
|
if the buffer specified by InputSection were decoded.
|
||||||
|
@param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space
|
||||||
|
if the buffer specified by InputSection were decoded.
|
||||||
|
@param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes
|
||||||
|
field of EFI_GUID_DEFINED_SECTION in the PI Specification.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The information about InputSection was returned.
|
||||||
|
@retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
|
||||||
|
@retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
|
|
||||||
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
|
|
||||||
The GUID in InputSection does not match this instance guid.
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -771,19 +912,36 @@ TianoDecompressGetInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The implementation of Tiano Decompress().
|
Decompress a Tiano compressed GUIDed section into a caller allocated output buffer.
|
||||||
|
|
||||||
@param InputSection Buffer containing the input GUIDed section to be processed.
|
Decodes the GUIDed section specified by InputSection.
|
||||||
@param OutputBuffer OutputBuffer to point to the start of the section's contents.
|
If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.
|
||||||
if guided data is not prcessed. Otherwise,
|
If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.
|
||||||
OutputBuffer to contain the output data, which is allocated by the caller.
|
If the GUID of InputSection does match the GUID that this handler supports, then InputSection
|
||||||
@param ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
|
is decoded into the buffer specified by OutputBuffer and the authentication status of this
|
||||||
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the
|
decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the
|
||||||
authentication status of the output buffer.
|
data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise,
|
||||||
|
the decoded data will be placed in caller allocated buffer specified by OutputBuffer.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Decompression is successfull
|
If InputSection is NULL, then ASSERT().
|
||||||
@retval RETURN_INVALID_PARAMETER The source data is corrupted, or
|
If OutputBuffer is NULL, then ASSERT().
|
||||||
The GUID in InputSection does not match this instance guid.
|
If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().
|
||||||
|
If AuthenticationStatus is NULL, then ASSERT().
|
||||||
|
|
||||||
|
|
||||||
|
@param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
|
||||||
|
@param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation.
|
||||||
|
@param[in] ScratchBuffer A caller allocated buffer that may be required by this function
|
||||||
|
as a scratch buffer to perform the decode operation.
|
||||||
|
@param[out] AuthenticationStatus
|
||||||
|
A pointer to the authentication status of the decoded output buffer.
|
||||||
|
See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
|
||||||
|
section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must
|
||||||
|
never be set by this handler.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The buffer specified by InputSection was decoded.
|
||||||
|
@retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
|
||||||
|
@retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
@ -796,10 +954,7 @@ TianoDecompress (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (OutputBuffer != NULL);
|
ASSERT (OutputBuffer != NULL);
|
||||||
|
ASSERT (InputSection != NULL);
|
||||||
if (InputSection == NULL) {
|
|
||||||
return RETURN_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CompareGuid (
|
if (!CompareGuid (
|
||||||
&gTianoCustomDecompressGuid,
|
&gTianoCustomDecompressGuid,
|
||||||
@ -824,7 +979,7 @@ TianoDecompress (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Register TianoDecompress handler.
|
Registers TianoDecompress and TianoDecompressGetInfo handlers with TianoCustomerDecompressGuid
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Register successfully.
|
@retval RETURN_SUCCESS Register successfully.
|
||||||
@retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.
|
@retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# Uefi Tiano Decomression Library
|
# This library instance produces UefiDecompressLib and Tiano Custom decompression algorithm.
|
||||||
|
# Tiano custom decompression algorithm shares most of code with Uefi Decompress algorithm.
|
||||||
#
|
#
|
||||||
# Uefi Decompression library instance
|
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation.
|
# Copyright (c) 2006 - 2009, Intel Corporation.
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
@ -11,7 +11,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
@ -21,7 +20,6 @@
|
|||||||
MODULE_TYPE = BASE
|
MODULE_TYPE = BASE
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
LIBRARY_CLASS = UefiDecompressLib
|
LIBRARY_CLASS = UefiDecompressLib
|
||||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
|
||||||
CONSTRUCTOR = TianoDecompressLibConstructor
|
CONSTRUCTOR = TianoDecompressLibConstructor
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -45,5 +43,4 @@
|
|||||||
ExtractGuidedSectionLib
|
ExtractGuidedSectionLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gTianoCustomDecompressGuid
|
gTianoCustomDecompressGuid ## PRODUCED ## GUID specifies tiano custom decompress algorithm.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Internal include file for Base UEFI Decompress Libary.
|
Internal data structure and interfaces defintions for UEFI and Tiano Decompress Libary.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -10,8 +10,6 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name: BaseUefiCustomDecompressLibInternals.h
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __BASE_UEFI_TIANO_CUSTOM_DECOMPRESS_LIB_INTERNALS_H__
|
#ifndef __BASE_UEFI_TIANO_CUSTOM_DECOMPRESS_LIB_INTERNALS_H__
|
||||||
@ -72,16 +70,16 @@ typedef struct {
|
|||||||
UINT16 mCTable[4096];
|
UINT16 mCTable[4096];
|
||||||
UINT16 mPTTable[256];
|
UINT16 mPTTable[256];
|
||||||
|
|
||||||
//
|
///
|
||||||
// The length of the field 'Position Set Code Length Array Size' in Block Header.
|
/// The length of the field 'Position Set Code Length Array Size' in Block Header.
|
||||||
// For UEFI 2.0 de/compression algorithm, mPBit = 4
|
/// For UEFI 2.0 de/compression algorithm, mPBit = 4
|
||||||
// For Tiano de/compression algorithm, mPBit = 5
|
/// For Tiano de/compression algorithm, mPBit = 5
|
||||||
//
|
///
|
||||||
UINT8 mPBit;
|
UINT8 mPBit;
|
||||||
} SCRATCH_DATA;
|
} SCRATCH_DATA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read NumOfBit of bits from source into mBitBuf
|
Read NumOfBit of bits from source into mBitBuf.
|
||||||
|
|
||||||
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
|
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
|
||||||
|
|
||||||
@ -96,7 +94,7 @@ FillBuf (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get NumOfBits of bits out from mBitBuf
|
Get NumOfBits of bits out from mBitBuf.
|
||||||
|
|
||||||
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
||||||
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
||||||
@ -124,7 +122,7 @@ GetBits (
|
|||||||
@param NumOfChar Number of symbols in the symbol set
|
@param NumOfChar Number of symbols in the symbol set
|
||||||
@param BitLen Code length array
|
@param BitLen Code length array
|
||||||
@param TableBits The width of the mapping table
|
@param TableBits The width of the mapping table
|
||||||
@param Table The table
|
@param Table The table to be created.
|
||||||
|
|
||||||
@retval 0 OK.
|
@retval 0 OK.
|
||||||
@retval BAD_TABLE The table is corrupted.
|
@retval BAD_TABLE The table is corrupted.
|
||||||
@ -211,8 +209,6 @@ DecodeC (
|
|||||||
/**
|
/**
|
||||||
Decode the source data and put the resulting data into the destination buffer.
|
Decode the source data and put the resulting data into the destination buffer.
|
||||||
|
|
||||||
Decode the source data and put the resulting data into the destination buffer.
|
|
||||||
|
|
||||||
@param Sd The global scratch data
|
@param Sd The global scratch data
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -221,13 +217,4 @@ Decode (
|
|||||||
SCRATCH_DATA *Sd
|
SCRATCH_DATA *Sd
|
||||||
);
|
);
|
||||||
|
|
||||||
RETURN_STATUS
|
|
||||||
EFIAPI
|
|
||||||
UefiTianoDecompress (
|
|
||||||
IN CONST VOID *Source,
|
|
||||||
IN OUT VOID *Destination,
|
|
||||||
IN OUT VOID *Scratch,
|
|
||||||
IN UINT32 Version
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
The caller must free the resulting buffer.
|
The caller must free the resulting buffer.
|
||||||
|
|
||||||
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
|
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
|
||||||
@param fmt The format string
|
@param Fmt The format string
|
||||||
@param ... The data will be printed.
|
@param ... The data will be printed.
|
||||||
|
|
||||||
@return Allocated buffer with the formatted string printed in it.
|
@return Allocated buffer with the formatted string printed in it.
|
||||||
@ -32,7 +32,7 @@ CHAR16 *
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CatPrint (
|
CatPrint (
|
||||||
IN OUT POOL_PRINT *Str,
|
IN OUT POOL_PRINT *Str,
|
||||||
IN CHAR16 *fmt,
|
IN CHAR16 *Fmt,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -42,36 +42,36 @@ CatPrint (
|
|||||||
|
|
||||||
AppendStr = AllocateZeroPool (0x1000);
|
AppendStr = AllocateZeroPool (0x1000);
|
||||||
if (AppendStr == NULL) {
|
if (AppendStr == NULL) {
|
||||||
return Str->str;
|
return Str->Str;
|
||||||
}
|
}
|
||||||
|
|
||||||
VA_START (Args, fmt);
|
VA_START (Args, Fmt);
|
||||||
UnicodeVSPrint (AppendStr, 0x1000, fmt, Args);
|
UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
if (NULL == Str->str) {
|
if (NULL == Str->Str) {
|
||||||
StringSize = StrSize (AppendStr);
|
StringSize = StrSize (AppendStr);
|
||||||
Str->str = AllocateZeroPool (StringSize);
|
Str->Str = AllocateZeroPool (StringSize);
|
||||||
ASSERT (Str->str != NULL);
|
ASSERT (Str->Str != NULL);
|
||||||
} else {
|
} else {
|
||||||
StringSize = StrSize (AppendStr);
|
StringSize = StrSize (AppendStr);
|
||||||
StringSize += (StrSize (Str->str) - sizeof (UINT16));
|
StringSize += (StrSize (Str->Str) - sizeof (UINT16));
|
||||||
|
|
||||||
Str->str = ReallocatePool (
|
Str->Str = ReallocatePool (
|
||||||
StrSize (Str->str),
|
StrSize (Str->Str),
|
||||||
StringSize,
|
StringSize,
|
||||||
Str->str
|
Str->Str
|
||||||
);
|
);
|
||||||
ASSERT (Str->str != NULL);
|
ASSERT (Str->Str != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Str->maxlen = MAX_CHAR * sizeof (UINT16);
|
Str->Maxlen = MAX_CHAR * sizeof (UINT16);
|
||||||
if (StringSize < Str->maxlen) {
|
if (StringSize < Str->Maxlen) {
|
||||||
StrCat (Str->str, AppendStr);
|
StrCat (Str->Str, AppendStr);
|
||||||
Str->len = StringSize - sizeof (UINT16);
|
Str->Len = StringSize - sizeof (UINT16);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (AppendStr);
|
FreePool (AppendStr);
|
||||||
return Str->str;
|
return Str->Str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1521,7 +1521,7 @@ DevicePathToStr (
|
|||||||
//
|
//
|
||||||
// Put a path seperator in if needed
|
// Put a path seperator in if needed
|
||||||
//
|
//
|
||||||
if (Str.len && DumpNode != DevPathEndInstance) {
|
if (Str.Len && DumpNode != DevPathEndInstance) {
|
||||||
CatPrint (&Str, L"/");
|
CatPrint (&Str, L"/");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1536,9 +1536,9 @@ DevicePathToStr (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
NewSize = (Str.len + 1) * sizeof (CHAR16);
|
NewSize = (Str.Len + 1) * sizeof (CHAR16);
|
||||||
Str.str = ReallocatePool (NewSize, NewSize, Str.str);
|
Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);
|
||||||
ASSERT (Str.str != NULL);
|
ASSERT (Str.Str != NULL);
|
||||||
Str.str[Str.len] = 0;
|
Str.Str[Str.Len] = 0;
|
||||||
return Str.str;
|
return Str.Str;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Recovery Library. This library class defines a set of methods related do recovery.
|
This Library uses Framework RecoveryModule PPI to system recovery.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008 Intel Corporation
|
Copyright (c) 2006 - 2009 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# Recovery Library for PEIM
|
# PEIM Recovery Library supports system recovery boot.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation.
|
# Copyright (c) 2006 - 2009, Intel Corporation.
|
||||||
#
|
#
|
||||||
@ -42,6 +42,6 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiPeiRecoveryModulePpiGuid # PPI ALWAYS_CONSUMED
|
gEfiPeiRecoveryModulePpiGuid ## CONSUMES
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user