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