878ddf1f |
1 | /*++\r |
2 | \r |
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 |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | DxeCoreCustomDecompressLibFromHob.c\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | Custom Decompress Library from HOBs \r |
19 | \r |
20 | --*/\r |
21 | \r |
22 | static DECOMPRESS_LIBRARY mCustomDecompress;\r |
23 | \r |
24 | EFI_STATUS\r |
25 | DxeCoreCustomDecompressLibConstructor (\r |
26 | IN EFI_HANDLE ImageHandle,\r |
27 | IN EFI_SYSTEM_TABLE *SystemTable\r |
28 | )\r |
29 | /*++\r |
30 | \r |
31 | Routine Description:\r |
32 | \r |
33 | Arguments:\r |
34 | \r |
35 | Returns:\r |
36 | \r |
37 | --*/\r |
38 | {\r |
39 | EFI_HOB_GUID_TYPE *GuidHob;\r |
40 | \r |
41 | GuidHob = GetFirstGuidHob (&gEfiCustomizedDecompressProtocolGuid);\r |
42 | ASSERT (GuidHob != NULL);\r |
43 | CopyMem (&mCustomDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mCustomDecompress)); \r |
44 | return EFI_SUCCESS;\r |
45 | }\r |
46 | \r |
47 | RETURN_STATUS\r |
48 | EFIAPI\r |
49 | CustomDecompressGetInfo (\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 |
57 | Routine Description:\r |
58 | \r |
59 | The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().\r |
60 | \r |
61 | Arguments:\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 |
68 | Returns:\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 mCustomDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r |
76 | }\r |
77 | \r |
78 | RETURN_STATUS\r |
79 | EFIAPI\r |
80 | CustomDecompress (\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 |
87 | Routine Description:\r |
88 | \r |
89 | The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().\r |
90 | \r |
91 | Arguments:\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 |
97 | Returns:\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 mCustomDecompress.Decompress (Source, Destination, Scratch);\r |
105 | }\r |