]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | CustomizedDecompress.h\r | |
14 | \r | |
15 | Abstract:\r | |
16 | The user Customized Decompress Protocol Interface\r | |
17 | \r | |
18 | --*/\r | |
19 | \r | |
20 | #ifndef __CUSTOMIZED_DECOMPRESS_H__\r | |
21 | #define __CUSTOMIZED_DECOMPRESS_H__\r | |
22 | \r | |
23 | #define EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL_GUID \\r | |
24 | { 0x9a44198e, 0xa4a2, 0x44e6, {0x8a, 0x1f, 0x39, 0xbe, 0xfd, 0xac, 0x89, 0x6f } }\r | |
25 | \r | |
26 | typedef struct _EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL;\r | |
27 | \r | |
28 | typedef\r | |
29 | EFI_STATUS\r | |
30 | (EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_GET_INFO) (\r | |
31 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
32 | IN VOID *Source,\r | |
33 | IN UINT32 SourceSize,\r | |
34 | OUT UINT32 *DestinationSize,\r | |
35 | OUT UINT32 *ScratchSize\r | |
36 | );\r | |
37 | /*++\r | |
38 | \r | |
39 | Routine Description:\r | |
40 | \r | |
41 | The GetInfo() function retrieves the size of the uncompressed buffer \r | |
42 | and the temporary scratch buffer required to decompress the buffer \r | |
43 | specified by Source and SourceSize. If the size of the uncompressed\r | |
44 | buffer or the size of the scratch buffer cannot be determined from \r | |
45 | the compressed data specified by Source and SourceData, then \r | |
46 | EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed\r | |
47 | buffer is returned in DestinationSize, the size of the scratch buffer is \r | |
48 | returned in ScratchSize, and EFI_SUCCESS is returned.\r | |
49 | \r | |
50 | The GetInfo() function does not have scratch buffer available to perform \r | |
51 | a thorough checking of the validity of the source data. It just retrieves\r | |
52 | the 'Original Size' field from the beginning bytes of the source data and\r | |
53 | output it as DestinationSize. And ScratchSize is specific to the decompression\r | |
54 | implementation.\r | |
55 | \r | |
56 | Arguments:\r | |
57 | \r | |
58 | This - The protocol instance pointer\r | |
59 | Source - The source buffer containing the compressed data.\r | |
60 | SourceSize - The size, in bytes, of source buffer.\r | |
61 | DestinationSize - A pointer to the size, in bytes, of the uncompressed buffer\r | |
62 | that will be generated when the compressed buffer specified \r | |
63 | by Source and SourceSize is decompressed.\r | |
64 | ScratchSize - A pointer to the size, in bytes, of the scratch buffer that \r | |
65 | is required to decompress the compressed buffer specified by\r | |
66 | Source and SourceSize.\r | |
67 | \r | |
68 | Returns:\r | |
69 | EFI_SUCCESS - The size of the uncompressed data was returned in DestinationSize\r | |
70 | and the size of the scratch buffer was returned in ScratchSize.\r | |
71 | EFI_INVALID_PARAMETER - The size of the uncompressed data or the size of the scratch\r | |
72 | buffer cannot be determined from the compressed data specified by \r | |
73 | Source and SourceData.\r | |
74 | \r | |
75 | --*/\r | |
76 | \r | |
77 | \r | |
78 | typedef\r | |
79 | EFI_STATUS\r | |
80 | (EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS) (\r | |
81 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
82 | IN VOID* Source,\r | |
83 | IN UINT32 SourceSize,\r | |
84 | IN OUT VOID* Destination,\r | |
85 | IN UINT32 DestinationSize,\r | |
86 | IN OUT VOID* Scratch,\r | |
87 | IN UINT32 ScratchSize\r | |
88 | );\r | |
89 | /*++\r | |
90 | \r | |
91 | Routine Description:\r | |
92 | \r | |
93 | The Decompress() function extracts decompressed data to its original form.\r | |
94 | \r | |
95 | This protocol is designed so that the decompression algorithm can be \r | |
96 | implemented without using any memory services. As a result, the \r | |
97 | Decompress() function is not allowed to call AllocatePool() or \r | |
98 | AllocatePages() in its implementation. It is the caller's responsibility \r | |
99 | to allocate and free the Destination and Scratch buffers.\r | |
100 | \r | |
101 | If the compressed source data specified by Source and SourceSize is \r | |
102 | sucessfully decompressed into Destination, then EFI_SUCCESS is returned. \r | |
103 | If the compressed source data specified by Source and SourceSize is not in \r | |
104 | a valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r | |
105 | \r | |
106 | Arguments:\r | |
107 | \r | |
108 | This - The protocol instance pointer\r | |
109 | Source - The source buffer containing the compressed data.\r | |
110 | SourceSize - The size of source data.\r | |
111 | Destination - On output, the destination buffer that contains \r | |
112 | the uncompressed data.\r | |
113 | DestinationSize - The size of destination buffer. The size of destination\r | |
114 | buffer needed is obtained from GetInfo().\r | |
115 | Scratch - A temporary scratch buffer that is used to perform the \r | |
116 | decompression.\r | |
117 | ScratchSize - The size of scratch buffer. The size of scratch buffer needed\r | |
118 | is obtained from GetInfo().\r | |
119 | \r | |
120 | Returns:\r | |
121 | \r | |
122 | EFI_SUCCESS - Decompression completed successfully, and the uncompressed \r | |
123 | buffer is returned in Destination.\r | |
124 | EFI_INVALID_PARAMETER \r | |
125 | - The source buffer specified by Source and SourceSize is \r | |
126 | corrupted (not in a valid compressed format).\r | |
127 | \r | |
128 | --*/\r | |
129 | \r | |
130 | struct _EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL {\r | |
131 | EFI_CUSTOMIZED_DECOMPRESS_GET_INFO GetInfo;\r | |
132 | EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS Decompress;\r | |
133 | };\r | |
134 | \r | |
135 | extern EFI_GUID gEfiCustomizedDecompressProtocolGuid;\r | |
136 | \r | |
137 | #endif\r |