]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@905 6f19259b...
[mirror_edk2.git] / EdkModulePkg / Library / DxeCoreUefiDecompressLibFromHob / DxeCoreUefiDecompressLibFromHob.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 DxeCoreUefiDecompressLibFromHob.c\r
15\r
16Abstract:\r
17\r
18 UEFI Decompress Library from HOBs \r
19\r
20--*/\r
21\r
22static DECOMPRESS_LIBRARY mEfiDecompress;\r
23\r
24EFI_STATUS\r
25DxeCoreUefiDecompressLibConstructor (\r
26 IN EFI_HANDLE ImageHandle,\r
27 IN EFI_SYSTEM_TABLE *SystemTable\r
28 )\r
29/*++\r
30\r
31Routine Description:\r
32\r
33Arguments:\r
34\r
35Returns:\r
36\r
37--*/\r
38{\r
39 EFI_HOB_GUID_TYPE *GuidHob;\r
40\r
41 GuidHob = GetFirstGuidHob (&gEfiDecompressProtocolGuid);\r
42 ASSERT (GuidHob != NULL);\r
43 CopyMem (&mEfiDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mEfiDecompress)); \r
44 return EFI_SUCCESS;\r
45}\r
46\r
47RETURN_STATUS\r
48EFIAPI\r
49UefiDecompressGetInfo (\r
50 IN CONST VOID *Source,\r
51 IN UINT32 SourceSize,\r
52 OUT UINT32 *DestinationSize,\r
53 OUT UINT32 *ScratchSize\r
54 )\r
55/*++\r
56\r
57Routine Description:\r
58\r
59 The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().\r
60\r
61Arguments:\r
62\r
63 Source - The source buffer containing the compressed data.\r
64 SourceSize - The size of source buffer\r
65 DestinationSize - The size of destination buffer.\r
66 ScratchSize - The size of scratch buffer.\r
67\r
68Returns:\r
69\r
70 RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
71 RETURN_INVALID_PARAMETER - The source data is corrupted\r
72\r
73--*/\r
74{\r
75 return mEfiDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
76}\r
77\r
78RETURN_STATUS\r
79EFIAPI\r
80UefiDecompress (\r
81 IN CONST VOID *Source,\r
82 IN OUT VOID *Destination,\r
83 IN OUT VOID *Scratch\r
84 )\r
85/*++\r
86\r
87Routine Description:\r
88\r
89 The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().\r
90\r
91Arguments:\r
92\r
93 Source - The source buffer containing the compressed data.\r
94 Destination - The destination buffer to store the decompressed data\r
95 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.\r
96\r
97Returns:\r
98\r
99 RETURN_SUCCESS - Decompression is successfull\r
100 RETURN_INVALID_PARAMETER - The source data is corrupted\r
101\r
102--*/\r
103{\r
104 return mEfiDecompress.Decompress (Source, Destination, Scratch);\r
105}\r