summaryrefslogtreecommitdiff
path: root/EmbeddedPkg
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-31 01:39:20 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-31 01:39:20 +0000
commitca3ad58bfa2284f0dc98ec904423e83874a90f52 (patch)
tree3364593eac0b30da55804c13a990e0b85842dfa7 /EmbeddedPkg
parent3370d33e8d95ecc964847e102d711abb09d8bcbe (diff)
downloadedk2-platforms-ca3ad58bfa2284f0dc98ec904423e83874a90f52.tar.xz
Updated to support passing PE/COFF and LZMA decompress up via HOBS. Currently turned off.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9887 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg')
-rwxr-xr-xEmbeddedPkg/Include/Guid/ExtractSection.h7
-rw-r--r--EmbeddedPkg/Include/Library/PrePiLib.h1
-rwxr-xr-xEmbeddedPkg/Include/Protocol/ExtractSection.h33
-rwxr-xr-xEmbeddedPkg/Include/Protocol/PeCoffLoader.h3
-rwxr-xr-xEmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c36
-rwxr-xr-xEmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf6
-rwxr-xr-xEmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c4
-rw-r--r--EmbeddedPkg/Library/PrePiLib/Hob.c20
8 files changed, 51 insertions, 59 deletions
diff --git a/EmbeddedPkg/Include/Guid/ExtractSection.h b/EmbeddedPkg/Include/Guid/ExtractSection.h
index 4dedb60b10..5d337d470c 100755
--- a/EmbeddedPkg/Include/Guid/ExtractSection.h
+++ b/EmbeddedPkg/Include/Guid/ExtractSection.h
@@ -22,11 +22,14 @@
// The GUID for this protocol mathes the Decompression scheme being used
// So for example LZMA would be gLzmaCustomDecompressGuid
//
-
typedef struct {
- EFI_HOB_GUID_TYPE Hob;
EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo;
EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction;
+} EXTRACT_SECTION_DATA;
+
+typedef struct {
+ EFI_HOB_GUID_TYPE Hob;
+ EXTRACT_SECTION_DATA Data;
} EXTRACT_SECTION_HOB;
#endif
diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h b/EmbeddedPkg/Include/Library/PrePiLib.h
index 3e4e6c023d..647cd0cb7e 100644
--- a/EmbeddedPkg/Include/Library/PrePiLib.h
+++ b/EmbeddedPkg/Include/Library/PrePiLib.h
@@ -678,6 +678,7 @@ BuildExtractSectionHob (
VOID
EFIAPI
BuildPeCoffLoaderHob (
+ VOID
);
diff --git a/EmbeddedPkg/Include/Protocol/ExtractSection.h b/EmbeddedPkg/Include/Protocol/ExtractSection.h
deleted file mode 100755
index 2860472be5..0000000000
--- a/EmbeddedPkg/Include/Protocol/ExtractSection.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
-
- Copyright (c) 2008-2009 Apple Inc. All rights reserved.<BR>
-
- All rights reserved. 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EXTRACT_SECTION_PROTOCOL_H__
-#define __EXTRACT_SECTION_PROTOCOL_H__
-
-
-//
-// The GUID for this protocol mathes the Decompression scheme being used
-// So for example LZMA would be gLzmaCustomDecompressGuid
-//
-
-typedef struct {
- EFI_HOB_GUID_TYPE Hob;
- EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo;
- EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction;
-} PROTOCOL_HOB;
-
-
-#endif
-
-
diff --git a/EmbeddedPkg/Include/Protocol/PeCoffLoader.h b/EmbeddedPkg/Include/Protocol/PeCoffLoader.h
index d6b4c03bd8..aa600122ed 100755
--- a/EmbeddedPkg/Include/Protocol/PeCoffLoader.h
+++ b/EmbeddedPkg/Include/Protocol/PeCoffLoader.h
@@ -15,6 +15,9 @@
#ifndef __PE_COFF_LOADER_H__
#define __PE_COFF_LOADER_H__
+// Needed for PE_COFF_LOADER_IMAGE_CONTEXT
+#include <Library/PeCoffLib.h>
+
// B323179B-97FB-477E-B0FE-D88591FA11AB
#define PE_COFF_LOADER_PROTOCOL_GUID \
{ 0xB323179B, 0x97FB, 0x477E, { 0xB0, 0xFE, 0xD8, 0x85, 0x91, 0xFA, 0x11, 0xAB } }
diff --git a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c b/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c
index 68bc2bf224..fdd2003264 100755
--- a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c
+++ b/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c
@@ -21,6 +21,9 @@
#include <Protocol/PeCoffLoader.h>
+PE_COFF_LOADER_PROTOCOL *gPeCoffLoader = NULL;
+
+
/**
Retrieves information about a PE/COFF image.
@@ -167,11 +170,11 @@ PeCoffLoaderImageReadFromMemory (
OUT VOID *Buffer
)
{
- return gPeCoffLoader->RelocateImageForRuntime (
- *FileHandle,
+ return gPeCoffLoader->ReadFromMemory (
+ FileHandle,
FileOffset,
- *ReadSize,
- *Buffer
+ ReadSize,
+ Buffer
);
}
@@ -214,7 +217,7 @@ PeCoffLoaderRelocateImageForRuntime (
ImageBase,
VirtImageBase,
ImageSize,
- *RelocationData
+ RelocationData
);
}
@@ -244,27 +247,42 @@ PeCoffLoaderUnloadImage (
return gPeCoffLoader->UnloadImage (ImageContext);
}
+typedef struct {
+ EFI_HOB_GUID_TYPE Hob;
+ VOID *Interface;
+} PROTOCOL_HOB;
/**
- Register LzmaDecompress and LzmaDecompressGetInfo handlers with LzmaCustomerDecompressGuid.
+ The constructor function caches the pointer of DXE Services Table.
+
+ The constructor function caches the pointer of DXE Services Table.
+ It will ASSERT() if that operation fails.
+ It will ASSERT() if the pointer of DXE Services Table is NULL.
+ It will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
- @retval RETURN_SUCCESS Register successfully.
- @retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.
**/
EFI_STATUS
EFIAPI
DxeHobPeCoffLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
PROTOCOL_HOB *Hob;
-
+
Hob = GetFirstGuidHob (&gPeCoffLoaderProtocolGuid);
if (Hob == NULL) {
return EFI_NOT_FOUND;
}
gPeCoffLoader = Hob->Interface;
+ return EFI_SUCCESS;
}
diff --git a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf b/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
index 576af471bb..59f0f7fb90 100755
--- a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
+++ b/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
@@ -16,7 +16,7 @@
[Defines]
INF_VERSION = 0x00010005
- BASE_NAME = BasePeCoffLib
+ BASE_NAME = DxeHobPeCoffLib
FILE_GUID = 671C6FD7-99FB-4EE3-B640-4B1D463BC3B5
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
@@ -34,7 +34,11 @@
[Packages]
MdePkg/MdePkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
DebugLib
+ HobLib
+[Protocols]
+ gPeCoffLoaderProtocolGuid
diff --git a/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c b/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c
index fe5fd83836..82e7654ff2 100755
--- a/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c
+++ b/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c
@@ -44,7 +44,7 @@ LzmaDecompressLibConstructor (
return ExtractGuidedSectionRegisterHandlers (
&gLzmaCustomDecompressGuid,
- Hob->SectionGetInfo,
- Hob->SectionExtraction
+ Hob->Data.SectionGetInfo,
+ Hob->Data.SectionExtraction
);
}
diff --git a/EmbeddedPkg/Library/PrePiLib/Hob.c b/EmbeddedPkg/Library/PrePiLib/Hob.c
index 04b49bb044..d055314915 100644
--- a/EmbeddedPkg/Library/PrePiLib/Hob.c
+++ b/EmbeddedPkg/Library/PrePiLib/Hob.c
@@ -818,11 +818,11 @@ BuildExtractSectionHob (
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction
)
{
- EXTRACT_SECTION_HOB Hob;
+ EXTRACT_SECTION_DATA Data;
- Hob.SectionGetInfo = SectionGetInfo;
- Hob.SectionExtraction = SectionExtraction;
- BuildGuidDataHob (Guid, &Hob, sizeof (EXTRACT_SECTION_HOB));
+ Data.SectionGetInfo = SectionGetInfo;
+ Data.SectionExtraction = SectionExtraction;
+ BuildGuidDataHob (Guid, &Data, sizeof (Data));
}
PE_COFF_LOADER_PROTOCOL gPeCoffProtocol = {
@@ -834,22 +834,18 @@ PE_COFF_LOADER_PROTOCOL gPeCoffProtocol = {
PeCoffLoaderUnloadImage
};
-typedef struct {
- EFI_HOB_GUID_TYPE Hob;
- VOID *Interface;
-} PROTOCOL_HOB;
-
VOID
EFIAPI
BuildPeCoffLoaderHob (
+ VOID
)
{
- PROTOCOL_HOB Hob;
+ VOID *Ptr;
- Hob.Interface = &gPeCoffProtocol;
- BuildGuidDataHob (&gPeCoffLoaderProtocolGuid, &Hob, sizeof (PROTOCOL_HOB));
+ Ptr = &gPeCoffProtocol;
+ BuildGuidDataHob (&gPeCoffLoaderProtocolGuid, &Ptr, sizeof (VOID *));
}