]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompressLibInternal.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Library / LzmaCustomDecompressLib / LzmaDecompressLibInternal.h
CommitLineData
11ff2c71
LG
1/** @file\r
2 LZMA Decompress Library internal header file declares Lzma decompress interfaces.\r
3\r
d1102dba 4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
11ff2c71
LG
6\r
7**/\r
8\r
9#ifndef __LZMADECOMPRESSLIB_INTERNAL_H__\r
10#define __LZMADECOMPRESSLIB_INTERNAL_H__\r
11\r
e7bd0dd2 12#include <Base.h>\r
11ff2c71
LG
13#include <PiPei.h>\r
14#include <Library/BaseLib.h>\r
15#include <Library/BaseMemoryLib.h>\r
16#include <Library/DebugLib.h>\r
17#include <Library/ExtractGuidedSectionLib.h>\r
18#include <Guid/LzmaDecompress.h>\r
19\r
20/**\r
d1102dba
LG
21 Given a Lzma compressed source buffer, this function retrieves the size of\r
22 the uncompressed buffer and the size of the scratch buffer required\r
11ff2c71
LG
23 to decompress the compressed source buffer.\r
24\r
d1102dba 25 Retrieves the size of the uncompressed buffer and the temporary scratch buffer\r
11ff2c71 26 required to decompress the buffer specified by Source and SourceSize.\r
d1102dba 27 The size of the uncompressed buffer is returned in DestinationSize,\r
11ff2c71 28 the size of the scratch buffer is returned in ScratchSize, and RETURN_SUCCESS is returned.\r
d1102dba 29 This function does not have scratch buffer available to perform a thorough\r
11ff2c71
LG
30 checking of the validity of the source data. It just retrieves the "Original Size"\r
31 field from the LZMA_HEADER_SIZE beginning bytes of the source data and output it as DestinationSize.\r
32 And ScratchSize is specific to the decompression implementation.\r
33\r
34 If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT().\r
35\r
36 @param Source The source buffer containing the compressed data.\r
37 @param SourceSize The size, in bytes, of the source buffer.\r
38 @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r
39 that will be generated when the compressed buffer specified\r
40 by Source and SourceSize is decompressed.\r
41 @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that\r
d1102dba 42 is required to decompress the compressed buffer specified\r
11ff2c71
LG
43 by Source and SourceSize.\r
44\r
d1102dba
LG
45 @retval RETURN_SUCCESS The size of the uncompressed data was returned\r
46 in DestinationSize and the size of the scratch\r
11ff2c71
LG
47 buffer was returned in ScratchSize.\r
48\r
e7bd0dd2
LE
49 @retval RETURN_UNSUPPORTED DestinationSize cannot be output because the\r
50 uncompressed buffer size (in bytes) does not fit\r
51 in a UINT32. Output parameters have not been\r
52 modified.\r
11ff2c71
LG
53**/\r
54RETURN_STATUS\r
55EFIAPI\r
56LzmaUefiDecompressGetInfo (\r
57 IN CONST VOID *Source,\r
58 IN UINT32 SourceSize,\r
59 OUT UINT32 *DestinationSize,\r
60 OUT UINT32 *ScratchSize\r
61 );\r
62\r
63/**\r
64 Decompresses a Lzma compressed source buffer.\r
65\r
66 Extracts decompressed data to its original form.\r
d1102dba
LG
67 If the compressed source data specified by Source is successfully decompressed\r
68 into Destination, then RETURN_SUCCESS is returned. If the compressed source data\r
11ff2c71
LG
69 specified by Source is not in a valid compressed data format,\r
70 then RETURN_INVALID_PARAMETER is returned.\r
71\r
72 @param Source The source buffer containing the compressed data.\r
73 @param SourceSize The size of source buffer.\r
74 @param Destination The destination buffer to store the decompressed data\r
75 @param Scratch A temporary scratch buffer that is used to perform the decompression.\r
d1102dba 76 This is an optional parameter that may be NULL if the\r
11ff2c71 77 required scratch buffer size is 0.\r
d1102dba
LG
78\r
79 @retval RETURN_SUCCESS Decompression completed successfully, and\r
11ff2c71 80 the uncompressed buffer is returned in Destination.\r
d1102dba
LG
81 @retval RETURN_INVALID_PARAMETER\r
82 The source buffer specified by Source is corrupted\r
11ff2c71
LG
83 (not in a valid compressed format).\r
84**/\r
85RETURN_STATUS\r
86EFIAPI\r
87LzmaUefiDecompress (\r
88 IN CONST VOID *Source,\r
89 IN UINTN SourceSize,\r
90 IN OUT VOID *Destination,\r
91 IN OUT VOID *Scratch\r
92 );\r
93\r
94#endif\r