]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Pi/PiFirmwareFile.h
Add EFI_DISPOSABLE_SECTION type defined in PI 1.2 specification.
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
index 6ebd42e50c759635591967f6a97e7c69b0934bdd..95d293ddfc38830dd91f67d353fd1651387145f8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The firmware file related definitions in PI.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
   All rights reserved. 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
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
   @par Revision Reference:\r
-  Version 1.0.\r
+  PI Version 1.0\r
 \r
 **/\r
 \r
+\r
 #ifndef __PI_FIRMWARE_FILE_H__\r
 #define __PI_FIRMWARE_FILE_H__\r
 \r
-//\r
-// Used to verify the integrity of the file.\r
-// \r
+#pragma pack(1)\r
+///\r
+/// Used to verify the integrity of the file.\r
+/// \r
 typedef union {\r
   struct {\r
+    ///\r
+    /// The IntegrityCheck.Checksum.Header field is an 8-bit checksum of the file\r
+    /// header. The State and IntegrityCheck.Checksum.File fields are assumed\r
+    /// to be zero and the checksum is calculated such that the entire header sums to zero.\r
+    ///\r
     UINT8   Header;\r
+    ///\r
+    /// If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes\r
+    /// field is set to one, the IntegrityCheck.Checksum.File field is an 8-bit\r
+    /// checksum of the entire file The State field and the file tail are assumed to be zero\r
+    /// and the checksum is calculated such that the entire file sums to zero.\r
+    /// If the FFS_ATTRIB_CHECKSUM bit of the Attributes field is cleared to zero,\r
+    /// the IntegrityCheck.Checksum.File field must be initialized with a value of\r
+    /// 0x55AA. The IntegrityCheck.Checksum.File field is valid any time the\r
+    /// EFI_FILE_DATA_VALID bit is set in the State field.\r
+    ///\r
     UINT8   File;\r
   } Checksum;\r
+  ///\r
+  /// This is the full 16 bits of the IntegrityCheck field.\r
+  ///\r
   UINT16    Checksum16;\r
 } EFI_FFS_INTEGRITY_CHECK;\r
 \r
@@ -33,16 +53,37 @@ typedef UINT8 EFI_FV_FILETYPE;
 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
 typedef UINT8 EFI_FFS_FILE_STATE;\r
 \r
-// \r
-// FFS File Attributes.\r
-// \r
+///\r
+/// File Types Definitions\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_SECURITY_CORE         0x03\r
+#define EFI_FV_FILETYPE_PEI_CORE              0x04\r
+#define EFI_FV_FILETYPE_DXE_CORE              0x05\r
+#define EFI_FV_FILETYPE_PEIM                  0x06\r
+#define EFI_FV_FILETYPE_DRIVER                0x07\r
+#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER  0x08\r
+#define EFI_FV_FILETYPE_APPLICATION           0x09\r
+#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r
+#define EFI_FV_FILETYPE_OEM_MIN               0xc0\r
+#define EFI_FV_FILETYPE_OEM_MAX               0xdf\r
+#define EFI_FV_FILETYPE_DEBUG_MIN             0xe0\r
+#define EFI_FV_FILETYPE_DEBUG_MAX             0xef\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
+/// FFS File Attributes.\r
+/// \r
 #define FFS_ATTRIB_FIXED              0x04\r
 #define FFS_ATTRIB_DATA_ALIGNMENT     0x38\r
 #define FFS_ATTRIB_CHECKSUM           0x40\r
 \r
-// \r
-// FFS File State Bits.\r
-// \r
+/// \r
+/// FFS File State Bits.\r
+/// \r
 #define EFI_FILE_HEADER_CONSTRUCTION  0x01\r
 #define EFI_FILE_HEADER_VALID         0x02\r
 #define EFI_FILE_DATA_VALID           0x04\r
@@ -51,39 +92,57 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 #define EFI_FILE_HEADER_INVALID       0x20\r
 \r
 \r
-//\r
-// Each file begins with the header that describe the \r
-// contents and state of the files.\r
-// \r
+///\r
+/// Each file begins with the header that describe the \r
+/// contents and state of the files.\r
+/// \r
 typedef struct {\r
+  ///\r
+  /// This GUID is the file name. It is used to uniquely identify the file.\r
+  ///\r
   EFI_GUID                Name;\r
+  ///\r
+  /// Used to verify the integrity of the file.\r
+  ///\r
   EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
+  ///\r
+  /// Identifies the type of file.\r
+  ///\r
   EFI_FV_FILETYPE         Type;\r
+  ///\r
+  /// Declares various file attribute bits.\r
+  ///\r
   EFI_FFS_FILE_ATTRIBUTES Attributes;\r
+  ///\r
+  /// The length of the file in bytes, including the FFS header.\r
+  ///\r
   UINT8                   Size[3];\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
 } EFI_FFS_FILE_HEADER;\r
 \r
 \r
 typedef UINT8 EFI_SECTION_TYPE;\r
 \r
-//\r
-// Pseudo type. It is\r
-// used as a wild card when retrieving sections. The section\r
-// type EFI_SECTION_ALL matches all section types.\r
-//\r
+///\r
+/// Pseudo type. It is\r
+/// used as a wild card when retrieving sections. The section\r
+/// type EFI_SECTION_ALL matches all section types.\r
+///\r
 #define EFI_SECTION_ALL                   0x00\r
 \r
-//\r
-// Encapsulation section Type values\r
-//\r
+///\r
+/// Encapsulation section Type values\r
+///\r
 #define EFI_SECTION_COMPRESSION           0x01\r
 \r
 #define EFI_SECTION_GUID_DEFINED          0x02\r
 \r
