cper.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /*
  2. * UEFI Common Platform Error Record
  3. *
  4. * Copyright (C) 2010, Intel Corp.
  5. * Author: Huang Ying <ying.huang@intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License version
  9. * 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef LINUX_CPER_H
  21. #define LINUX_CPER_H
  22. #include <linux/uuid.h>
  23. /* CPER record signature and the size */
  24. #define CPER_SIG_RECORD "CPER"
  25. #define CPER_SIG_SIZE 4
  26. /* Used in signature_end field in struct cper_record_header */
  27. #define CPER_SIG_END 0xffffffff
  28. /*
  29. * CPER record header revision, used in revision field in struct
  30. * cper_record_header
  31. */
  32. #define CPER_RECORD_REV 0x0100
  33. /*
  34. * Severity difinition for error_severity in struct cper_record_header
  35. * and section_severity in struct cper_section_descriptor
  36. */
  37. #define CPER_SER_RECOVERABLE 0x0
  38. #define CPER_SER_FATAL 0x1
  39. #define CPER_SER_CORRECTED 0x2
  40. #define CPER_SER_INFORMATIONAL 0x3
  41. /*
  42. * Validation bits difinition for validation_bits in struct
  43. * cper_record_header. If set, corresponding fields in struct
  44. * cper_record_header contain valid information.
  45. *
  46. * corresponds platform_id
  47. */
  48. #define CPER_VALID_PLATFORM_ID 0x0001
  49. /* corresponds timestamp */
  50. #define CPER_VALID_TIMESTAMP 0x0002
  51. /* corresponds partition_id */
  52. #define CPER_VALID_PARTITION_ID 0x0004
  53. /*
  54. * Notification type used to generate error record, used in
  55. * notification_type in struct cper_record_header
  56. *
  57. * Corrected Machine Check
  58. */
  59. #define CPER_NOTIFY_CMC \
  60. UUID_LE(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \
  61. 0xEB, 0xD4, 0xF8, 0x90)
  62. /* Corrected Platform Error */
  63. #define CPER_NOTIFY_CPE \
  64. UUID_LE(0x4E292F96, 0xD843, 0x4a55, 0xA8, 0xC2, 0xD4, 0x81, \
  65. 0xF2, 0x7E, 0xBE, 0xEE)
  66. /* Machine Check Exception */
  67. #define CPER_NOTIFY_MCE \
  68. UUID_LE(0xE8F56FFE, 0x919C, 0x4cc5, 0xBA, 0x88, 0x65, 0xAB, \
  69. 0xE1, 0x49, 0x13, 0xBB)
  70. /* PCI Express Error */
  71. #define CPER_NOTIFY_PCIE \
  72. UUID_LE(0xCF93C01F, 0x1A16, 0x4dfc, 0xB8, 0xBC, 0x9C, 0x4D, \
  73. 0xAF, 0x67, 0xC1, 0x04)
  74. /* INIT Record (for IPF) */
  75. #define CPER_NOTIFY_INIT \
  76. UUID_LE(0xCC5263E8, 0x9308, 0x454a, 0x89, 0xD0, 0x34, 0x0B, \
  77. 0xD3, 0x9B, 0xC9, 0x8E)
  78. /* Non-Maskable Interrupt */
  79. #define CPER_NOTIFY_NMI \
  80. UUID_LE(0x5BAD89FF, 0xB7E6, 0x42c9, 0x81, 0x4A, 0xCF, 0x24, \
  81. 0x85, 0xD6, 0xE9, 0x8A)
  82. /* BOOT Error Record */
  83. #define CPER_NOTIFY_BOOT \
  84. UUID_LE(0x3D61A466, 0xAB40, 0x409a, 0xA6, 0x98, 0xF3, 0x62, \
  85. 0xD4, 0x64, 0xB3, 0x8F)
  86. /* DMA Remapping Error */
  87. #define CPER_NOTIFY_DMAR \
  88. UUID_LE(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \
  89. 0x72, 0x2D, 0xEB, 0x41)
  90. /*
  91. * Flags bits definitions for flags in struct cper_record_header
  92. * If set, the error has been recovered
  93. */
  94. #define CPER_HW_ERROR_FLAGS_RECOVERED 0x1
  95. /* If set, the error is for previous boot */
  96. #define CPER_HW_ERROR_FLAGS_PREVERR 0x2
  97. /* If set, the error is injected for testing */
  98. #define CPER_HW_ERROR_FLAGS_SIMULATED 0x4
  99. /*
  100. * CPER section header revision, used in revision field in struct
  101. * cper_section_descriptor
  102. */
  103. #define CPER_SEC_REV 0x0100
  104. /*
  105. * Validation bits difinition for validation_bits in struct
  106. * cper_section_descriptor. If set, corresponding fields in struct
  107. * cper_section_descriptor contain valid information.
  108. *
  109. * corresponds fru_id
  110. */
  111. #define CPER_SEC_VALID_FRU_ID 0x1
  112. /* corresponds fru_text */
  113. #define CPER_SEC_VALID_FRU_TEXT 0x2
  114. /*
  115. * Flags bits definitions for flags in struct cper_section_descriptor
  116. *
  117. * If set, the section is associated with the error condition
  118. * directly, and should be focused on
  119. */
  120. #define CPER_SEC_PRIMARY 0x0001
  121. /*
  122. * If set, the error was not contained within the processor or memory
  123. * hierarchy and the error may have propagated to persistent storage
  124. * or network
  125. */
  126. #define CPER_SEC_CONTAINMENT_WARNING 0x0002
  127. /* If set, the component must be re-initialized or re-enabled prior to use */
  128. #define CPER_SEC_RESET 0x0004
  129. /* If set, Linux may choose to discontinue use of the resource */
  130. #define CPER_SEC_ERROR_THRESHOLD_EXCEEDED 0x0008
  131. /*
  132. * If set, resource could not be queried for error information due to
  133. * conflicts with other system software or resources. Some fields of
  134. * the section will be invalid
  135. */
  136. #define CPER_SEC_RESOURCE_NOT_ACCESSIBLE 0x0010
  137. /*
  138. * If set, action has been taken to ensure error containment (such as
  139. * poisoning data), but the error has not been fully corrected and the
  140. * data has not been consumed. Linux may choose to take further
  141. * corrective action before the data is consumed
  142. */
  143. #define CPER_SEC_LATENT_ERROR 0x0020
  144. /*
  145. * Section type definitions, used in section_type field in struct
  146. * cper_section_descriptor
  147. *
  148. * Processor Generic
  149. */
  150. #define CPER_SEC_PROC_GENERIC \
  151. UUID_LE(0x9876CCAD, 0x47B4, 0x4bdb, 0xB6, 0x5E, 0x16, 0xF1, \
  152. 0x93, 0xC4, 0xF3, 0xDB)
  153. /* Processor Specific: X86/X86_64 */
  154. #define CPER_SEC_PROC_IA \
  155. UUID_LE(0xDC3EA0B0, 0xA144, 0x4797, 0xB9, 0x5B, 0x53, 0xFA, \
  156. 0x24, 0x2B, 0x6E, 0x1D)
  157. /* Processor Specific: IA64 */
  158. #define CPER_SEC_PROC_IPF \
  159. UUID_LE(0xE429FAF1, 0x3CB7, 0x11D4, 0x0B, 0xCA, 0x07, 0x00, \
  160. 0x80, 0xC7, 0x3C, 0x88, 0x81)
  161. /* Platform Memory */
  162. #define CPER_SEC_PLATFORM_MEM \
  163. UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \
  164. 0xED, 0x7C, 0x83, 0xB1)
  165. #define CPER_SEC_PCIE \
  166. UUID_LE(0xD995E954, 0xBBC1, 0x430F, 0xAD, 0x91, 0xB4, 0x4D, \
  167. 0xCB, 0x3C, 0x6F, 0x35)
  168. /* Firmware Error Record Reference */
  169. #define CPER_SEC_FW_ERR_REC_REF \
  170. UUID_LE(0x81212A96, 0x09ED, 0x4996, 0x94, 0x71, 0x8D, 0x72, \
  171. 0x9C, 0x8E, 0x69, 0xED)
  172. /* PCI/PCI-X Bus */
  173. #define CPER_SEC_PCI_X_BUS \
  174. UUID_LE(0xC5753963, 0x3B84, 0x4095, 0xBF, 0x78, 0xED, 0xDA, \
  175. 0xD3, 0xF9, 0xC9, 0xDD)
  176. /* PCI Component/Device */
  177. #define CPER_SEC_PCI_DEV \
  178. UUID_LE(0xEB5E4685, 0xCA66, 0x4769, 0xB6, 0xA2, 0x26, 0x06, \
  179. 0x8B, 0x00, 0x13, 0x26)
  180. #define CPER_SEC_DMAR_GENERIC \
  181. UUID_LE(0x5B51FEF7, 0xC79D, 0x4434, 0x8F, 0x1B, 0xAA, 0x62, \
  182. 0xDE, 0x3E, 0x2C, 0x64)
  183. /* Intel VT for Directed I/O specific DMAr */
  184. #define CPER_SEC_DMAR_VT \
  185. UUID_LE(0x71761D37, 0x32B2, 0x45cd, 0xA7, 0xD0, 0xB0, 0xFE, \
  186. 0xDD, 0x93, 0xE8, 0xCF)
  187. /* IOMMU specific DMAr */
  188. #define CPER_SEC_DMAR_IOMMU \
  189. UUID_LE(0x036F84E1, 0x7F37, 0x428c, 0xA7, 0x9E, 0x57, 0x5F, \
  190. 0xDF, 0xAA, 0x84, 0xEC)
  191. /*
  192. * All tables and structs must be byte-packed to match CPER
  193. * specification, since the tables are provided by the system BIOS
  194. */
  195. #pragma pack(1)
  196. struct cper_record_header {
  197. char signature[CPER_SIG_SIZE]; /* must be CPER_SIG_RECORD */
  198. __u16 revision; /* must be CPER_RECORD_REV */
  199. __u32 signature_end; /* must be CPER_SIG_END */
  200. __u16 section_count;
  201. __u32 error_severity;
  202. __u32 validation_bits;
  203. __u32 record_length;
  204. __u64 timestamp;
  205. uuid_le platform_id;
  206. uuid_le partition_id;
  207. uuid_le creator_id;
  208. uuid_le notification_type;
  209. __u64 record_id;
  210. __u32 flags;
  211. __u64 persistence_information;
  212. __u8 reserved[12]; /* must be zero */
  213. };
  214. struct cper_section_descriptor {
  215. __u32 section_offset; /* Offset in bytes of the
  216. * section body from the base
  217. * of the record header */
  218. __u32 section_length;
  219. __u16 revision; /* must be CPER_RECORD_REV */
  220. __u8 validation_bits;
  221. __u8 reserved; /* must be zero */
  222. __u32 flags;
  223. uuid_le section_type;
  224. uuid_le fru_id;
  225. __u32 section_severity;
  226. __u8 fru_text[20];
  227. };
  228. /* Generic Processor Error Section */
  229. struct cper_sec_proc_generic {
  230. __u64 validation_bits;
  231. __u8 proc_type;
  232. __u8 proc_isa;
  233. __u8 proc_error_type;
  234. __u8 operation;
  235. __u8 flags;
  236. __u8 level;
  237. __u16 reserved;
  238. __u64 cpu_version;
  239. char cpu_brand[128];
  240. __u64 proc_id;
  241. __u64 target_addr;
  242. __u64 requestor_id;
  243. __u64 responder_id;
  244. __u64 ip;
  245. };
  246. /* IA32/X64 Processor Error Section */
  247. struct cper_sec_proc_ia {
  248. __u64 validation_bits;
  249. __u8 lapic_id;
  250. __u8 cpuid[48];
  251. };
  252. /* IA32/X64 Processor Error Infomation Structure */
  253. struct cper_ia_err_info {
  254. uuid_le err_type;
  255. __u64 validation_bits;
  256. __u64 check_info;
  257. __u64 target_id;
  258. __u64 requestor_id;
  259. __u64 responder_id;
  260. __u64 ip;
  261. };
  262. /* IA32/X64 Processor Context Information Structure */
  263. struct cper_ia_proc_ctx {
  264. __u16 reg_ctx_type;
  265. __u16 reg_arr_size;
  266. __u32 msr_addr;
  267. __u64 mm_reg_addr;
  268. };
  269. /* Memory Error Section */
  270. struct cper_sec_mem_err {
  271. __u64 validation_bits;
  272. __u64 error_status;
  273. __u64 physical_addr;
  274. __u64 physical_addr_mask;
  275. __u16 node;
  276. __u16 card;
  277. __u16 module;
  278. __u16 bank;
  279. __u16 device;
  280. __u16 row;
  281. __u16 column;
  282. __u16 bit_pos;
  283. __u64 requestor_id;
  284. __u64 responder_id;
  285. __u64 target_id;
  286. __u8 error_type;
  287. };
  288. /* Reset to default packing */
  289. #pragma pack()
  290. u64 cper_next_record_id(void);
  291. #endif