]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c
Change UINAME to CName of GUID/PPI/Protocol in all Msa file and change tool to suppo...
[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 DxeCoreUefiDecompressLibConstructor (
26 IN EFI_HANDLE ImageHandle,
27 IN EFI_SYSTEM_TABLE *SystemTable
28 )
29 /*++
30
31 Routine Description:
32
33 Arguments:
34
35 Returns:
36
37 --*/
38 {
39 EFI_HOB_GUID_TYPE *GuidHob;
40
41 GuidHob = GetFirstGuidHob (&gEfiDecompressProtocolGuid);
42 ASSERT (GuidHob != NULL);
43 CopyMem (&mEfiDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mEfiDecompress));
44 return EFI_SUCCESS;
45 }
46
47 RETURN_STATUS
48 EFIAPI
49 UefiDecompressGetInfo (
50 IN CONST VOID *Source,
51 IN UINT32 SourceSize,
52 OUT UINT32 *DestinationSize,
53 OUT UINT32 *ScratchSize
54 )
55 /*++
56
57 Routine Description:
58
59 The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
60
61 Arguments:
62
63 Source - The source buffer containing the compressed data.
64 SourceSize - The size of source buffer
65 DestinationSize - The size of destination buffer.
66 ScratchSize - The size of scratch buffer.
67
68 Returns:
69
70 RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
71 RETURN_INVALID_PARAMETER - The source data is corrupted
72
73 --*/
74 {
75 return mEfiDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
76 }
77
78 RETURN_STATUS
79 EFIAPI
80 UefiDecompress (
81 IN CONST VOID *Source,
82 IN OUT VOID *Destination,
83 IN OUT VOID *Scratch
84 )
85 /*++
86
87 Routine Description:
88
89 The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
90
91 Arguments:
92
93 Source - The source buffer containing the compressed data.
94 Destination - The destination buffer to store the decompressed data
95 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
96
97 Returns:
98
99 RETURN_SUCCESS - Decompression is successfull
100 RETURN_INVALID_PARAMETER - The source data is corrupted
101
102 --*/
103 {
104 return mEfiDecompress.Decompress (Source, Destination, Scratch);
105 }