diff options
author | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-27 08:45:50 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-27 08:45:50 +0000 |
commit | 30f001ca5f08974c8d5a5483f8b8e1a4f46a1025 (patch) | |
tree | d62379284334ffba61bd2a83d80b08cc4b2c6a94 /IntelFrameworkModulePkg | |
parent | 59d88f42ca8b2d1556e52930a164f908814b9b9e (diff) | |
download | edk2-platforms-30f001ca5f08974c8d5a5483f8b8e1a4f46a1025.tar.xz |
Add core FFS3 support, ExtractGuidedSectionLib/GuidedSectionExtractionLib/PiFirmwareFile.h.
Signed-off-by: lzeng14
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12582 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
2 files changed, 147 insertions, 65 deletions
diff --git a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c index fb60d029a8..bcc9764100 100644 --- a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c +++ b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c @@ -1,8 +1,8 @@ /** @file
UEFI and Tiano Custom Decompress Library
- Tt will do Tiano or UEFI decompress with different verison parameter.
+ It will do Tiano or UEFI decompress with different verison parameter.
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -897,25 +897,47 @@ TianoDecompressGetInfo ( return RETURN_INVALID_PARAMETER;
}
- if (!CompareGuid (
- &gTianoCustomDecompressGuid,
+ if (IS_SECTION2 (InputSection)) {
+ if (!CompareGuid (
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ return RETURN_INVALID_PARAMETER;
+ }
+ //
+ // Get guid attribute of guid section.
+ //
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;
+
+ //
+ // Call Tiano GetInfo to get the required size info.
+ //
+ return UefiDecompressGetInfo (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ OutputBufferSize,
+ ScratchBufferSize
+ );
+ } else {
+ if (!CompareGuid (
+ &gTianoCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- return RETURN_INVALID_PARAMETER;
- }
- //
- // Get guid attribute of guid section.
- //
- *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
+ return RETURN_INVALID_PARAMETER;
+ }
+ //
+ // Get guid attribute of guid section.
+ //
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
- //
- // Call Tiano GetInfo to get the required size info.
- //
- return UefiDecompressGetInfo (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- (*(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- OutputBufferSize,
- ScratchBufferSize
- );
+ //
+ // Call Tiano GetInfo to get the required size info.
+ //
+ return UefiDecompressGetInfo (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ OutputBufferSize,
+ ScratchBufferSize
+ );
+ }
}
/**
@@ -963,26 +985,49 @@ TianoDecompress ( ASSERT (OutputBuffer != NULL);
ASSERT (InputSection != NULL);
- if (!CompareGuid (
- &gTianoCustomDecompressGuid,
+ if (IS_SECTION2 (InputSection)) {
+ if (!CompareGuid (
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ //
+ // Set Authentication to Zero.
+ //
+ *AuthenticationStatus = 0;
+
+ //
+ // Call Tiano Decompress to get the raw data
+ //
+ return UefiTianoDecompress (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ *OutputBuffer,
+ ScratchBuffer,
+ 2
+ );
+ } else {
+ if (!CompareGuid (
+ &gTianoCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- return RETURN_INVALID_PARAMETER;
- }
+ return RETURN_INVALID_PARAMETER;
+ }
- //
- // Set Authentication to Zero.
- //
- *AuthenticationStatus = 0;
-
- //
- // Call Tiano Decompress to get the raw data
- //
- return UefiTianoDecompress (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- *OutputBuffer,
- ScratchBuffer,
- 2
- );
+ //
+ // Set Authentication to Zero.
+ //
+ *AuthenticationStatus = 0;
+
+ //
+ // Call Tiano Decompress to get the raw data
+ //
+ return UefiTianoDecompress (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ *OutputBuffer,
+ ScratchBuffer,
+ 2
+ );
+ }
}
/**
@@ -1000,5 +1045,5 @@ TianoDecompressLibConstructor ( &gTianoCustomDecompressGuid,
TianoDecompressGetInfo,
TianoDecompress
- );
+ );
}
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c index 0f8b3f755f..f19e0d28cd 100644 --- a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c +++ b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c @@ -3,7 +3,7 @@ It wraps Lzma decompress interfaces to GUIDed Section Extraction interfaces
and registers them into GUIDed handler table.
- Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -63,20 +63,37 @@ LzmaGuidedSectionGetInfo ( ASSERT (ScratchBufferSize != NULL);
ASSERT (SectionAttribute != NULL);
- if (!CompareGuid (
- &gLzmaCustomDecompressGuid,
+ if (IS_SECTION2 (InputSection)) {
+ if (!CompareGuid (
+ &gLzmaCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;
+
+ return LzmaUefiDecompressGetInfo (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ OutputBufferSize,
+ ScratchBufferSize
+ );
+ } else {
+ if (!CompareGuid (
+ &gLzmaCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- return RETURN_INVALID_PARAMETER;
- }
+ return RETURN_INVALID_PARAMETER;
+ }
- *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
- return LzmaUefiDecompressGetInfo (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- OutputBufferSize,
- ScratchBufferSize
- );
+ return LzmaUefiDecompressGetInfo (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ OutputBufferSize,
+ ScratchBufferSize
+ );
+ }
}
/**
@@ -124,23 +141,43 @@ LzmaGuidedSectionExtraction ( ASSERT (OutputBuffer != NULL);
ASSERT (InputSection != NULL);
- if (!CompareGuid (
- &gLzmaCustomDecompressGuid,
+ if (IS_SECTION2 (InputSection)) {
+ if (!CompareGuid (
+ &gLzmaCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ //
+ // Authentication is set to Zero, which may be ignored.
+ //
+ *AuthenticationStatus = 0;
+
+ return LzmaUefiDecompress (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ *OutputBuffer,
+ ScratchBuffer
+ );
+ } else {
+ if (!CompareGuid (
+ &gLzmaCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- return RETURN_INVALID_PARAMETER;
- }
-
- //
- // Authentication is set to Zero, which may be ignored.
- //
- *AuthenticationStatus = 0;
-
- return LzmaUefiDecompress (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- *OutputBuffer,
- ScratchBuffer
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ //
+ // Authentication is set to Zero, which may be ignored.
+ //
+ *AuthenticationStatus = 0;
+
+ return LzmaUefiDecompress (
+ (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ *OutputBuffer,
+ ScratchBuffer
);
+ }
}
|