--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004, 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
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \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
+ CustomizedDecompress.h\r
+ \r
+Abstract:\r
+\r
+ The user Customized Decompress Protocol Interface\r
+\r
+--*/\r
+\r
+#ifndef _CUSTOMIZED_DECOMPRESS_H_\r
+#define _CUSTOMIZED_DECOMPRESS_H_\r
+\r
+#define EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL_GUID \\r
+ { 0x9a44198e, 0xa4a2, 0x44e6, 0x8a, 0x1f, 0x39, 0xbe, 0xfd, 0xac, 0x89, 0x6f }\r
+\r
+EFI_FORWARD_DECLARATION (EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL);\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_GET_INFO) (\r
+ IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r
+ IN VOID *Source,\r
+ IN UINT32 SourceSize,\r
+ OUT UINT32 *DestinationSize,\r
+ OUT UINT32 *ScratchSize\r
+ );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ The GetInfo() function retrieves the size of the uncompressed buffer \r
+ and the temporary scratch buffer required to decompress the buffer \r
+ specified by Source and SourceSize. If the size of the uncompressed\r
+ buffer or the size of the scratch buffer cannot be determined from \r
+ the compressed data specified by Source and SourceData, then \r
+ EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed\r
+ buffer is returned in DestinationSize, the size of the scratch buffer is \r
+ returned in ScratchSize, and EFI_SUCCESS is returned.\r
+ \r
+ The GetInfo() function does not have scratch buffer available to perform \r
+ a thorough checking of the validity of the source data. It just retrieves\r
+ the 'Original Size' field from the beginning bytes of the source data and\r
+ output it as DestinationSize. And ScratchSize is specific to the decompression\r
+ implementation.\r
+\r
+Arguments:\r
+\r
+ This - The protocol instance pointer\r
+ Source - The source buffer containing the compressed data.\r
+ SourceSize - The size, in bytes, of source buffer.\r
+ DestinationSize - A pointer to the size, in bytes, of the uncompressed buffer\r
+ that will be generated when the compressed buffer specified \r
+ by Source and SourceSize is decompressed.\r
+ ScratchSize - A pointer to the size, in bytes, of the scratch buffer that \r
+ is required to decompress the compressed buffer specified by\r
+ Source and SourceSize.\r
+\r
+Returns:\r
+ EFI_SUCCESS - The size of the uncompressed data was returned in DestinationSize\r
+ and the size of the scratch buffer was returned in ScratchSize.\r
+ EFI_INVALID_PARAMETER - The size of the uncompressed data or the size of the scratch\r
+ buffer cannot be determined from the compressed data specified by \r
+ Source and SourceData.\r
+\r
+--*/\r
+\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS) (\r
+ IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r
+ IN VOID* Source,\r
+ IN UINT32 SourceSize,\r
+ IN OUT VOID* Destination,\r
+ IN UINT32 DestinationSize,\r
+ IN OUT VOID* Scratch,\r
+ IN UINT32 ScratchSize\r
+ );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ The Decompress() function extracts decompressed data to its original form.\r
+ \r
+ This protocol is designed so that the decompression algorithm can be \r
+ implemented without using any memory services. As a result, the \r
+ Decompress() function is not allowed to call AllocatePool() or \r
+ AllocatePages() in its implementation. It is the caller's responsibility \r
+ to allocate and free the Destination and Scratch buffers.\r
+ \r
+ If the compressed source data specified by Source and SourceSize is \r
+ sucessfully decompressed into Destination, then EFI_SUCCESS is returned. \r
+ If the compressed source data specified by Source and SourceSize is not in \r
+ a valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
+\r
+Arguments:\r
+\r
+ This - The protocol instance pointer\r
+ Source - The source buffer containing the compressed data.\r
+ SourceSize - The size of source data.\r
+ Destination - On output, the destination buffer that contains \r
+ the uncompressed data.\r
+ DestinationSize - The size of destination buffer. The size of destination\r
+ buffer needed is obtained from GetInfo().\r
+ Scratch - A temporary scratch buffer that is used to perform the \r
+ decompression.\r
+ ScratchSize - The size of scratch buffer. The size of scratch buffer needed\r
+ is obtained from GetInfo().\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - Decompression completed successfully, and the uncompressed \r
+ buffer is returned in Destination.\r
+ EFI_INVALID_PARAMETER \r
+ - The source buffer specified by Source and SourceSize is \r
+ corrupted (not in a valid compressed format).\r
+\r
+--*/\r
+\r
+typedef struct _EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL {\r
+ EFI_CUSTOMIZED_DECOMPRESS_GET_INFO GetInfo;\r
+ EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS Decompress;\r
+} EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiCustomizedDecompressProtocolGuid;\r
+\r
+#endif\r