]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/Decompress.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / Decompress.h
diff --git a/OldMdePkg/Include/Protocol/Decompress.h b/OldMdePkg/Include/Protocol/Decompress.h
new file mode 100644 (file)
index 0000000..7c295f3
--- /dev/null
@@ -0,0 +1,121 @@
+/** @file\r
+  The Decompress Protocol Interface\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
+  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:  Decompress.h\r
+\r
+**/\r
+\r
+#ifndef __DECOMPRESS_H__\r
+#define __DECOMPRESS_H__\r
+\r
+#define EFI_DECOMPRESS_PROTOCOL_GUID \\r
+  { \\r
+    0xd8117cfe, 0x94a6, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_DECOMPRESS_PROTOCOL  EFI_DECOMPRESS_PROTOCOL;\r
+\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
+  @param  This            The protocol instance pointer\r
+  @param  Source          The source buffer containing the compressed data.\r
+  @param  SourceSize      The size, in bytes, of source buffer.\r
+  @param  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
+  @param  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
+  @retval  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
+  @retval  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
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DECOMPRESS_GET_INFO) (\r
+  IN EFI_DECOMPRESS_PROTOCOL            *This,\r
+  IN   VOID                             *Source,\r
+  IN   UINT32                           SourceSize,\r
+  OUT  UINT32                           *DestinationSize,\r
+  OUT  UINT32                           *ScratchSize\r
+  );\r
+\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
+  @param  This            The protocol instance pointer\r
+  @param  Source          The source buffer containing the compressed data.\r
+  @param  SourceSize      The size of source data.\r
+  @param  Destination     On output, the destination buffer that contains\r
+                          the uncompressed data.\r
+  @param  DestinationSize The size of destination buffer. The size of destination\r
+                          buffer needed is obtained from GetInfo().\r
+  @param  Scratch         A temporary scratch buffer that is used to perform the\r
+                          decompression.          \r
+  @param  ScratchSize     The size of scratch buffer. The size of scratch buffer needed\r
+                          is obtained from GetInfo().\r
+\r
+  @retval  EFI_SUCCESS          Decompression completed successfully, and the uncompressed\r
+                                buffer is returned in Destination.\r
+  @retval EFI_INVALID_PARAMETER The source buffer specified by Source and SourceSize is\r
+                                corrupted (not in a valid compressed format).\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DECOMPRESS_DECOMPRESS) (\r
+  IN EFI_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
+struct _EFI_DECOMPRESS_PROTOCOL {\r
+  EFI_DECOMPRESS_GET_INFO   GetInfo;\r
+  EFI_DECOMPRESS_DECOMPRESS Decompress;\r
+};\r
+\r
+extern EFI_GUID gEfiDecompressProtocolGuid;\r
+\r
+#endif\r