MdePkg: Merge TianoCustomDecompress algorithm into
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1722 We plan to merge the BaseUefiTianoCustomDecompressLib in MdeModulePkg into the BaseUefDecompressLib in MdePkg. In order to reduce the duplicated codes and maintain easily. This patch adds a new fdf file in BaseUefDecompressLib (BaseUefiTianoCustomDecompressLib.inf) to keep the same functionality and usage model with the one in MdeModulePkg, and then update consumer to use this new one one and remove the one in MdeModulePkg finally. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Internal data structure defintions for Base UEFI Decompress Library.
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
@@ -9,6 +9,11 @@
|
||||
#ifndef __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
|
||||
#define __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
|
||||
|
||||
#include <Base.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiDecompressLib.h>
|
||||
//
|
||||
// Decompression algorithm begins here
|
||||
//
|
||||
@@ -58,6 +63,7 @@ typedef struct {
|
||||
///
|
||||
/// The length of the field 'Position Set Code Length Array Size' in Block Header.
|
||||
/// For UEFI 2.0 de/compression algorithm, mPBit = 4.
|
||||
/// For Tiano de/compression algorithm, mPBit = 5.
|
||||
///
|
||||
UINT8 mPBit;
|
||||
} SCRATCH_DATA;
|
||||
@@ -202,4 +208,40 @@ Decode (
|
||||
SCRATCH_DATA *Sd
|
||||
);
|
||||
|
||||
/**
|
||||
Decompresses a compressed source buffer.
|
||||
|
||||
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 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
|
||||
UefiTianoDecompress (
|
||||
IN CONST VOID *Source,
|
||||
IN OUT VOID *Destination,
|
||||
IN OUT VOID *Scratch,
|
||||
IN UINT32 Version
|
||||
);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user