-/*++\r
-\r
+/**@file\r
+ UEFI and Custom Decompress Library \r
+ \r
Copyright (c) 2006, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-Module Name:\r
-\r
- BaseUefiTianoCustomDecompressLib.c\r
-\r
-Abstract:\r
-\r
- UEFI and Custom Decompress Library \r
-\r
---*/\r
-\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
+**/\r
\r
+#include <Guid/CustomDecompress.h>\r
#include "BaseUefiTianoCustomDecompressLibInternals.h"\r
\r
VOID\r
RETURN_STATUS\r
EFIAPI\r
CustomDecompressGetInfo (\r
+ IN CONST GUID *DecompressGuid,\r
IN CONST VOID *Source,\r
IN UINT32 SourceSize,\r
OUT UINT32 *DestinationSize,\r
The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().\r
\r
Arguments:\r
-\r
+ DecompressGuid The guid matches this decompress method.\r
Source - The source buffer containing the compressed data.\r
SourceSize - The size of source buffer\r
DestinationSize - The size of destination buffer.\r
\r
RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
RETURN_INVALID_PARAMETER - The source data is corrupted\r
+ RETURN_UNSUPPORTED - Decompress method is not supported.\r
\r
--*/\r
{\r
- return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
+ if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) {\r
+ return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
+ } else {\r
+ return RETURN_UNSUPPORTED;\r
+ }\r
}\r
\r
RETURN_STATUS\r
EFIAPI\r
CustomDecompress (\r
+ IN CONST GUID *DecompressGuid,\r
IN CONST VOID *Source,\r
IN OUT VOID *Destination,\r
IN OUT VOID *Scratch\r
The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().\r
\r
Arguments:\r
-\r
+ DecompressGuid The guid matches this decompress method.\r
Source - The source buffer containing the compressed data.\r
Destination - The destination buffer to store the decompressed data\r
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.\r
\r
RETURN_SUCCESS - Decompression is successfull\r
RETURN_INVALID_PARAMETER - The source data is corrupted\r
+ RETURN_UNSUPPORTED - Decompress method is not supported.\r
\r
--*/\r
{\r
- return UefiTianoDecompress (Source, Destination, Scratch, 2);\r
+ if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) {\r
+ return UefiTianoDecompress (Source, Destination, Scratch, 2);\r
+ } else {\r
+ return RETURN_UNSUPPORTED;\r
+ }\r
}\r
+\r
+/**
+ Get decompress method guid list.\r
+\r
+ @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.\r
+ @retval RETURN_OUT_OF_RESOURCES Source is not enough.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+CustomDecompressGetAlgorithms (\r
+ IN OUT GUID **AlgorithmGuidTable,\r
+ IN OUT UINT32 *NumberOfAlgorithms\r
+ )\r
+{\r
+ if (NumberOfAlgorithms == NULL) {\r
+ return RETURN_INVALID_PARAMETER;\r
+ }\r
+ \r
+ if (*NumberOfAlgorithms < 1) {\r
+ *NumberOfAlgorithms = 1;\r
+ return RETURN_OUT_OF_RESOURCES;\r
+ }\r
+ \r
+ if (AlgorithmGuidTable == NULL) {\r
+ return RETURN_INVALID_PARAMETER;\r
+ }\r
+\r
+ AlgorithmGuidTable [0] = &gTianoCustomDecompressGuid;\r
+ *NumberOfAlgorithms = 1;\r
+ \r
+ return RETURN_SUCCESS; \r
+}
\ No newline at end of file