]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Decompress.h
Updated headers to follow coding standard
[mirror_edk2.git] / MdePkg / Include / Protocol / Decompress.h
CommitLineData
d1f95000 1/** @file\r
2 The Decompress Protocol Interface\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
d1f95000 13**/\r
14\r
15#ifndef __DECOMPRESS_H__\r
16#define __DECOMPRESS_H__\r
17\r
18#define EFI_DECOMPRESS_PROTOCOL_GUID \\r
19 { \\r
20 0xd8117cfe, 0x94a6, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
21 }\r
22\r
23typedef struct _EFI_DECOMPRESS_PROTOCOL EFI_DECOMPRESS_PROTOCOL;\r
24\r
25/**\r
26 The GetInfo() function retrieves the size of the uncompressed buffer \r
27 and the temporary scratch buffer required to decompress the buffer \r
28 specified by Source and SourceSize. If the size of the uncompressed\r
29 buffer or the size of the scratch buffer cannot be determined from \r
30 the compressed data specified by Source and SourceData, then \r
31 EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed\r
32 buffer is returned in DestinationSize, the size of the scratch buffer is \r
33 returned in ScratchSize, and EFI_SUCCESS is returned.\r
34\r
35 The GetInfo() function does not have scratch buffer available to perform \r
36 a thorough checking of the validity of the source data. It just retrieves\r
37 the 'Original Size' field from the beginning bytes of the source data and\r
38 output it as DestinationSize. And ScratchSize is specific to the decompression\r
39 implementation.\r
40\r
41 @param This The protocol instance pointer\r
42 @param Source The source buffer containing the compressed data.\r
43 @param SourceSize The size, in bytes, of source buffer.\r
44 @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r
45 that will be generated when the compressed buffer specified\r
46 by Source and SourceSize is decompressed.\r
47 @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that\r
48 is required to decompress the compressed buffer specified by\r
49 Source and SourceSize.\r
50\r
51 @retval EFI_SUCCESS The size of the uncompressed data was returned in DestinationSize\r
52 and the size of the scratch buffer was returned in ScratchSize.\r
53 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of the scratch\r
54 buffer cannot be determined from the compressed data specified by\r
55 Source and SourceData.\r
56\r
57**/\r
58typedef\r
59EFI_STATUS\r
60(EFIAPI *EFI_DECOMPRESS_GET_INFO) (\r
61 IN EFI_DECOMPRESS_PROTOCOL *This,\r
62 IN VOID *Source,\r
63 IN UINT32 SourceSize,\r
64 OUT UINT32 *DestinationSize,\r
65 OUT UINT32 *ScratchSize\r
66 );\r
67\r
68/**\r
69 The Decompress() function extracts decompressed data to its original form.\r
70\r
71 This protocol is designed so that the decompression algorithm can be \r
72 implemented without using any memory services. As a result, the \r
73 Decompress() function is not allowed to call AllocatePool() or \r
74 AllocatePages() in its implementation. It is the caller's responsibility \r
75 to allocate and free the Destination and Scratch buffers.\r
76\r
77 If the compressed source data specified by Source and SourceSize is \r
78 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. \r
79 If the compressed source data specified by Source and SourceSize is not in \r
80 a valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
81\r
82 @param This The protocol instance pointer\r
83 @param Source The source buffer containing the compressed data.\r
84 @param SourceSize The size of source data.\r
85 @param Destination On output, the destination buffer that contains\r
86 the uncompressed data.\r
87 @param DestinationSize The size of destination buffer. The size of destination\r
88 buffer needed is obtained from GetInfo().\r
89 @param Scratch A temporary scratch buffer that is used to perform the\r
90 decompression. \r
91 @param ScratchSize The size of scratch buffer. The size of scratch buffer needed\r
92 is obtained from GetInfo().\r
93\r
94 @retval EFI_SUCCESS Decompression completed successfully, and the uncompressed\r
95 buffer is returned in Destination.\r
96 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and SourceSize is\r
97 corrupted (not in a valid compressed format).\r
98\r
99**/\r
100typedef\r
101EFI_STATUS\r
102(EFIAPI *EFI_DECOMPRESS_DECOMPRESS) (\r
103 IN EFI_DECOMPRESS_PROTOCOL *This,\r
104 IN VOID *Source,\r
105 IN UINT32 SourceSize,\r
106 IN OUT VOID *Destination,\r
107 IN UINT32 DestinationSize,\r
108 IN OUT VOID *Scratch,\r
109 IN UINT32 ScratchSize\r
110 );\r
111\r
112struct _EFI_DECOMPRESS_PROTOCOL {\r
113 EFI_DECOMPRESS_GET_INFO GetInfo;\r
114 EFI_DECOMPRESS_DECOMPRESS Decompress;\r
115};\r
116\r
117extern EFI_GUID gEfiDecompressProtocolGuid;\r
118\r
119#endif\r