1. Fix EDKT413: EnumerationData.java should use defined final static string
[mirror_edk2.git] / EdkModulePkg / Library / DxeCoreUefiDecompressLibFromHob / DxeCoreUefiDecompressLibFromHob.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. 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 Module Name:
13
14 DxeCoreUefiDecompressLibFromHob.c
15
16 Abstract:
17
18 UEFI Decompress Library from HOBs
19
20 --*/
21
22 static DECOMPRESS_LIBRARY mEfiDecompress;
23
24 EFI_STATUS
25 EFIAPI
26 DxeCoreUefiDecompressLibConstructor (
27 IN EFI_HANDLE ImageHandle,
28 IN EFI_SYSTEM_TABLE *SystemTable
29 )
30 /*++
31
32 Routine Description:
33
34 Arguments:
35
36 Returns:
37
38 --*/
39 {
40 EFI_HOB_GUID_TYPE *GuidHob;
41
42 GuidHob = GetFirstGuidHob (&gEfiDecompressProtocolGuid);
43 ASSERT (GuidHob != NULL);
44 CopyMem (&mEfiDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mEfiDecompress));
45 return EFI_SUCCESS;
46 }
47
48 RETURN_STATUS
49 EFIAPI
50 UefiDecompressGetInfo (
51 IN CONST VOID *Source,
52 IN UINT32 SourceSize,
53 OUT UINT32 *DestinationSize,
54 OUT UINT32 *ScratchSize
55 )
56 /*++
57
58 Routine Description:
59
60 The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
61
62 Arguments:
63
64 Source - The source buffer containing the compressed data.
65 SourceSize - The size of source buffer
66 DestinationSize - The size of destination buffer.
67 ScratchSize - The size of scratch buffer.
68
69 Returns:
70
71 RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
72 RETURN_INVALID_PARAMETER - The source data is corrupted
73
74 --*/
75 {
76 return mEfiDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
77 }
78
79 RETURN_STATUS
80 EFIAPI
81 UefiDecompress (
82 IN CONST VOID *Source,
83 IN OUT VOID *Destination,
84 IN OUT VOID *Scratch
85 )
86 /*++
87
88 Routine Description:
89
90 The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
91
92 Arguments:
93
94 Source - The source buffer containing the compressed data.
95 Destination - The destination buffer to store the decompressed data
96 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
97
98 Returns:
99
100 RETURN_SUCCESS - Decompression is successfull
101 RETURN_INVALID_PARAMETER - The source data is corrupted
102
103 --*/
104 {
105 return mEfiDecompress.Decompress (Source, Destination, Scratch);
106 }