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