summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 08:45:50 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 08:45:50 +0000
commit30f001ca5f08974c8d5a5483f8b8e1a4f46a1025 (patch)
treed62379284334ffba61bd2a83d80b08cc4b2c6a94 /MdePkg
parent59d88f42ca8b2d1556e52930a164f908814b9b9e (diff)
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 'MdePkg')
-rw-r--r--MdePkg/Include/Pi/PiFirmwareFile.h17
-rw-r--r--MdePkg/Include/Pi/PiFirmwareVolume.h3
-rw-r--r--MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c20
-rw-r--r--MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c20
-rw-r--r--MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c22
5 files changed, 70 insertions, 12 deletions
diff --git a/MdePkg/Include/Pi/PiFirmwareFile.h b/MdePkg/Include/Pi/PiFirmwareFile.h
index 1408df0930..3e020b4208 100644
--- a/MdePkg/Include/Pi/PiFirmwareFile.h
+++ b/MdePkg/Include/Pi/PiFirmwareFile.h
@@ -176,6 +176,15 @@ typedef struct {
UINT32 ExtendedSize;
} EFI_FFS_FILE_HEADER2;
+#define IS_FFS_FILE2(FfsFileHeaderPtr) \
+ (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE)
+
+#define FFS_FILE_SIZE(FfsFileHeaderPtr) \
+ ((UINT32) (*((UINT32 *) ((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Size) & 0x00ffffff))
+
+#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \
+ (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize)
+
typedef UINT8 EFI_SECTION_TYPE;
///
@@ -470,8 +479,14 @@ typedef struct {
CHAR16 VersionString[1];
} EFI_VERSION_SECTION2;
+#define IS_SECTION2(SectionHeaderPtr) \
+ ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff) == 0x00ffffff)
+
#define SECTION_SIZE(SectionHeaderPtr) \
- ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))
+ ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff))
+
+#define SECTION2_SIZE(SectionHeaderPtr) \
+ (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)
#pragma pack()
diff --git a/MdePkg/Include/Pi/PiFirmwareVolume.h b/MdePkg/Include/Pi/PiFirmwareVolume.h
index 1f622bb9ba..22905894a4 100644
--- a/MdePkg/Include/Pi/PiFirmwareVolume.h
+++ b/MdePkg/Include/Pi/PiFirmwareVolume.h
@@ -211,7 +211,8 @@ typedef struct {
#define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
///
-/// This extension header provides a mapping between a GUID and an OEM file type.
+/// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific
+/// GUID FormatType type which includes a length and a successive series of data bytes.
///
typedef struct {
///
diff --git a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
index 6a2cde5200..05e6a9e796 100644
--- a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
+++ b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
@@ -1,7 +1,7 @@
/** @file
Provide generic extract guided section functions.
- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 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
@@ -261,6 +261,7 @@ ExtractGuidedSectionGetInfo (
UINT32 Index;
RETURN_STATUS Status;
EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input paramter
@@ -278,11 +279,17 @@ ExtractGuidedSectionGetInfo (
return Status;
}
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
+
//
// Search the match registered GetInfo handler for the input guided section.
//
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
- if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to get information for the input section data.
//
@@ -348,6 +355,7 @@ ExtractGuidedSectionDecode (
UINT32 Index;
RETURN_STATUS Status;
EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -364,11 +372,17 @@ ExtractGuidedSectionDecode (
return Status;
}
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
+
//
// Search the match registered Extract handler for the input guided section.
//
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
- if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input guided section.
//
diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
index b8bb83c20e..609b329f62 100644
--- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
+++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
@@ -1,7 +1,7 @@
/** @file
Provide generic extract guided section functions for Dxe phase.
- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 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
@@ -259,17 +259,24 @@ ExtractGuidedSectionGetInfo (
)
{
UINT32 Index;
+ EFI_GUID *SectionDefinitionGuid;
ASSERT (InputSection != NULL);
ASSERT (OutputBufferSize != NULL);
ASSERT (ScratchBufferSize != NULL);
ASSERT (SectionAttribute != NULL);
+
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
//
// Search the match registered GetInfo handler for the input guided section.
//
for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
- if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
//
// Call the match handler to getinfo for the input section data.
//
@@ -333,6 +340,7 @@ ExtractGuidedSectionDecode (
)
{
UINT32 Index;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check the input parameters
@@ -341,11 +349,17 @@ ExtractGuidedSectionDecode (
ASSERT (OutputBuffer != NULL);
ASSERT (AuthenticationStatus != NULL);
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
+
//
// Search the match registered extract handler for the input guided section.
//
for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
- if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input section data.
//
diff --git a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
index fa382ae3c8..1fad3d0c47 100644
--- a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
+++ b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
@@ -1,7 +1,7 @@
/** @file
Provide generic extract guided section functions for PEI phase.
- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 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
@@ -290,6 +290,7 @@ ExtractGuidedSectionGetInfo (
UINT32 Index;
EFI_STATUS Status;
PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input paramter
@@ -306,12 +307,18 @@ ExtractGuidedSectionGetInfo (
if (EFI_ERROR (Status)) {
return Status;
}
-
+
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
+
//
// Search the match registered GetInfo handler for the input guided section.
//
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
- if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to get information for the input section data.
//
@@ -377,6 +384,7 @@ ExtractGuidedSectionDecode (
UINT32 Index;
EFI_STATUS Status;
PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -393,11 +401,17 @@ ExtractGuidedSectionDecode (
return Status;
}
+ if (IS_SECTION2 (InputSection)) {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ } else {
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ }
+
//
// Search the match registered Extract handler for the input guided section.
//
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
- if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input guided section.
//