summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/DxeIplPeim
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 09:04:50 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 09:04:50 +0000
commit890e54170e8f85d1357ac3614f7ad1465050ff0c (patch)
treeb4ad74dcc1688119a78816b95c46bca31be923b5 /MdeModulePkg/Core/DxeIplPeim
parent30f001ca5f08974c8d5a5483f8b8e1a4f46a1025 (diff)
downloadedk2-platforms-890e54170e8f85d1357ac3614f7ad1465050ff0c.tar.xz
Add core FFS3 support, PeiCore and DxeIpl.
Signed-off-by: lzeng14 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12583 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/DxeIplPeim')
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeLoad.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index e6836596d8..d0baf2eb91 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -515,21 +515,32 @@ Decompress (
UINT8 *ScratchBuffer;
UINT32 DstBufferSize;
UINT32 ScratchBufferSize;
- EFI_COMMON_SECTION_HEADER *Section;
- UINT32 SectionLength;
+ VOID *CompressionSource;
+ UINT32 CompressionSourceSize;
+ UINT32 UncompressedLength;
+ UINT8 CompressionType;
if (CompressionSection->CommonHeader.Type != EFI_SECTION_COMPRESSION) {
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
}
- Section = (EFI_COMMON_SECTION_HEADER *) CompressionSection;
- SectionLength = *(UINT32 *) (Section->Size) & 0x00ffffff;
+ if (IS_SECTION2 (CompressionSection)) {
+ CompressionSource = (VOID *) ((UINT8 *) CompressionSection + sizeof (EFI_COMPRESSION_SECTION2));
+ CompressionSourceSize = (UINT32) (SECTION2_SIZE (CompressionSection) - sizeof (EFI_COMPRESSION_SECTION2));
+ UncompressedLength = ((EFI_COMPRESSION_SECTION2 *) CompressionSection)->UncompressedLength;
+ CompressionType = ((EFI_COMPRESSION_SECTION2 *) CompressionSection)->CompressionType;
+ } else {
+ CompressionSource = (VOID *) ((UINT8 *) CompressionSection + sizeof (EFI_COMPRESSION_SECTION));
+ CompressionSourceSize = (UINT32) (SECTION_SIZE (CompressionSection) - sizeof (EFI_COMPRESSION_SECTION));
+ UncompressedLength = CompressionSection->UncompressedLength;
+ CompressionType = CompressionSection->CompressionType;
+ }
//
// This is a compression set, expand it
//
- switch (CompressionSection->CompressionType) {
+ switch (CompressionType) {
case EFI_STANDARD_COMPRESSION:
if (FeaturePcdGet(PcdDxeIplSupportUefiDecompress)) {
//
@@ -537,8 +548,8 @@ Decompress (
// For compressed data, decompress them to destination buffer.
//
Status = UefiDecompressGetInfo (
- (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
- SectionLength - sizeof (EFI_COMPRESSION_SECTION),
+ CompressionSource,
+ CompressionSourceSize,
&DstBufferSize,
&ScratchBufferSize
);
@@ -572,7 +583,7 @@ Decompress (
// Call decompress function
//
Status = UefiDecompress (
- (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
+ CompressionSource,
DstBuffer,
ScratchBuffer
);
@@ -597,7 +608,7 @@ Decompress (
//
// Allocate destination buffer
//
- DstBufferSize = CompressionSection->UncompressedLength;
+ DstBufferSize = UncompressedLength;
DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
if (DstBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -610,7 +621,7 @@ Decompress (
//
// stream is not actually compressed, just encapsulated. So just copy it.
//
- CopyMem (DstBuffer, CompressionSection + 1, DstBufferSize);
+ CopyMem (DstBuffer, CompressionSource, DstBufferSize);
break;
default: