]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Pi/PiFirmwareFile.h
MdePkg: Follow PI1.4a update SmmStartupThisAP() description
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
index 1408df09307746c3da71131fea45c6bb1cbb36f9..734344430aa6cdf90b1e3107190e1a5005d9864e 100644 (file)
@@ -1,17 +1,17 @@
 /** @file\r
   The firmware file related definitions in PI.\r
 \r
 /** @file\r
   The firmware file related definitions in PI.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution.  \r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
 The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.                                            \r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.              \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
   @par Revision Reference:\r
 \r
   @par Revision Reference:\r
-  PI Version 1.2.\r
+  PI Version 1.4.\r
 \r
 **/\r
 \r
 \r
 **/\r
 \r
@@ -22,7 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #pragma pack(1)\r
 ///\r
 /// Used to verify the integrity of the file.\r
 #pragma pack(1)\r
 ///\r
 /// Used to verify the integrity of the file.\r
-/// \r
+///\r
 typedef union {\r
   struct {\r
     ///\r
 typedef union {\r
   struct {\r
     ///\r
@@ -60,7 +60,7 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 \r
 ///\r
 /// File Types Definitions\r
 \r
 ///\r
 /// File Types Definitions\r
-/// \r
+///\r
 #define EFI_FV_FILETYPE_ALL                   0x00\r
 #define EFI_FV_FILETYPE_RAW                   0x01\r
 #define EFI_FV_FILETYPE_FREEFORM              0x02\r
 #define EFI_FV_FILETYPE_ALL                   0x00\r
 #define EFI_FV_FILETYPE_RAW                   0x01\r
 #define EFI_FV_FILETYPE_FREEFORM              0x02\r
@@ -82,17 +82,17 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 #define EFI_FV_FILETYPE_FFS_MIN               0xf0\r
 #define EFI_FV_FILETYPE_FFS_MAX               0xff\r
 #define EFI_FV_FILETYPE_FFS_PAD               0xf0\r
 #define EFI_FV_FILETYPE_FFS_MIN               0xf0\r
 #define EFI_FV_FILETYPE_FFS_MAX               0xff\r
 #define EFI_FV_FILETYPE_FFS_PAD               0xf0\r
-/// \r
+///\r
 /// FFS File Attributes.\r
 /// FFS File Attributes.\r
-/// \r
+///\r
 #define FFS_ATTRIB_LARGE_FILE         0x01\r
 #define FFS_ATTRIB_FIXED              0x04\r
 #define FFS_ATTRIB_DATA_ALIGNMENT     0x38\r
 #define FFS_ATTRIB_CHECKSUM           0x40\r
 \r
 #define FFS_ATTRIB_LARGE_FILE         0x01\r
 #define FFS_ATTRIB_FIXED              0x04\r
 #define FFS_ATTRIB_DATA_ALIGNMENT     0x38\r
 #define FFS_ATTRIB_CHECKSUM           0x40\r
 \r
-/// \r
+///\r
 /// FFS File State Bits.\r
 /// FFS File State Bits.\r
-/// \r
+///\r
 #define EFI_FILE_HEADER_CONSTRUCTION  0x01\r
 #define EFI_FILE_HEADER_VALID         0x02\r
 #define EFI_FILE_DATA_VALID           0x04\r
 #define EFI_FILE_HEADER_CONSTRUCTION  0x01\r
 #define EFI_FILE_HEADER_VALID         0x02\r
 #define EFI_FILE_DATA_VALID           0x04\r
@@ -102,9 +102,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 \r
 \r
 ///\r
 \r
 \r
 ///\r
-/// Each file begins with the header that describe the \r
+/// Each file begins with the header that describe the\r
 /// contents and state of the files.\r
 /// contents and state of the files.\r
-/// \r
+///\r
 typedef struct {\r
   ///\r
   /// This GUID is the file name. It is used to uniquely identify the file.\r
 typedef struct {\r
   ///\r
   /// This GUID is the file name. It is used to uniquely identify the file.\r
@@ -139,22 +139,22 @@ typedef struct {
   /// volume, except if the file type is EFI_FV_FILETYPE_FFS_PAD.\r
   ///\r
   EFI_GUID                  Name;\r
   /// volume, except if the file type is EFI_FV_FILETYPE_FFS_PAD.\r
   ///\r
   EFI_GUID                  Name;\r
-  \r
+\r
   ///\r
   /// Used to verify the integrity of the file.\r
   ///\r
   /// Used to verify the integrity of the file.\r
-  ///  \r
+  ///\r
   EFI_FFS_INTEGRITY_CHECK   IntegrityCheck;\r
   EFI_FFS_INTEGRITY_CHECK   IntegrityCheck;\r
-  \r
+\r
   ///\r
   /// Identifies the type of file.\r
   ///\r
   /// Identifies the type of file.\r
-  ///  \r
+  ///\r
   EFI_FV_FILETYPE           Type;\r
   EFI_FV_FILETYPE           Type;\r
-  \r
+\r
   ///\r
   /// Declares various file attribute bits.\r
   ///\r
   /// Declares various file attribute bits.\r
-  ///  \r
+  ///\r
   EFI_FFS_FILE_ATTRIBUTES   Attributes;\r
   EFI_FFS_FILE_ATTRIBUTES   Attributes;\r
-  \r
+\r
   ///\r
   /// The length of the file in bytes, including the FFS header.\r
   /// The length of the file data is either (Size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a\r
   ///\r
   /// The length of the file in bytes, including the FFS header.\r
   /// The length of the file data is either (Size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a\r
@@ -163,19 +163,28 @@ typedef struct {
   /// located at the next 8-byte aligned firmware volume offset following the last byte of the file F.\r
   ///\r
   UINT8                     Size[3];\r
   /// located at the next 8-byte aligned firmware volume offset following the last byte of the file F.\r
   ///\r
   UINT8                     Size[3];\r
-  \r
+\r
   ///\r
   /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
   ///\r
   EFI_FFS_FILE_STATE        State;\r
   ///\r
   /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
   ///\r
   EFI_FFS_FILE_STATE        State;\r
-  \r
+\r
   ///\r
   /// If FFS_ATTRIB_LARGE_FILE is set in Attributes, then ExtendedSize exists and Size must be set to zero.\r
   /// If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used.\r
   ///\r
   ///\r
   /// If FFS_ATTRIB_LARGE_FILE is set in Attributes, then ExtendedSize exists and Size must be set to zero.\r
   /// If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used.\r
   ///\r
-  UINT32                    ExtendedSize;\r
+  UINT64                    ExtendedSize;\r
 } EFI_FFS_FILE_HEADER2;\r
 \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
+    ((UINT32) (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize))\r
+\r
 typedef UINT8 EFI_SECTION_TYPE;\r
 \r
 ///\r
 typedef UINT8 EFI_SECTION_TYPE;\r
 \r
 ///\r
@@ -211,10 +220,10 @@ typedef UINT8 EFI_SECTION_TYPE;
 \r
 ///\r
 /// Common section header.\r
 \r
 ///\r
 /// Common section header.\r
-/// \r
+///\r
 typedef struct {\r
   ///\r
 typedef struct {\r
   ///\r
-  /// A 24-bit unsigned integer that contains the total size of the section in bytes, \r
+  /// A 24-bit unsigned integer that contains the total size of the section in bytes,\r
   /// including the EFI_COMMON_SECTION_HEADER.\r
   ///\r
   UINT8             Size[3];\r
   /// including the EFI_COMMON_SECTION_HEADER.\r
   ///\r
   UINT8             Size[3];\r
@@ -226,36 +235,36 @@ typedef struct {
 \r
 typedef struct {\r
   ///\r
 \r
 typedef struct {\r
   ///\r
-  /// A 24-bit unsigned integer that contains the total size of the section in bytes, \r
+  /// A 24-bit unsigned integer that contains the total size of the section in bytes,\r
   /// including the EFI_COMMON_SECTION_HEADER.\r
   ///\r
   UINT8             Size[3];\r
   /// including the EFI_COMMON_SECTION_HEADER.\r
   ///\r
   UINT8             Size[3];\r
-  \r
+\r
   EFI_SECTION_TYPE  Type;\r
   EFI_SECTION_TYPE  Type;\r
-  \r
+\r
   ///\r
   /// If Size is 0xFFFFFF, then ExtendedSize contains the size of the section. If\r
   ///\r
   /// If Size is 0xFFFFFF, then ExtendedSize contains the size of the section. If\r
-  /// Size is not equal to 0xFFFFFF, then this field does not exist.  \r
+  /// Size is not equal to 0xFFFFFF, then this field does not exist.\r
   ///\r
   UINT32            ExtendedSize;\r
 } EFI_COMMON_SECTION_HEADER2;\r
 \r
 ///\r
   ///\r
   UINT32            ExtendedSize;\r
 } EFI_COMMON_SECTION_HEADER2;\r
 \r
 ///\r
-/// Leaf section type that contains an \r
+/// Leaf section type that contains an\r
 /// IA-32 16-bit executable image.\r
 /// IA-32 16-bit executable image.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER  EFI_COMPATIBILITY16_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;\r
 \r
 ///\r
 /// CompressionType of EFI_COMPRESSION_SECTION.\r
 typedef EFI_COMMON_SECTION_HEADER  EFI_COMPATIBILITY16_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;\r
 \r
 ///\r
 /// CompressionType of EFI_COMPRESSION_SECTION.\r
-/// \r
+///\r
 #define EFI_NOT_COMPRESSED        0x00\r
 #define EFI_STANDARD_COMPRESSION  0x01\r
 ///\r
 #define EFI_NOT_COMPRESSED        0x00\r
 #define EFI_STANDARD_COMPRESSION  0x01\r
 ///\r
-/// An encapsulation section type in which the \r
+/// An encapsulation section type in which the\r
 /// section data is compressed.\r
 /// section data is compressed.\r
-/// \r
+///\r
 typedef struct {\r
   ///\r
   /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
 typedef struct {\r
   ///\r
   /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
@@ -300,19 +309,19 @@ typedef EFI_COMMON_SECTION_HEADER2  EFI_DISPOSABLE_SECTION2;
 \r
 ///\r
 /// The leaf section which could be used to determine the dispatch order of DXEs.\r
 \r
 ///\r
 /// The leaf section which could be used to determine the dispatch order of DXEs.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_DXE_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_DXE_DEPEX_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains a PI FV.\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_DXE_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_DXE_DEPEX_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains a PI FV.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains a single GUID.\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains a single GUID.\r
-/// \r
+///\r
 typedef struct {\r
   ///\r
   /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
 typedef struct {\r
   ///\r
   /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
@@ -331,18 +340,18 @@ typedef struct {
   EFI_COMMON_SECTION_HEADER2    CommonHeader;\r
   ///\r
   /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
   EFI_COMMON_SECTION_HEADER2    CommonHeader;\r
   ///\r
   /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
-  ///  \r
+  ///\r
   EFI_GUID                      SubTypeGuid;\r
 } EFI_FREEFORM_SUBTYPE_GUID_SECTION2;\r
 \r
 ///\r
 /// Attributes of EFI_GUID_DEFINED_SECTION.\r
   EFI_GUID                      SubTypeGuid;\r
 } EFI_FREEFORM_SUBTYPE_GUID_SECTION2;\r
 \r
 ///\r
 /// Attributes of EFI_GUID_DEFINED_SECTION.\r
-/// \r
+///\r
 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01\r
 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02\r
 ///\r
 /// The leaf section which is encapsulation defined by specific GUID.\r
 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01\r
 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02\r
 ///\r
 /// The leaf section which is encapsulation defined by specific GUID.\r
-/// \r
+///\r
 typedef struct {\r
   ///\r
   /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
 typedef struct {\r
   ///\r
   /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
@@ -369,27 +378,27 @@ typedef struct {
   EFI_COMMON_SECTION_HEADER2    CommonHeader;\r
   ///\r
   /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
   EFI_COMMON_SECTION_HEADER2    CommonHeader;\r
   ///\r
   /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
-  ///  \r
+  ///\r
   EFI_GUID                      SectionDefinitionGuid;\r
   ///\r
   /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r
   EFI_GUID                      SectionDefinitionGuid;\r
   ///\r
   /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r
-  ///  \r
+  ///\r
   UINT16                        DataOffset;\r
   ///\r
   /// The bit field that declares some specific characteristics of the section contents.\r
   UINT16                        DataOffset;\r
   ///\r
   /// The bit field that declares some specific characteristics of the section contents.\r
-  ///  \r
+  ///\r
   UINT16                        Attributes;\r
 } EFI_GUID_DEFINED_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains PE32+ image.\r
   UINT16                        Attributes;\r
 } EFI_GUID_DEFINED_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains PE32+ image.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_PE32_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_PE32_SECTION2;\r
 \r
 ///\r
 /// The leaf section used to determine the dispatch order of PEIMs.\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_PE32_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_PE32_SECTION2;\r
 \r
 ///\r
 /// The leaf section used to determine the dispatch order of PEIMs.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_PEI_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_PEI_DEPEX_SECTION2;\r
 \r
 typedef EFI_COMMON_SECTION_HEADER   EFI_PEI_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_PEI_DEPEX_SECTION2;\r
 \r
@@ -407,37 +416,37 @@ typedef EFI_COMMON_SECTION_HEADER2  EFI_PIC_SECTION2;
 \r
 ///\r
 /// The leaf section which constains the position-independent-code image.\r
 \r
 ///\r
 /// The leaf section which constains the position-independent-code image.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_TE_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_TE_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains an array of zero or more bytes.\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_TE_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_TE_SECTION2;\r
 \r
 ///\r
 /// The leaf section which contains an array of zero or more bytes.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER   EFI_RAW_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_RAW_SECTION2;\r
 \r
 typedef EFI_COMMON_SECTION_HEADER   EFI_RAW_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2  EFI_RAW_SECTION2;\r
 \r
-/// \r
+///\r
 /// The SMM dependency expression section is a leaf section that contains a dependency expression that\r
 /// is used to determine the dispatch order for SMM drivers. Before the SMRAM invocation of the\r
 /// SMM driver's entry point, this dependency expression must evaluate to TRUE. See the Platform\r
 /// Initialization Specification, Volume 2, for details regarding the format of the dependency expression.\r
 /// The dependency expression may refer to protocols installed in either the UEFI or the SMM protocol\r
 /// database. EFI_SMM_DEPEX_SECTION2 must be used if the section is 16MB or larger.\r
 /// The SMM dependency expression section is a leaf section that contains a dependency expression that\r
 /// is used to determine the dispatch order for SMM drivers. Before the SMRAM invocation of the\r
 /// SMM driver's entry point, this dependency expression must evaluate to TRUE. See the Platform\r
 /// Initialization Specification, Volume 2, for details regarding the format of the dependency expression.\r
 /// The dependency expression may refer to protocols installed in either the UEFI or the SMM protocol\r
 /// database. EFI_SMM_DEPEX_SECTION2 must be used if the section is 16MB or larger.\r
-/// \r
+///\r
 typedef EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2;\r
 \r
 ///\r
 typedef EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION;\r
 typedef EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2;\r
 \r
 ///\r
-/// The leaf section which contains a unicode string that \r
+/// The leaf section which contains a unicode string that\r
 /// is human readable file name.\r
 /// is human readable file name.\r
-/// \r
+///\r
 typedef struct {\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
 \r
   ///\r
   /// Array of unicode string.\r
 typedef struct {\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
 \r
   ///\r
   /// Array of unicode string.\r
-  /// \r
+  ///\r
   CHAR16                      FileNameString[1];\r
 } EFI_USER_INTERFACE_SECTION;\r
 \r
   CHAR16                      FileNameString[1];\r
 } EFI_USER_INTERFACE_SECTION;\r
 \r
@@ -448,15 +457,15 @@ typedef struct {
 \r
 ///\r
 /// The leaf section which contains a numeric build number and\r
 \r
 ///\r
 /// The leaf section which contains a numeric build number and\r
-/// an optional unicode string that represents the file revision. \r
-/// \r
+/// an optional unicode string that represents the file revision.\r
+///\r
 typedef struct {\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
   UINT16                      BuildNumber;\r
 \r
   ///\r
   /// Array of unicode string.\r
 typedef struct {\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
   UINT16                      BuildNumber;\r
 \r
   ///\r
   /// Array of unicode string.\r
-  /// \r
+  ///\r
   CHAR16                      VersionString[1];\r
 } EFI_VERSION_SECTION;\r
 \r
   CHAR16                      VersionString[1];\r
 } EFI_VERSION_SECTION;\r
 \r
@@ -470,8 +479,14 @@ typedef struct {
   CHAR16                        VersionString[1];\r
 } EFI_VERSION_SECTION2;\r
 \r
   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
 #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
 \r
 #pragma pack()\r
 \r