From d8c79a815f9e993b741ec38cd39498e674e1739e Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 8 Aug 2007 10:17:57 +0000 Subject: Update CustomDecompress library to support algorithm guid and Update DxeIpl and DxeCore to support custom decompress guid section parse. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3573 6f19259b-4bc3-4df7-8a09-765794883524 --- .../BaseUefiTianoCustomDecompressLib.c | 58 ++++++++++++++++++++-- .../BaseUefiTianoCustomDecompressLib.inf | 5 +- 2 files changed, 58 insertions(+), 5 deletions(-) (limited to 'IntelFrameworkModulePkg/Library') diff --git a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c index acde4d503e..14a151bc78 100644 --- a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c +++ b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ +#include #include "BaseUefiTianoCustomDecompressLibInternals.h" VOID @@ -775,6 +776,7 @@ Returns: RETURN_STATUS EFIAPI CustomDecompressGetInfo ( + IN CONST GUID *DecompressGuid, IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, @@ -787,7 +789,7 @@ Routine Description: The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo(). Arguments: - + DecompressGuid The guid matches this decompress method. Source - The source buffer containing the compressed data. SourceSize - The size of source buffer DestinationSize - The size of destination buffer. @@ -797,15 +799,21 @@ Returns: RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved. RETURN_INVALID_PARAMETER - The source data is corrupted + RETURN_UNSUPPORTED - Decompress method is not supported. --*/ { - return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize); + if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) { + return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize); + } else { + return RETURN_UNSUPPORTED; + } } RETURN_STATUS EFIAPI CustomDecompress ( + IN CONST GUID *DecompressGuid, IN CONST VOID *Source, IN OUT VOID *Destination, IN OUT VOID *Scratch @@ -817,7 +825,7 @@ Routine Description: The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress(). Arguments: - + DecompressGuid The guid matches this decompress method. Source - The source buffer containing the compressed data. Destination - The destination buffer to store the decompressed data Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data. @@ -826,8 +834,50 @@ Returns: RETURN_SUCCESS - Decompression is successfull RETURN_INVALID_PARAMETER - The source data is corrupted + RETURN_UNSUPPORTED - Decompress method is not supported. --*/ { - return UefiTianoDecompress (Source, Destination, Scratch, 2); + if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) { + return UefiTianoDecompress (Source, Destination, Scratch, 2); + } else { + return RETURN_UNSUPPORTED; + } } + +/** + Get decompress method guid list. + + @param[in, out] AlgorithmGuidTable The decompress method guid list. + @param[in, out] NumberOfAlgorithms The number of decompress methods. + + @retval RETURN_SUCCESS Get all algorithmes list successfully. + @retval RETURN_INVALID_PARAMETER Input paramter error. + @retval RETURN_OUT_OF_RESOURCES Source is not enough. + +**/ +RETURN_STATUS +EFIAPI +CustomDecompressGetAlgorithms ( + IN OUT GUID **AlgorithmGuidTable, + IN OUT UINTN *NumberOfAlgorithms + ) +{ + if (NumberOfAlgorithms == NULL) { + return RETURN_INVALID_PARAMETER; + } + + if (*NumberOfAlgorithms < 1) { + *NumberOfAlgorithms = 1; + return RETURN_OUT_OF_RESOURCES; + } + + if (AlgorithmGuidTable == NULL) { + return RETURN_INVALID_PARAMETER; + } + + AlgorithmGuidTable [0] = &gTianoCustomDecompressGuid; + *NumberOfAlgorithms = 1; + + return RETURN_SUCCESS; +} \ No newline at end of file diff --git a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf index 98b7430b2f..0d5a553108 100644 --- a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf +++ b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf @@ -24,7 +24,6 @@ EDK_RELEASE_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000 - # # The following information is for reference only and not required by the build tools. # @@ -38,8 +37,12 @@ [Packages] MdePkg/MdePkg.dec + IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec [LibraryClasses] BaseMemoryLib DebugLib +[Guids] + gTianoCustomDecompressGuid + -- cgit v1.2.3