TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseUefiTianoCustomDecompressLib.c
Go to the documentation of this file.
1
10#include <PiPei.h>
13
47RETURN_STATUS
48EFIAPI
50 IN CONST VOID *InputSection,
51 OUT UINT32 *OutputBufferSize,
52 OUT UINT32 *ScratchBufferSize,
53 OUT UINT16 *SectionAttribute
54 )
55
56{
57 ASSERT (SectionAttribute != NULL);
58
59 if (InputSection == NULL) {
61 }
62
63 if (IS_SECTION2 (InputSection)) {
64 if (!CompareGuid (
65 &gTianoCustomDecompressGuid,
66 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
67 ))
68 {
70 }
71
72 //
73 // Get guid attribute of guid section.
74 //
75 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->Attributes;
76
77 //
78 // Call Tiano GetInfo to get the required size info.
79 //
81 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
82 SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
83 OutputBufferSize,
84 ScratchBufferSize
85 );
86 } else {
87 if (!CompareGuid (
88 &gTianoCustomDecompressGuid,
89 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
90 ))
91 {
93 }
94
95 //
96 // Get guid attribute of guid section.
97 //
98 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *)InputSection)->Attributes;
99
100 //
101 // Call Tiano GetInfo to get the required size info.
102 //
103 return UefiDecompressGetInfo (
104 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
105 SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
106 OutputBufferSize,
107 ScratchBufferSize
108 );
109 }
110}
111
145RETURN_STATUS
146EFIAPI
148 IN CONST VOID *InputSection,
149 OUT VOID **OutputBuffer,
150 IN VOID *ScratchBuffer OPTIONAL,
151 OUT UINT32 *AuthenticationStatus
152 )
153{
154 ASSERT (OutputBuffer != NULL);
155 ASSERT (InputSection != NULL);
156
157 if (IS_SECTION2 (InputSection)) {
158 if (!CompareGuid (
159 &gTianoCustomDecompressGuid,
160 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
161 ))
162 {
164 }
165
166 //
167 // Set Authentication to Zero.
168 //
169 *AuthenticationStatus = 0;
170
171 //
172 // Call Tiano Decompress to get the raw data
173 //
174 return UefiTianoDecompress (
175 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
176 *OutputBuffer,
177 ScratchBuffer,
178 2
179 );
180 } else {
181 if (!CompareGuid (
182 &gTianoCustomDecompressGuid,
183 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
184 ))
185 {
187 }
188
189 //
190 // Set Authentication to Zero.
191 //
192 *AuthenticationStatus = 0;
193
194 //
195 // Call Tiano Decompress to get the raw data
196 //
197 return UefiTianoDecompress (
198 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
199 *OutputBuffer,
200 ScratchBuffer,
201 2
202 );
203 }
204}
205
212RETURN_STATUS
213EFIAPI
215 VOID
216 )
217{
219 &gTianoCustomDecompressGuid,
222 );
223}
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
RETURN_STATUS UefiTianoDecompress(IN CONST VOID *Source, IN OUT VOID *Destination, IN OUT VOID *Scratch, IN UINT32 Version)
RETURN_STATUS EFIAPI TianoDecompressLibConstructor(VOID)
RETURN_STATUS EFIAPI TianoDecompressGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute)
RETURN_STATUS EFIAPI TianoDecompress(IN CONST VOID *InputSection, OUT VOID **OutputBuffer, IN VOID *ScratchBuffer OPTIONAL, OUT UINT32 *AuthenticationStatus)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
#define SECTION_SIZE(SectionHeaderPtr)
RETURN_STATUS EFIAPI ExtractGuidedSectionRegisterHandlers(IN CONST GUID *SectionGuid, IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler)
RETURN_STATUS EFIAPI UefiDecompressGetInfo(IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, OUT UINT32 *ScratchSize)