]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueUefiDecompressLib.h
01a3bdf957ccbf63cc0d3e132407cf1a2816e42a
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Include / Library / EdkIIGlueUefiDecompressLib.h
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14
15 EdkIIGlueUefiDecompressLib.h
16
17 Abstract:
18
19 Public header file for UEFI Decompress Lib
20
21 --*/
22
23 #ifndef __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__
24 #define __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__
25
26 #define FillBuf(_SD, _NUMOFBITS) GlueFillBuf(_SD, _NUMOFBITS)
27 #define GetBits(_SD, _NUMOFBITS) GlueGetBits(_SD, _NUMOFBITS)
28 #define MakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE) GlueMakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE)
29 #define DecodeP(_SD) GlueDecodeP(_SD)
30 #define ReadPTLen( _SD, _NN, _NBIT, _SPECIAL) GlueReadPTLen( _SD, _NN, _NBIT, _SPECIAL)
31 #define ReadCLen(_SD) GlueReadCLen(_SD)
32 #define DecodeC(_SD) GlueDecodeC(_SD)
33 #define Decode(_SD) GlueDecode(_SD)
34
35
36
37 /**
38 Retrieves the size of the uncompressed buffer and the size of the scratch buffer.
39
40 Retrieves the size of the uncompressed buffer and the temporary scratch buffer
41 required to decompress the buffer specified by Source and SourceSize.
42 If the size of the uncompressed buffer or the size of the scratch buffer cannot
43 be determined from the compressed data specified by Source and SourceData,
44 then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
45 buffer is returned in DestinationSize, the size of the scratch buffer is returned
46 in ScratchSize, and RETURN_SUCCESS is returned.
47 This function does not have scratch buffer available to perform a thorough
48 checking of the validity of the source data. It just retrieves the "Original Size"
49 field from the beginning bytes of the source data and output it as DestinationSize.
50 And ScratchSize is specific to the decompression implementation.
51
52 If Source is NULL, then ASSERT().
53 If DestinationSize is NULL, then ASSERT().
54 If ScratchSize is NULL, then ASSERT().
55
56 @param Source The source buffer containing the compressed data.
57 @param SourceSize The size, in bytes, of the source buffer.
58 @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
59 that will be generated when the compressed buffer specified
60 by Source and SourceSize is decompressed..
61 @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
62 is required to decompress the compressed buffer specified
63 by Source and SourceSize.
64
65 @retval RETURN_SUCCESS The size of destination buffer and the size of scratch
66 buffer are successull retrieved.
67 @retval RETURN_INVALID_PARAMETER The source data is corrupted
68
69 **/
70 RETURN_STATUS
71 EFIAPI
72 UefiDecompressGetInfo (
73 IN CONST VOID *Source,
74 IN UINT32 SourceSize,
75 OUT UINT32 *DestinationSize,
76 OUT UINT32 *ScratchSize
77 );
78
79 /**
80 Decompresses a compressed source buffer.
81
82 This function is designed so that the decompression algorithm can be implemented
83 without using any memory services. As a result, this function is not allowed to
84 call any memory allocation services in its implementation. It is the caller's r
85 esponsibility to allocate and free the Destination and Scratch buffers.
86 If the compressed source data specified by Source is sucessfully decompressed
87 into Destination, then RETURN_SUCCESS is returned. If the compressed source data
88 specified by Source is not in a valid compressed data format,
89 then RETURN_INVALID_PARAMETER is returned.
90
91 If Source is NULL, then ASSERT().
92 If Destination is NULL, then ASSERT().
93 If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().
94
95 @param Source The source buffer containing the compressed data.
96 @param Destination The destination buffer to store the decompressed data
97 @param Scratch A temporary scratch buffer that is used to perform the decompression.
98 This is an optional parameter that may be NULL if the
99 required scratch buffer size is 0.
100
101 @retval RETURN_SUCCESS Decompression is successfull
102 @retval RETURN_INVALID_PARAMETER The source data is corrupted
103
104 **/
105 RETURN_STATUS
106 EFIAPI
107 UefiDecompress (
108 IN CONST VOID *Source,
109 IN OUT VOID *Destination,
110 IN OUT VOID *Scratch
111 );
112
113 #endif