-//\r
-// Leaf section Type values\r
-//\r
+///\r
+/// Leaf section Type values\r
+///\r
 #define EFI_SECTION_PE32                  0x10\r
 #define EFI_SECTION_PIC                   0x11\r
 #define EFI_SECTION_TE                    0x12\r
@@ -96,109 +155,167 @@ typedef UINT8 EFI_SECTION_TYPE;
 #define EFI_SECTION_RAW                   0x19\r
 #define EFI_SECTION_PEI_DEPEX             0x1B\r
 \r
+///\r
+/// Common section header\r
+/// \r
 typedef struct {\r
+  ///\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
   EFI_SECTION_TYPE  Type;\r
+  ///\r
+  /// Declares the section type.\r
+  ///\r
 } EFI_COMMON_SECTION_HEADER;\r
 \r
-//\r
-// Leaf section type that contains an \r
-// IA-32 16-bit executable image.\r
-// \r
+///\r
+/// Leaf section type that contains an \r
+/// IA-32 16-bit executable image.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
 \r
-//\r
-// CompressionType of EFI_COMPRESSION_SECTION.\r
-// \r
+///\r
+/// CompressionType of EFI_COMPRESSION_SECTION.\r
+/// \r
 #define EFI_NOT_COMPRESSED        0x00\r
 #define EFI_STANDARD_COMPRESSION  0x01\r
-//\r
-// An encapsulation section type in which the \r
-// section data is compressed.\r
-// \r
+///\r
+/// An encapsulation section type in which the \r
+/// section data is compressed.\r
+/// \r
 typedef struct {\r
+  ///\r
+  /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
+  ///\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
+  ///\r
+  /// UINT32 that indicates the size of the section data after decompression.\r
+  ///\r
   UINT32                      UncompressedLength;\r
+  ///\r
+  /// Indicates which compression algorithm is used.\r
+  ///\r
   UINT8                       CompressionType;\r
 } EFI_COMPRESSION_SECTION;\r
 \r
-//\r
-// Leaf section which could be used to determine the dispatch order of DXEs.\r
-// \r
+///\r
+/// An encapsulation section type in which the section data is disposable.\r
+/// A disposable section is an encapsulation section in which the section data may be disposed of during\r
+/// the process of creating or updating a firmware image without significant impact on the usefulness of\r
+/// the file. The Type field in the section header is set to EFI_SECTION_DISPOSABLE. This\r
+/// allows optional or descriptive data to be included with the firmware file which can be removed in\r
+/// order to conserve space. The contents of this section are implementation specific, but might contain\r
+/// debug data or detailed integration instructions.\r
+///\r
+typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION;\r
+\r
+///\r
+/// Leaf section which could be used to determine the dispatch order of DXEs.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
 \r
-//\r
-// Leaf section witch contains a PI FV.\r
-// \r
+///\r
+/// Leaf section which contains a PI FV.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
 \r
-//\r
-// Leaf section which contains a single GUID.\r
-// \r
+///\r
+/// Leaf section which contains a single GUID.\r
+/// \r
 typedef struct {\r
+  ///\r
+  /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
+  ///\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
+  ///\r
+  /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
+  ///\r
   EFI_GUID                    SubTypeGuid;\r
 } EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
 \r
-//\r
-// Attributes of EFI_GUID_DEFINED_SECTION\r
-// \r
+///\r
+/// Attributes of EFI_GUID_DEFINED_SECTION\r
+/// \r
 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01\r
 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02\r
-//\r
-// Leaf section which is encapsulation defined by specific GUID\r
-// \r
+///\r
+/// Leaf section which is encapsulation defined by specific GUID\r
+/// \r
 typedef struct {\r
+  ///\r
+  /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
+  ///\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
+  ///\r
+  /// GUID that defines the format of the data that follows. It is a vendor-defined section type.\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
+  ///\r
   UINT16                      DataOffset;\r
+  ///\r
+  /// Bit field that declares some specific characteristics of the section contents.\r
+  ///\r
   UINT16                      Attributes;\r
 } EFI_GUID_DEFINED_SECTION;\r
 \r
-//\r
-// Leaf section which contains PE32+ image.\r
-// \r
+///\r
+/// Leaf section which contains PE32+ image.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
 \r
 \r
-//\r
-// Leaf section which used to determine the dispatch order of PEIMs.\r
-// \r
+///\r
+/// Leaf section which used to determine the dispatch order of PEIMs.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
 \r
-//\r
-// Leaf section which constains the position-independent-code image.\r
-// \r
+///\r
+/// Leaf section which constains the position-independent-code image.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
 \r
-//\r
-// Leaf section which contains an array of zero or more bytes.\r
-// \r
+///\r
+/// Leaf section which contains an array of zero or more bytes.\r
+/// \r
 typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
 \r
-//\r
-// Leaf section which contains a unicode string that \r
-// is human readable file name.\r
-// \r
+///\r
+/// Leaf section which contains a unicode string that \r
+/// is human readable file name.\r
+/// \r
 typedef struct {\r
   EFI_COMMON_SECTION_HEADER   CommonHeader;\r
 \r
-  //\r
-  // Array of unicode string.\r
-  // \r
+  ///\r
+  /// Array of unicode string.\r
+  /// \r
   CHAR16                      FileNameString[1];\r
 } EFI_USER_INTERFACE_SECTION;\r
 \r
 \r
-//\r
-// Leaf section which contains a numeric build number and\r
-// an optional unicode string that represent the file revision. \r
-// \r
+///\r
+/// Leaf section which contains a numeric build number and\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
+  /// \r
   CHAR16                      VersionString[1];\r
 } EFI_VERSION_SECTION;\r
 \r
+\r
+#define SECTION_SIZE(SectionHeaderPtr) \\r
+    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
+\r
+#pragma pack()\r
+\r
 #endif\r
 \r