]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/IndustryStandard/PeImage.h
MdePkg: add missing #defines for decoding PCIe 2.1 extended capability structures
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / PeImage.h
index 7e253dcb19936cd3154221c7cb00b2d1e4345a8f..1abe72971ecbfb9e8faf8098ce88f2c9d8441de9 100644 (file)
@@ -4,17 +4,18 @@
   EFI_IMAGE_NT_HEADERS64 is for PE32+. \r
 \r
   This file is coded to the Visual Studio, Microsoft Portable Executable and \r
-  Common Object File Format Specification, Revision 8.0 - May 16, 2006. \r
+  Common Object File Format Specification, Revision 8.3 - February 6, 2013.\r
   This file also includes some definitions in PI Specification, Revision 1.0.\r
 \r
-  Copyright (c) 2006 - 2008, 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
-  http://opensource.org/licenses/bsd-license.php                                            \r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2008 - 2009, Apple Inc. 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
+http://opensource.org/licenses/bsd-license.php.                                           \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
 **/\r
 \r
 #define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION         10\r
 #define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11\r
 #define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      12\r
-#define EFI_IMAGE_SUBSYSTEM_EFI_EFI_ROM             13\r
-\r
 #define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER      13 ///< defined PI Specification, 1.0\r
 \r
 \r
 //\r
 // PE32+ Machine type for EFI images\r
 //\r
-#define IMAGE_FILE_MACHINE_I386     0x014c\r
-#define IMAGE_FILE_MACHINE_IA64     0x0200\r
-#define IMAGE_FILE_MACHINE_EBC      0x0EBC\r
-#define IMAGE_FILE_MACHINE_X64      0x8664\r
-//\r
-// Support old names for backward compatible\r
-//\r
-#define EFI_IMAGE_MACHINE_IA32      IMAGE_FILE_MACHINE_I386 \r
-#define EFI_IMAGE_MACHINE_IA64      IMAGE_FILE_MACHINE_IA64  \r
-#define EFI_IMAGE_MACHINE_IPF       IMAGE_FILE_MACHINE_IA64  \r
-#define EFI_IMAGE_MACHINE_EBC       IMAGE_FILE_MACHINE_EBC  \r
-#define EFI_IMAGE_MACHINE_X64       IMAGE_FILE_MACHINE_X64\r
+#define IMAGE_FILE_MACHINE_I386            0x014c\r
+#define IMAGE_FILE_MACHINE_IA64            0x0200\r
+#define IMAGE_FILE_MACHINE_EBC             0x0EBC\r
+#define IMAGE_FILE_MACHINE_X64             0x8664\r
+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  0x01c2\r
+#define IMAGE_FILE_MACHINE_ARM64           0xAA64\r
 \r
 //\r
 // EXE file formats\r
 /// under DOS it can print an error message.\r
 ///\r
 typedef struct {\r
-  UINT16  e_magic;    ///< Magic number\r
-  UINT16  e_cblp;     ///< Bytes on last page of file\r
-  UINT16  e_cp;       ///< Pages in file\r
-  UINT16  e_crlc;     ///< Relocations\r
-  UINT16  e_cparhdr;  ///< Size of header in paragraphs\r
-  UINT16  e_minalloc; ///< Minimum extra paragraphs needed\r
-  UINT16  e_maxalloc; ///< Maximum extra paragraphs needed\r
-  UINT16  e_ss;       ///< Initial (relative) SS value\r
-  UINT16  e_sp;       ///< Initial SP value\r
-  UINT16  e_csum;     ///< Checksum\r
-  UINT16  e_ip;       ///< Initial IP value\r
-  UINT16  e_cs;       ///< Initial (relative) CS value\r
-  UINT16  e_lfarlc;   ///< File address of relocation table\r
-  UINT16  e_ovno;     ///< Overlay number\r
-  UINT16  e_res[4];   ///< Reserved words\r
-  UINT16  e_oemid;    ///< OEM identifier (for e_oeminfo)\r
-  UINT16  e_oeminfo;  ///< OEM information; e_oemid specific\r
-  UINT16  e_res2[10]; ///< Reserved words\r
-  UINT32  e_lfanew;   ///< File address of new exe header\r
+  UINT16  e_magic;    ///< Magic number.\r
+  UINT16  e_cblp;     ///< Bytes on last page of file.\r
+  UINT16  e_cp;       ///< Pages in file.\r
+  UINT16  e_crlc;     ///< Relocations.\r
+  UINT16  e_cparhdr;  ///< Size of header in paragraphs.\r
+  UINT16  e_minalloc; ///< Minimum extra paragraphs needed.\r
+  UINT16  e_maxalloc; ///< Maximum extra paragraphs needed.\r
+  UINT16  e_ss;       ///< Initial (relative) SS value.\r
+  UINT16  e_sp;       ///< Initial SP value.\r
+  UINT16  e_csum;     ///< Checksum.\r
+  UINT16  e_ip;       ///< Initial IP value.\r
+  UINT16  e_cs;       ///< Initial (relative) CS value.\r
+  UINT16  e_lfarlc;   ///< File address of relocation table.\r
+  UINT16  e_ovno;     ///< Overlay number.\r
+  UINT16  e_res[4];   ///< Reserved words.\r
+  UINT16  e_oemid;    ///< OEM identifier (for e_oeminfo).\r
+  UINT16  e_oeminfo;  ///< OEM information; e_oemid specific.\r
+  UINT16  e_res2[10]; ///< Reserved words.\r
+  UINT32  e_lfanew;   ///< File address of new exe header.\r
 } EFI_IMAGE_DOS_HEADER;\r
 \r
 ///\r
