]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add core FFS3 support, ExtractGuidedSectionLib/GuidedSectionExtractionLib/PiFirmwareF...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 27 Oct 2011 08:45:50 +0000 (08:45 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 27 Oct 2011 08:45:50 +0000 (08:45 +0000)
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

IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
MdePkg/Include/Pi/PiFirmwareFile.h
MdePkg/Include/Pi/PiFirmwareVolume.h
MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c

index fb60d029a8c4447c0e6b40241de0fb02047e97b7..bcc9764100ba1857d9b17e9b8251a9dbe95f6150 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   UEFI and Tiano Custom Decompress Library \r
-  Tt will do Tiano or UEFI decompress with different verison parameter.\r
+  It will do Tiano or UEFI decompress with different verison parameter.\r
   \r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -897,25 +897,47 @@ TianoDecompressGetInfo (
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
-  if (!CompareGuid (\r
-        &gTianoCustomDecompressGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+    //\r
+    // Get guid attribute of guid section. \r
+    //\r
+    *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;\r
+\r
+    //\r
+    // Call Tiano GetInfo to get the required size info.\r
+    //\r
+    return UefiDecompressGetInfo (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             OutputBufferSize,\r
+             ScratchBufferSize\r
+             );\r
+  } else {\r
+    if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
-  //\r
-  // Get guid attribute of guid section. \r
-  //\r
-  *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+    //\r
+    // Get guid attribute of guid section. \r
+    //\r
+    *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
 \r
-  //\r
-  // Call Tiano GetInfo to get the required size info.\r
-  //\r
-  return UefiDecompressGetInfo (\r
-          (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-          (*(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-          OutputBufferSize,\r
-          ScratchBufferSize\r
-         );\r
+    //\r
+    // Call Tiano GetInfo to get the required size info.\r
+    //\r
+    return UefiDecompressGetInfo (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             OutputBufferSize,\r
+             ScratchBufferSize\r
+             );\r
+  }\r
 }\r
 \r
 /**\r
@@ -963,26 +985,49 @@ TianoDecompress (
   ASSERT (OutputBuffer != NULL);\r
   ASSERT (InputSection != NULL);\r
 \r
-  if (!CompareGuid (\r
-        &gTianoCustomDecompressGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+\r
+    //\r
+    // Set Authentication to Zero.\r
+    //\r
+    *AuthenticationStatus = 0;\r
+\r
+    //\r
+    // Call Tiano Decompress to get the raw data\r
+    //\r
+    return UefiTianoDecompress (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             *OutputBuffer,\r
+             ScratchBuffer,\r
+             2\r
+           );\r
+  } else {\r
+    if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
 \r
-  //\r
-  // Set Authentication to Zero.\r
-  //\r
-  *AuthenticationStatus = 0;\r
-  \r
-  //\r
-  // Call Tiano Decompress to get the raw data\r
-  //\r
-  return UefiTianoDecompress (\r
-          (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-          *OutputBuffer,\r
-          ScratchBuffer,\r
-          2\r
-         );\r
+    //\r
+    // Set Authentication to Zero.\r
+    //\r
+    *AuthenticationStatus = 0;\r
+\r
+    //\r
+    // Call Tiano Decompress to get the raw data\r
+    //\r
+    return UefiTianoDecompress (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             *OutputBuffer,\r
+             ScratchBuffer,\r
+             2\r
+           );\r
+  }\r
 }\r
 \r
 /**\r
@@ -1000,5 +1045,5 @@ TianoDecompressLibConstructor (
           &gTianoCustomDecompressGuid,\r
           TianoDecompressGetInfo,\r
           TianoDecompress\r
-          );      \r
+          );\r
 }\r
index 0f8b3f755fd01ba2c174ca0c947638806323a228..f19e0d28cd18a1cae02ab18786af2a5ff9c615aa 100644 (file)
@@ -3,7 +3,7 @@
   It wraps Lzma decompress interfaces to GUIDed Section Extraction interfaces\r
   and registers them into GUIDed handler table.\r
 \r
-  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -63,20 +63,37 @@ LzmaGuidedSectionGetInfo (
   ASSERT (ScratchBufferSize != NULL);\r
   ASSERT (SectionAttribute != NULL);\r
 \r
-  if (!CompareGuid (\r
-        &gLzmaCustomDecompressGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    if (!CompareGuid (\r
+        &gLzmaCustomDecompressGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+\r
+    *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;\r
+\r
+    return LzmaUefiDecompressGetInfo (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             OutputBufferSize,\r
+             ScratchBufferSize\r
+             );\r
+  } else {\r
+    if (!CompareGuid (\r
+        &gLzmaCustomDecompressGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
 \r
-  *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
+    *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
 \r
-  return LzmaUefiDecompressGetInfo (\r
-          (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-          SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-          OutputBufferSize,\r
-          ScratchBufferSize\r
-          );\r
+    return LzmaUefiDecompressGetInfo (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             OutputBufferSize,\r
+             ScratchBufferSize\r
+             );\r
+  }\r
 }\r
 \r
 /**\r
@@ -124,23 +141,43 @@ LzmaGuidedSectionExtraction (
   ASSERT (OutputBuffer != NULL);\r
   ASSERT (InputSection != NULL);\r
 \r
-  if (!CompareGuid (\r
-        &gLzmaCustomDecompressGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    if (!CompareGuid (\r
+        &gLzmaCustomDecompressGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+\r
+    //\r
+    // Authentication is set to Zero, which may be ignored.\r
+    //\r
+    *AuthenticationStatus = 0;\r
+\r
+    return LzmaUefiDecompress (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,\r
+             *OutputBuffer,\r
+             ScratchBuffer\r
+             );\r
+  } else {\r
+    if (!CompareGuid (\r
+        &gLzmaCustomDecompressGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // Authentication is set to Zero, which may be ignored.\r
-  //\r
-  *AuthenticationStatus = 0;\r
-\r
-  return LzmaUefiDecompress (\r
-    (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-    SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
-    *OutputBuffer,\r
-    ScratchBuffer\r
+      return RETURN_INVALID_PARAMETER;\r
+    }\r
+\r
+    //\r
+    // Authentication is set to Zero, which may be ignored.\r
+    //\r
+    *AuthenticationStatus = 0;\r
+\r
+    return LzmaUefiDecompress (\r
+             (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,\r
+             *OutputBuffer,\r
+             ScratchBuffer\r
     );\r
+  }\r
 }\r
 \r
 \r
index 18aee70774515564bf038e402cce58e39797750f..de1b1368da355f7094a9756793e4fe2c43e906b6 100644 (file)
@@ -4,7 +4,7 @@
   to parse CRC32 encapsulation section and extract raw data.\r
   It uses UEFI boot service CalculateCrc32 to authenticate 32 bit CRC value.\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -23,8 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
-#define EFI_SECITON_SIZE_MASK 0x00ffffff\r
-\r
 ///\r
 /// CRC32 Guided Section header\r
 ///\r
@@ -33,6 +31,11 @@ typedef struct {
   UINT32                    CRC32Checksum;       ///< 32bit CRC check sum\r
 } CRC32_SECTION_HEADER;\r
 \r
+typedef struct {\r
+  EFI_GUID_DEFINED_SECTION2 GuidedSectionHeader; ///< EFI guided section header\r
+  UINT32                    CRC32Checksum;       ///< 32bit CRC check sum\r
+} CRC32_SECTION2_HEADER;\r
+\r
 /**\r
 \r
   GetInfo gets raw data size and attribute of the input guided section.\r
@@ -58,21 +61,37 @@ Crc32GuidedSectionGetInfo (
   OUT UINT16      *SectionAttribute\r
   )\r
 {\r
-  //\r
-  // Check whether the input guid section is recognized.\r
-  //\r
-  if (!CompareGuid (\r
-        &gEfiCrc32GuidedSectionExtractionGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    //\r
+    // Check whether the input guid section is recognized.\r
+    //\r
+    if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+    //\r
+    // Retrieve the size and attribute of the input section data.\r
+    //\r
+    *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;\r
+    *ScratchBufferSize = 0;\r
+    *OutputBufferSize  = SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;\r
+  } else {\r
+    //\r
+    // Check whether the input guid section is recognized.\r
+    //\r
+    if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return EFI_INVALID_PARAMETER;\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+    //\r
+    // Retrieve the size and attribute of the input section data.\r
+    //\r
+    *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
+    *ScratchBufferSize = 0;\r
+    *OutputBufferSize  = SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;\r
   }\r
-  //\r
-  // Retrieve the size and attribute of the input section data.\r
-  //\r
-  *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
-  *ScratchBufferSize = 0;\r
-  *OutputBufferSize  = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK;\r
-  *OutputBufferSize  -= ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -104,37 +123,61 @@ Crc32GuidedSectionHandler (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  CRC32_SECTION_HEADER      *Crc32SectionHeader;\r
+  UINT32                    SectionCrc32Checksum;\r
   UINT32                    Crc32Checksum;\r
   UINT32                    OutputBufferSize;\r
   VOID                      *DummyInterface;\r
 \r
-  //\r
-  // Check whether the input guid section is recognized.\r
-  //\r
-  if (!CompareGuid (\r
-        &gEfiCrc32GuidedSectionExtractionGuid, \r
+  if (IS_SECTION2 (InputSection)) {\r
+    //\r
+    // Check whether the input guid section is recognized.\r
+    //\r
+    if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionGuid,\r
+        &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+  \r
+    //\r
+    // Get section Crc32 checksum.\r
+    //\r
+    SectionCrc32Checksum = ((CRC32_SECTION2_HEADER *) InputSection)->CRC32Checksum;\r
+    *OutputBuffer      = (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;\r
+    OutputBufferSize   = SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;\r
+\r
+    //\r
+    // Implicitly CRC32 GUIDed section should have STATUS_VALID bit set\r
+    //\r
+    ASSERT (((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID);\r
+    *AuthenticationStatus = EFI_AUTH_STATUS_IMAGE_SIGNED;\r
+  } else {\r
+    //\r
+    // Check whether the input guid section is recognized.\r
+    //\r
+    if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionGuid,\r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
   \r
+    //\r
+    // Get section Crc32 checksum.\r
+    //\r
+    SectionCrc32Checksum = ((CRC32_SECTION_HEADER *) InputSection)->CRC32Checksum;\r
+    *OutputBuffer      = (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;\r
+    OutputBufferSize   = SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;\r
+\r
+    //\r
+    // Implicitly CRC32 GUIDed section should have STATUS_VALID bit set\r
+    //\r
+    ASSERT (((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID);\r
+    *AuthenticationStatus = EFI_AUTH_STATUS_IMAGE_SIGNED;\r
+  }\r
+\r
   //\r
   // Init Checksum value to Zero.\r
   //\r
   Crc32Checksum = 0;\r
-  //\r
-  // Points to the Crc32 section header\r
-  //\r
-  Crc32SectionHeader = (CRC32_SECTION_HEADER *) InputSection;\r
-  *OutputBuffer      = (UINT8 *) InputSection + Crc32SectionHeader->GuidedSectionHeader.DataOffset;\r
-  OutputBufferSize   = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK; \r
-  OutputBufferSize   -= Crc32SectionHeader->GuidedSectionHeader.DataOffset;\r
-\r
-  //\r
-  // Implictly CRC32 GUIDed section should have STATUS_VALID bit set\r
-  //\r
-  ASSERT (Crc32SectionHeader->GuidedSectionHeader.Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID);\r
-  *AuthenticationStatus = EFI_AUTH_STATUS_IMAGE_SIGNED;\r
 \r
   //\r
   // Check whether there exists EFI_SECURITY_POLICY_PROTOCOL_GUID.\r
@@ -151,7 +194,7 @@ Crc32GuidedSectionHandler (
     //\r
     Status = gBS->CalculateCrc32 (*OutputBuffer, OutputBufferSize, &Crc32Checksum);\r
     if (Status == EFI_SUCCESS) {\r
-      if (Crc32Checksum != Crc32SectionHeader->CRC32Checksum) {\r
+      if (Crc32Checksum != SectionCrc32Checksum) {\r
         //\r
         // If Crc32 checksum is not matched, AUTH tested failed bit is set.\r
         //\r
index 1408df09307746c3da71131fea45c6bb1cbb36f9..3e020b4208b49036b74ec97a55171e7ad7959d93 100644 (file)
@@ -176,6 +176,15 @@ typedef struct {
   UINT32                    ExtendedSize;\r
 } EFI_FFS_FILE_HEADER2;\r
 \r
+#define IS_FFS_FILE2(FfsFileHeaderPtr) \\r
+    (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE)\r
+\r
+#define FFS_FILE_SIZE(FfsFileHeaderPtr) \\r
+    ((UINT32) (*((UINT32 *) ((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Size) & 0x00ffffff))\r
+\r
+#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \\r
+    (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize)\r
+\r
 typedef UINT8 EFI_SECTION_TYPE;\r
 \r
 ///\r
@@ -470,8 +479,14 @@ typedef struct {
   CHAR16                        VersionString[1];\r
 } EFI_VERSION_SECTION2;\r
 \r
+#define IS_SECTION2(SectionHeaderPtr) \\r
+    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff) == 0x00ffffff)\r
+\r
 #define SECTION_SIZE(SectionHeaderPtr) \\r
-    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
+    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff))\r
+\r
+#define SECTION2_SIZE(SectionHeaderPtr) \\r
+    (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)\r
 \r
 #pragma pack()\r
 \r
index 1f622bb9ba60903cf79fd8bee97ad7af0462e130..22905894a44b92d4a0661281a020fb7e11676149 100644 (file)
@@ -211,7 +211,8 @@ typedef struct {
 #define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002\r
 \r
 ///\r
-/// This extension header provides a mapping between a GUID and an OEM file type.\r
+/// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific\r
+/// GUID FormatType type which includes a length and a successive series of data bytes.\r
 ///\r
 typedef struct {\r
   ///\r
index 6a2cde5200c93437fef57101045866014e2634fd..05e6a9e796879c959d3daa98812c9a24aa56f7a5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide generic extract guided section functions.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -261,6 +261,7 @@ ExtractGuidedSectionGetInfo (
   UINT32                              Index;\r
   RETURN_STATUS                       Status;\r
   EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  EFI_GUID                            *SectionDefinitionGuid;\r
   \r
   //\r
   // Check input paramter\r
@@ -278,11 +279,17 @@ ExtractGuidedSectionGetInfo (
     return Status;\r
   }\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to get information for the input section data.\r
       //\r
@@ -348,6 +355,7 @@ ExtractGuidedSectionDecode (
   UINT32                              Index;\r
   RETURN_STATUS                       Status;\r
   EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  EFI_GUID                            *SectionDefinitionGuid;\r
   \r
   //\r
   // Check input parameter\r
@@ -364,11 +372,17 @@ ExtractGuidedSectionDecode (
     return Status;\r
   }\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered Extract handler for the input guided section.\r
   //\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input guided section.\r
       //\r
index b8bb83c20e700297f760965342680f8f045e9678..609b329f624d394607a9c12d8eea8cede78d49ad 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide generic extract guided section functions for Dxe phase.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -259,17 +259,24 @@ ExtractGuidedSectionGetInfo (
   )\r
 {\r
   UINT32 Index;\r
+  EFI_GUID *SectionDefinitionGuid;\r
 \r
   ASSERT (InputSection != NULL);  \r
   ASSERT (OutputBufferSize != NULL);\r
   ASSERT (ScratchBufferSize != NULL);\r
   ASSERT (SectionAttribute != NULL);\r
+\r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
  \r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to getinfo for the input section data.\r
       //\r
@@ -333,6 +340,7 @@ ExtractGuidedSectionDecode (
   )\r
 {\r
   UINT32 Index;\r
+  EFI_GUID *SectionDefinitionGuid;\r
   \r
   //\r
   // Check the input parameters\r
@@ -341,11 +349,17 @@ ExtractGuidedSectionDecode (
   ASSERT (OutputBuffer != NULL);\r
   ASSERT (AuthenticationStatus != NULL);\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered extract handler for the input guided section.\r
   //\r
   for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input section data.\r
       //\r
index fa382ae3c80e449c6f30e111c162335aa8a459c1..1fad3d0c478f1e45e0ce43ae7a243ff26226d769 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide generic extract guided section functions for PEI phase.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -290,6 +290,7 @@ ExtractGuidedSectionGetInfo (
   UINT32 Index;\r
   EFI_STATUS Status;\r
   PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  EFI_GUID *SectionDefinitionGuid;\r
   \r
   //\r
   // Check input paramter\r
@@ -306,12 +307,18 @@ ExtractGuidedSectionGetInfo (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to get information for the input section data.\r
       //\r
@@ -377,6 +384,7 @@ ExtractGuidedSectionDecode (
   UINT32     Index;\r
   EFI_STATUS Status;\r
   PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  EFI_GUID *SectionDefinitionGuid;\r
   \r
   //\r
   // Check input parameter\r
@@ -393,11 +401,17 @@ ExtractGuidedSectionDecode (
     return Status;\r
   }\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered Extract handler for the input guided section.\r
   //\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input guided section.\r
       //\r