-/// COFF File Header (Object and Image)\r
+/// COFF File Header (Object and Image).\r
 ///\r
 typedef struct {\r
   UINT16  Machine;\r
@@ -96,7 +89,7 @@ typedef struct {
 } EFI_IMAGE_FILE_HEADER;\r
 \r
 ///\r
-/// Size of EFI_IMAGE_FILE_HEADER\r
+/// Size of EFI_IMAGE_FILE_HEADER.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_FILE_HEADER        20\r
 \r
@@ -109,25 +102,13 @@ typedef struct {
 #define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED  BIT3     ///< 0x0008  Local symbols stripped from file.\r
 #define EFI_IMAGE_FILE_BYTES_REVERSED_LO    BIT7     ///< 0x0080  Bytes of machine word are reversed.\r
 #define EFI_IMAGE_FILE_32BIT_MACHINE        BIT8     ///< 0x0100  32 bit word machine.\r
-#define EFI_IMAGE_FILE_DEBUG_STRIPPED       BIT9     ///< 0x0200  Debugging info stripped from file in .DBG file\r
+#define EFI_IMAGE_FILE_DEBUG_STRIPPED       BIT9     ///< 0x0200  Debugging info stripped from file in .DBG file.\r
 #define EFI_IMAGE_FILE_SYSTEM               BIT12    ///< 0x1000  System File.\r
 #define EFI_IMAGE_FILE_DLL                  BIT13    ///< 0x2000  File is a DLL.\r
 #define EFI_IMAGE_FILE_BYTES_REVERSED_HI    BIT15    ///< 0x8000  Bytes of machine word are reversed.\r
 \r
-//\r
-// Other Machine Types\r
-//\r
-#define EFI_IMAGE_FILE_MACHINE_UNKNOWN      0       ///< Any machine type\r
-#define EFI_IMAGE_FILE_MACHINE_I386         0x14c   ///< Intel 386.\r
-#define EFI_IMAGE_FILE_MACHINE_R3000        0x162   ///< MIPS* little-endian, 0540 big-endian\r
-#define EFI_IMAGE_FILE_MACHINE_R4000        0x166   ///< MIPS* little-endian\r
-#define EFI_IMAGE_FILE_MACHINE_POWERPC      0x1F0   ///< IBM* PowerPC Little-Endian\r
-//\r
-// * Other names and brands may be claimed as the property of others.\r
-//\r
-\r
 ///\r
-/// Header Data Directories\r
+/// Header Data Directories.\r
 ///\r
 typedef struct {\r
   UINT32  VirtualAddress;\r
@@ -160,7 +141,7 @@ typedef struct {
 #define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b\r
           \r
 ///\r
-/// Optional Header Standard Fields for PE32\r
+/// Optional Header Standard Fields for PE32.\r
 ///\r
 typedef struct {\r
   ///\r
@@ -174,7 +155,7 @@ typedef struct {
   UINT32                    SizeOfUninitializedData;\r
   UINT32                    AddressOfEntryPoint;\r
   UINT32                    BaseOfCode;\r
-  UINT32                    BaseOfData;  ///< PE32 contains this additional field, which is absent in PE32+\r
+  UINT32                    BaseOfData;  ///< PE32 contains this additional field, which is absent in PE32+.\r
   ///\r
   /// Optional Header Windows-Specific Fields.\r
   ///\r
@@ -211,7 +192,7 @@ typedef struct {
 #define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b\r
 \r
 ///\r
-/// Optional Header Standard Fields for PE32+\r
+/// Optional Header Standard Fields for PE32+.\r
 ///\r
 typedef struct {\r
   ///\r
@@ -256,7 +237,6 @@ typedef struct {
 ///\r
 /// @attention\r
 /// EFI_IMAGE_NT_HEADERS32 is for use ONLY by tools.\r
-/// All proper EFI code MUST use EFI_IMAGE_NT_HEADERS ONLY!!!\r
 ///\r
 typedef struct {\r
   UINT32                      Signature;\r
@@ -269,7 +249,6 @@ typedef struct {
 ///\r
 /// @attention\r
 /// EFI_IMAGE_HEADERS64 is for use ONLY by tools.\r
-/// All proper EFI code MUST use EFI_IMAGE_NT_HEADERS ONLY!!!\r
 ///\r
 typedef struct {\r
   UINT32                      Signature;\r
@@ -279,67 +258,6 @@ typedef struct {
 \r
 #define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)\r
 \r
-\r
-///\r
-/// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the\r
-/// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build.  Same for\r
-/// EFI_IMAGE_NT_HEADERS.  These definitions MUST be used by ALL EFI code.\r
-///\r
-#if   defined (MDE_CPU_IA32)\r
-\r
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
-  (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
-\r
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64) \r
-\r
-typedef EFI_IMAGE_NT_HEADERS32    EFI_IMAGE_NT_HEADERS;\r
-\r
-#elif defined (MDE_CPU_IPF)\r
-\r
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
-  (((Machine) == EFI_IMAGE_MACHINE_IPF) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
-\r
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE) \r
-\r
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;\r
-\r
-#elif defined (MDE_CPU_X64)\r
-\r
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
-  (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
-\r
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32) \r
-\r
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;\r
-\r
-#elif defined (MDE_CPU_EBC)\r
-\r
-///\r
-/// This is just to make sure you can cross compile with the EBC compiiler.\r
-/// It does not make sense to have a PE loader coded in EBC. You need to \r
-/// understand the basic \r
-///\r
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)\r
-\r
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE) \r
-\r
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;\r
-\r
-#else\r
-#error Unknown Processor Type\r
-#endif\r
-\r
-\r
-#define EFI_IMAGE_FIRST_SECTION(ntheader) \\r
-    ( \\r
-      (EFI_IMAGE_SECTION_HEADER *) \\r
-        ( \\r
-          (UINT32) ntheader + \\r
-          OFFSET_OF (EFI_IMAGE_NT_HEADERS, OptionalHeader) + \\r
-          ((EFI_IMAGE_NT_HEADERS *) (ntheader))->FileHeader.SizeOfOptionalHeader \\r
-        ) \\r
-    )\r
-\r
 //\r
 // Other Windows Subsystem Values\r
 //\r
@@ -356,7 +274,7 @@ typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
 #define EFI_IMAGE_SIZEOF_SHORT_NAME 8\r
 \r
 ///\r
-/// Section Table, this table immediately follows the optional header\r
+/// Section Table. This table immediately follows the optional header.\r
 ///\r
 typedef struct {\r
   UINT8 Name[EFI_IMAGE_SIZEOF_SHORT_NAME];\r
@@ -375,7 +293,7 @@ typedef struct {
 } EFI_IMAGE_SECTION_HEADER;\r
 \r
 ///\r
-/// Size of EFI_IMAGE_SECTION_HEADER\r
+/// Size of EFI_IMAGE_SECTION_HEADER.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_SECTION_HEADER       40\r
          \r
@@ -409,7 +327,7 @@ typedef struct {
 #define EFI_IMAGE_SCN_MEM_WRITE                    BIT31  ///< 0x80000000\r
 \r
 ///\r
-/// Size of a Symbol Table Record\r
+/// Size of a Symbol Table Record.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_SYMBOL 18\r
 \r
@@ -522,15 +440,15 @@ typedef struct {
 //\r
 // I386 relocation types.\r
 //\r
-#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000  ///< Reference is absolute, no relocation is necessary\r
-#define EFI_IMAGE_REL_I386_DIR16    0x0001  ///< Direct 16-bit reference to the symbols virtual address\r
-#define EFI_IMAGE_REL_I386_REL16    0x0002  ///< PC-relative 16-bit reference to the symbols virtual address\r
-#define EFI_IMAGE_REL_I386_DIR32    0x0006  ///< Direct 32-bit reference to the symbols virtual address\r
-#define EFI_IMAGE_REL_I386_DIR32NB  0x0007  ///< Direct 32-bit reference to the symbols virtual address, base not included\r
-#define EFI_IMAGE_REL_I386_SEG12    0x0009  ///< Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address\r
+#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000  ///< Reference is absolute, no relocation is necessary.\r
+#define EFI_IMAGE_REL_I386_DIR16    0x0001  ///< Direct 16-bit reference to the symbols virtual address.\r
+#define EFI_IMAGE_REL_I386_REL16    0x0002  ///< PC-relative 16-bit reference to the symbols virtual address.\r
+#define EFI_IMAGE_REL_I386_DIR32    0x0006  ///< Direct 32-bit reference to the symbols virtual address.\r
+#define EFI_IMAGE_REL_I386_DIR32NB  0x0007  ///< Direct 32-bit reference to the symbols virtual address, base not included.\r
+#define EFI_IMAGE_REL_I386_SEG12    0x0009  ///< Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address.\r
 #define EFI_IMAGE_REL_I386_SECTION  0x000A\r
 #define EFI_IMAGE_REL_I386_SECREL   0x000B\r
-#define EFI_IMAGE_REL_I386_REL32    0x0014  ///< PC-relative 32-bit reference to the symbols virtual address\r
+#define EFI_IMAGE_REL_I386_REL32    0x0014  ///< PC-relative 32-bit reference to the symbols virtual address.\r
 \r
 // \r
 // x64 processor relocation types.\r
@@ -562,7 +480,7 @@ typedef struct {
 } EFI_IMAGE_BASE_RELOCATION;\r
 \r
 ///\r
-/// Size of EFI_IMAGE_BASE_RELOCATION\r
+/// Size of EFI_IMAGE_BASE_RELOCATION.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_BASE_RELOCATION  8\r
 \r
@@ -575,6 +493,8 @@ typedef struct {
 #define EFI_IMAGE_REL_BASED_HIGHLOW         3\r
 #define EFI_IMAGE_REL_BASED_HIGHADJ         4\r
 #define EFI_IMAGE_REL_BASED_MIPS_JMPADDR    5\r
+#define EFI_IMAGE_REL_BASED_ARM_MOV32A      5\r
+#define EFI_IMAGE_REL_BASED_ARM_MOV32T      7\r
 #define EFI_IMAGE_REL_BASED_IA64_IMM64      9\r
 #define EFI_IMAGE_REL_BASED_MIPS_JMPADDR16  9\r
 #define EFI_IMAGE_REL_BASED_DIR64           10\r
@@ -584,14 +504,14 @@ typedef struct {
 ///\r
 typedef struct {\r
   union {\r
-    UINT32  SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.\r
-    UINT32  VirtualAddress;   // Virtual address of line number.\r
+    UINT32  SymbolTableIndex; ///< Symbol table index of function name if Linenumber is 0.\r
+    UINT32  VirtualAddress;   ///< Virtual address of line number.\r
   } Type;\r
-  UINT16  Linenumber;         // Line number.\r
+  UINT16  Linenumber;         ///< Line number.\r
 } EFI_IMAGE_LINENUMBER;\r
 \r
 ///\r
-/// Size of EFI_IMAGE_LINENUMBER\r
+/// Size of EFI_IMAGE_LINENUMBER.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_LINENUMBER 6\r
 \r
@@ -615,11 +535,11 @@ typedef struct {
   UINT8 GroupID[6];   ///< File member group id - decimal.\r
   UINT8 Mode[8];      ///< File member mode - octal.\r
   UINT8 Size[10];     ///< File member size - decimal.\r
-  UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A)\r
+  UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A).\r
 } EFI_IMAGE_ARCHIVE_MEMBER_HEADER;\r
 \r
 ///\r
-/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER\r
+/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER.\r
 ///\r
 #define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60\r
 \r
@@ -629,7 +549,7 @@ typedef struct {
 //\r
 \r
 ///\r
-/// Export Directory Table\r
+/// Export Directory Table.\r
 ///\r
 typedef struct {\r
   UINT32  Characteristics;\r
@@ -646,7 +566,7 @@ typedef struct {
 } EFI_IMAGE_EXPORT_DIRECTORY;\r
 \r
 ///\r
-/// Hint/Name Table\r
+/// Hint/Name Table.\r
 ///\r
 typedef struct {\r
   UINT16  Hint;\r
@@ -654,7 +574,7 @@ typedef struct {
 } EFI_IMAGE_IMPORT_BY_NAME;\r
 \r
 ///\r
-/// Import Address Table RVA (Thunk Table)\r
+/// Import Address Table RVA (Thunk Table).\r
 ///\r
 typedef struct {\r
   union {\r
@@ -664,7 +584,7 @@ typedef struct {
   } u1;\r
 } EFI_IMAGE_THUNK_DATA;\r
 \r
-#define EFI_IMAGE_ORDINAL_FLAG              BIT31    ///< Flag for PE32\r
+#define EFI_IMAGE_ORDINAL_FLAG              BIT31    ///< Flag for PE32.\r
 #define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal)  ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)\r
 #define EFI_IMAGE_ORDINAL(Ordinal)          (Ordinal & 0xffff)\r
 \r
@@ -681,7 +601,7 @@ typedef struct {
 \r
 \r
 ///\r
-/// Debug Direcotry Format\r
+/// Debug Directory Format.\r
 ///\r
 typedef struct {\r
   UINT32  Characteristics;\r
@@ -690,14 +610,14 @@ typedef struct {
   UINT16  MinorVersion;\r
   UINT32  Type;\r
   UINT32  SizeOfData;\r
-  UINT32  RVA;           ///< The address of the debug data when loaded, relative to the image base\r
-  UINT32  FileOffset;    ///< The file pointer to the debug data\r
+  UINT32  RVA;           ///< The address of the debug data when loaded, relative to the image base.\r
+  UINT32  FileOffset;    ///< The file pointer to the debug data.\r
 } EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;\r
 \r
-#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2     ///< The Visual C++ debug information\r
+#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2     ///< The Visual C++ debug information.\r
 \r
 ///\r
-/// Debug Data Structure defined in Microsoft C++\r
+/// Debug Data Structure defined in Microsoft C++.\r
 ///\r
 #define CODEVIEW_SIGNATURE_NB10  SIGNATURE_32('N', 'B', '1', '0')\r
 typedef struct {\r
@@ -711,11 +631,11 @@ typedef struct {
 } EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;\r
 \r
 ///\r
-/// Debug Data Structure defined in Microsoft C++\r
+/// Debug Data Structure defined in Microsoft C++.\r
 ///\r
 #define CODEVIEW_SIGNATURE_RSDS  SIGNATURE_32('R', 'S', 'D', 'S')\r
 typedef struct {\r
-  UINT32  Signature;                        ///< "RSDS"\r
+  UINT32  Signature;                        ///< "RSDS".\r
   UINT32  Unknown;\r
   UINT32  Unknown2;\r
   UINT32  Unknown3;\r
@@ -726,19 +646,85 @@ typedef struct {
   //\r
 } EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;\r
 \r
+\r
+///\r
+/// Debug Data Structure defined by Apple Mach-O to Coff utility.\r
+///\r
+#define CODEVIEW_SIGNATURE_MTOC  SIGNATURE_32('M', 'T', 'O', 'C')\r
+typedef struct {\r
+  UINT32    Signature;                       ///< "MTOC".\r
+  GUID      MachOUuid;\r
+  //\r
+  //  Filename of .DLL (Mach-O with debug info) goes here\r
+  //\r
+} EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY;\r
+\r
+///\r
+/// Resource format.\r
+///\r
+typedef struct {\r
+  UINT32  Characteristics;\r
+  UINT32  TimeDateStamp;\r
+  UINT16  MajorVersion;\r
+  UINT16  MinorVersion;\r
+  UINT16  NumberOfNamedEntries;\r
+  UINT16  NumberOfIdEntries;\r
+  //\r
+  // Array of EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY entries goes here.\r
+  //\r
+} EFI_IMAGE_RESOURCE_DIRECTORY;\r
+\r
+///\r
+/// Resource directory entry format.\r
+///\r
+typedef struct {\r
+  union {\r
+    struct {\r
+      UINT32  NameOffset:31;\r
+      UINT32  NameIsString:1;\r
+    } s;\r
+    UINT32  Id;\r
+  } u1;\r
+  union {\r
+    UINT32  OffsetToData;\r
+    struct {\r
+      UINT32  OffsetToDirectory:31;\r
+      UINT32  DataIsDirectory:1;\r
+    } s;\r
+  } u2;\r
+} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;\r
+\r
+///\r
+/// Resource directory entry for string.\r
+///\r
+typedef struct {\r
+  UINT16  Length;\r
+  CHAR16  String[1];\r
+} EFI_IMAGE_RESOURCE_DIRECTORY_STRING;\r
+\r
+///\r
+/// Resource directory entry for data array.\r
+///\r
+typedef struct {\r
+  UINT32  OffsetToData;\r
+  UINT32  Size;\r
+  UINT32  CodePage;\r
+  UINT32  Reserved;\r
+} EFI_IMAGE_RESOURCE_DATA_ENTRY;\r
+\r
 ///\r
-/// Header format for TE images, defined in PI Specification, 1.0\r
+/// Header format for TE images, defined in the PI Specification, 1.0.\r
 ///\r
 typedef struct {\r
-  UINT16                    Signature;            ///< signature for TE format = "VZ"\r
-  UINT16                    Machine;              ///< from the original file header\r
-  UINT8                     NumberOfSections;     ///< from the original file header\r
-  UINT8                     Subsystem;            ///< from original optional header\r
-  UINT16                    StrippedSize;         ///< how many bytes we removed from the header\r
-  UINT32                    AddressOfEntryPoint;  ///< offset to entry point -- from original optional header\r
-  UINT32                    BaseOfCode;           ///< from original image -- required for ITP debug\r
-  UINT64                    ImageBase;            ///< from original file header\r
-  EFI_IMAGE_DATA_DIRECTORY  DataDirectory[2];     ///< only base relocation and debug directory\r
+  UINT16                    Signature;            ///< The signature for TE format = "VZ".\r
+  UINT16                    Machine;              ///< From the original file header.\r
+  UINT8                     NumberOfSections;     ///< From the original file header.\r
+  UINT8                     Subsystem;            ///< From original optional header.\r
+  UINT16                    StrippedSize;         ///< Number of bytes we removed from the header.\r
+  UINT32                    AddressOfEntryPoint;  ///< Offset to entry point -- from original optional header.\r
+  UINT32                    BaseOfCode;           ///< From original image -- required for ITP debug.\r
+  UINT64                    ImageBase;            ///< From original file header.\r
+  EFI_IMAGE_DATA_DIRECTORY  DataDirectory[2];     ///< Only base relocation and debug directory.\r
 } EFI_TE_IMAGE_HEADER;\r
 \r
 \r
@@ -752,7 +738,7 @@ typedef struct {
 \r
 \r
 ///\r
-/// Union of PE32, PE32+, and TE headers\r
+/// Union of PE32, PE32+, and TE headers.\r
 ///\r
 typedef union {\r
   EFI_IMAGE_NT_HEADERS32   Pe32;\r