/root/src/xen/xen/include/xen/cper.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * UEFI Common Platform Error Record |
3 | | * |
4 | | * Copyright (C) 2010, Intel Corp. |
5 | | * Author: Huang Ying <ying.huang@intel.com> |
6 | | * Ported by: Liu, Jinsong <jinsong.liu@intel.com> |
7 | | * |
8 | | * This program is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU General Public License version |
10 | | * 2 as published by the Free Software Foundation. |
11 | | * |
12 | | * This program is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | | * GNU General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU General Public License |
18 | | * along with this program; If not, see <http://www.gnu.org/licenses/>. |
19 | | */ |
20 | | |
21 | | #ifndef LINUX_CPER_H |
22 | | #define LINUX_CPER_H |
23 | | |
24 | | #include <xen/types.h> |
25 | | #include <xen/string.h> |
26 | | |
27 | | extern unsigned long get_sec(void); |
28 | | |
29 | | typedef struct { |
30 | | __u8 b[16]; |
31 | | } uuid_le; |
32 | | |
33 | | static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) |
34 | 0 | { |
35 | 0 | return memcmp(&u1, &u2, sizeof(uuid_le)); |
36 | 0 | } Unexecuted instantiation: ns16550.c:uuid_le_cmp Unexecuted instantiation: ehci-dbgp.c:uuid_le_cmp Unexecuted instantiation: io.c:uuid_le_cmp Unexecuted instantiation: pci.c:uuid_le_cmp Unexecuted instantiation: iommu.c:uuid_le_cmp Unexecuted instantiation: utils.c:uuid_le_cmp Unexecuted instantiation: intremap.c:uuid_le_cmp Unexecuted instantiation: quirks.c:uuid_le_cmp Unexecuted instantiation: vtd.c:uuid_le_cmp Unexecuted instantiation: iommu_init.c:uuid_le_cmp Unexecuted instantiation: pci_amd_iommu.c:uuid_le_cmp Unexecuted instantiation: iommu_intr.c:uuid_le_cmp Unexecuted instantiation: erst.c:uuid_le_cmp Unexecuted instantiation: hest.c:uuid_le_cmp Unexecuted instantiation: apei-base.c:uuid_le_cmp Unexecuted instantiation: apei-io.c:uuid_le_cmp Unexecuted instantiation: apic.c:uuid_le_cmp Unexecuted instantiation: crash.c:uuid_le_cmp Unexecuted instantiation: i8259.c:uuid_le_cmp Unexecuted instantiation: io_apic.c:uuid_le_cmp Unexecuted instantiation: msi.c:uuid_le_cmp Unexecuted instantiation: irq.c:uuid_le_cmp Unexecuted instantiation: machine_kexec.c:uuid_le_cmp Unexecuted instantiation: mm.c:uuid_le_cmp Unexecuted instantiation: mpparse.c:uuid_le_cmp Unexecuted instantiation: nmi.c:uuid_le_cmp Unexecuted instantiation: physdev.c:uuid_le_cmp Unexecuted instantiation: platform_hypercall.c:uuid_le_cmp Unexecuted instantiation: setup.c:uuid_le_cmp Unexecuted instantiation: shutdown.c:uuid_le_cmp Unexecuted instantiation: smp.c:uuid_le_cmp Unexecuted instantiation: smpboot.c:uuid_le_cmp Unexecuted instantiation: time.c:uuid_le_cmp Unexecuted instantiation: traps.c:uuid_le_cmp Unexecuted instantiation: tboot.c:uuid_le_cmp Unexecuted instantiation: hpet.c:uuid_le_cmp Unexecuted instantiation: lib.c:uuid_le_cmp Unexecuted instantiation: power.c:uuid_le_cmp Unexecuted instantiation: cpu_idle.c:uuid_le_cmp Unexecuted instantiation: amd.c:uuid_le_cmp Unexecuted instantiation: common.c:uuid_le_cmp Unexecuted instantiation: intel.c:uuid_le_cmp Unexecuted instantiation: vpmu.c:uuid_le_cmp Unexecuted instantiation: vpmu_amd.c:uuid_le_cmp Unexecuted instantiation: vpmu_intel.c:uuid_le_cmp Unexecuted instantiation: mce.c:uuid_le_cmp Unexecuted instantiation: mce-apei.c:uuid_le_cmp Unexecuted instantiation: mce_intel.c:uuid_le_cmp Unexecuted instantiation: bigsmp.c:uuid_le_cmp Unexecuted instantiation: x2apic.c:uuid_le_cmp Unexecuted instantiation: default.c:uuid_le_cmp Unexecuted instantiation: delivery.c:uuid_le_cmp Unexecuted instantiation: probe.c:uuid_le_cmp Unexecuted instantiation: hvm.c:uuid_le_cmp Unexecuted instantiation: vioapic.c:uuid_le_cmp Unexecuted instantiation: viridian.c:uuid_le_cmp Unexecuted instantiation: vlapic.c:uuid_le_cmp Unexecuted instantiation: vmsi.c:uuid_le_cmp Unexecuted instantiation: vpt.c:uuid_le_cmp Unexecuted instantiation: svm.c:uuid_le_cmp Unexecuted instantiation: vmcs.c:uuid_le_cmp Unexecuted instantiation: vmx.c:uuid_le_cmp Unexecuted instantiation: nmi_int.c:uuid_le_cmp Unexecuted instantiation: op_model_p4.c:uuid_le_cmp Unexecuted instantiation: op_model_ppro.c:uuid_le_cmp Unexecuted instantiation: op_model_athlon.c:uuid_le_cmp Unexecuted instantiation: emul-gate-op.c:uuid_le_cmp Unexecuted instantiation: emul-inv-op.c:uuid_le_cmp Unexecuted instantiation: emul-priv-op.c:uuid_le_cmp Unexecuted instantiation: acpi_mmcfg.c:uuid_le_cmp |
37 | | |
38 | | static inline u64 cper_next_record_id(void) |
39 | 0 | { |
40 | 0 | static u64 record_id; |
41 | 0 |
|
42 | 0 | if (!record_id) |
43 | 0 | record_id = (u64)get_sec() << 32; |
44 | 0 |
|
45 | 0 | return ++record_id; |
46 | 0 | } Unexecuted instantiation: ns16550.c:cper_next_record_id Unexecuted instantiation: ehci-dbgp.c:cper_next_record_id Unexecuted instantiation: io.c:cper_next_record_id Unexecuted instantiation: pci.c:cper_next_record_id Unexecuted instantiation: iommu.c:cper_next_record_id Unexecuted instantiation: utils.c:cper_next_record_id Unexecuted instantiation: intremap.c:cper_next_record_id Unexecuted instantiation: quirks.c:cper_next_record_id Unexecuted instantiation: vtd.c:cper_next_record_id Unexecuted instantiation: iommu_init.c:cper_next_record_id Unexecuted instantiation: pci_amd_iommu.c:cper_next_record_id Unexecuted instantiation: iommu_intr.c:cper_next_record_id Unexecuted instantiation: erst.c:cper_next_record_id Unexecuted instantiation: hest.c:cper_next_record_id Unexecuted instantiation: apei-base.c:cper_next_record_id Unexecuted instantiation: apei-io.c:cper_next_record_id Unexecuted instantiation: apic.c:cper_next_record_id Unexecuted instantiation: crash.c:cper_next_record_id Unexecuted instantiation: i8259.c:cper_next_record_id Unexecuted instantiation: io_apic.c:cper_next_record_id Unexecuted instantiation: msi.c:cper_next_record_id Unexecuted instantiation: irq.c:cper_next_record_id Unexecuted instantiation: machine_kexec.c:cper_next_record_id Unexecuted instantiation: mm.c:cper_next_record_id Unexecuted instantiation: mpparse.c:cper_next_record_id Unexecuted instantiation: nmi.c:cper_next_record_id Unexecuted instantiation: physdev.c:cper_next_record_id Unexecuted instantiation: platform_hypercall.c:cper_next_record_id Unexecuted instantiation: setup.c:cper_next_record_id Unexecuted instantiation: shutdown.c:cper_next_record_id Unexecuted instantiation: smp.c:cper_next_record_id Unexecuted instantiation: smpboot.c:cper_next_record_id Unexecuted instantiation: time.c:cper_next_record_id Unexecuted instantiation: traps.c:cper_next_record_id Unexecuted instantiation: tboot.c:cper_next_record_id Unexecuted instantiation: hpet.c:cper_next_record_id Unexecuted instantiation: lib.c:cper_next_record_id Unexecuted instantiation: power.c:cper_next_record_id Unexecuted instantiation: cpu_idle.c:cper_next_record_id Unexecuted instantiation: amd.c:cper_next_record_id Unexecuted instantiation: common.c:cper_next_record_id Unexecuted instantiation: intel.c:cper_next_record_id Unexecuted instantiation: vpmu.c:cper_next_record_id Unexecuted instantiation: vpmu_amd.c:cper_next_record_id Unexecuted instantiation: vpmu_intel.c:cper_next_record_id Unexecuted instantiation: mce.c:cper_next_record_id Unexecuted instantiation: mce-apei.c:cper_next_record_id Unexecuted instantiation: mce_intel.c:cper_next_record_id Unexecuted instantiation: bigsmp.c:cper_next_record_id Unexecuted instantiation: x2apic.c:cper_next_record_id Unexecuted instantiation: default.c:cper_next_record_id Unexecuted instantiation: delivery.c:cper_next_record_id Unexecuted instantiation: probe.c:cper_next_record_id Unexecuted instantiation: hvm.c:cper_next_record_id Unexecuted instantiation: vioapic.c:cper_next_record_id Unexecuted instantiation: viridian.c:cper_next_record_id Unexecuted instantiation: vlapic.c:cper_next_record_id Unexecuted instantiation: vmsi.c:cper_next_record_id Unexecuted instantiation: vpt.c:cper_next_record_id Unexecuted instantiation: svm.c:cper_next_record_id Unexecuted instantiation: vmcs.c:cper_next_record_id Unexecuted instantiation: vmx.c:cper_next_record_id Unexecuted instantiation: nmi_int.c:cper_next_record_id Unexecuted instantiation: op_model_p4.c:cper_next_record_id Unexecuted instantiation: op_model_ppro.c:cper_next_record_id Unexecuted instantiation: op_model_athlon.c:cper_next_record_id Unexecuted instantiation: emul-gate-op.c:cper_next_record_id Unexecuted instantiation: emul-inv-op.c:cper_next_record_id Unexecuted instantiation: emul-priv-op.c:cper_next_record_id Unexecuted instantiation: acpi_mmcfg.c:cper_next_record_id |
47 | | |
48 | 0 | #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ |
49 | 0 | ((uuid_le) \ |
50 | 0 | {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ |
51 | 0 | (b) & 0xff, ((b) >> 8) & 0xff, \ |
52 | 0 | (c) & 0xff, ((c) >> 8) & 0xff, \ |
53 | 0 | (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) |
54 | | |
55 | | /* CPER record signature and the size */ |
56 | | #define CPER_SIG_RECORD "CPER" |
57 | | #define CPER_SIG_SIZE 4 |
58 | | /* Used in signature_end field in struct cper_record_header */ |
59 | 0 | #define CPER_SIG_END 0xffffffff |
60 | | |
61 | | /* |
62 | | * CPER record header revision, used in revision field in struct |
63 | | * cper_record_header |
64 | | */ |
65 | 0 | #define CPER_RECORD_REV 0x0100 |
66 | | |
67 | | /* |
68 | | * Severity difinition for error_severity in struct cper_record_header |
69 | | * and section_severity in struct cper_section_descriptor |
70 | | */ |
71 | | #define CPER_SER_RECOVERABLE 0x0 |
72 | 0 | #define CPER_SER_FATAL 0x1 |
73 | | #define CPER_SER_CORRECTED 0x2 |
74 | | #define CPER_SER_INFORMATIONAL 0x3 |
75 | | |
76 | | /* |
77 | | * Notification type used to generate error record, used in |
78 | | * notification_type in struct cper_record_header |
79 | | * |
80 | | * Corrected Machine Check |
81 | | */ |
82 | | #define CPER_NOTIFY_CMC \ |
83 | | UUID_LE(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \ |
84 | | 0xEB, 0xD4, 0xF8, 0x90) |
85 | | /* Corrected Platform Error */ |
86 | | #define CPER_NOTIFY_CPE \ |
87 | | UUID_LE(0x4E292F96, 0xD843, 0x4a55, 0xA8, 0xC2, 0xD4, 0x81, \ |
88 | | 0xF2, 0x7E, 0xBE, 0xEE) |
89 | | /* Machine Check Exception */ |
90 | | #define CPER_NOTIFY_MCE \ |
91 | 0 | UUID_LE(0xE8F56FFE, 0x919C, 0x4cc5, 0xBA, 0x88, 0x65, 0xAB, \ |
92 | 0 | 0xE1, 0x49, 0x13, 0xBB) |
93 | | /* PCI Express Error */ |
94 | | #define CPER_NOTIFY_PCIE \ |
95 | | UUID_LE(0xCF93C01F, 0x1A16, 0x4dfc, 0xB8, 0xBC, 0x9C, 0x4D, \ |
96 | | 0xAF, 0x67, 0xC1, 0x04) |
97 | | /* INIT Record (for IPF) */ |
98 | | #define CPER_NOTIFY_INIT \ |
99 | | UUID_LE(0xCC5263E8, 0x9308, 0x454a, 0x89, 0xD0, 0x34, 0x0B, \ |
100 | | 0xD3, 0x9B, 0xC9, 0x8E) |
101 | | /* Non-Maskable Interrupt */ |
102 | | #define CPER_NOTIFY_NMI \ |
103 | | UUID_LE(0x5BAD89FF, 0xB7E6, 0x42c9, 0x81, 0x4A, 0xCF, 0x24, \ |
104 | | 0x85, 0xD6, 0xE9, 0x8A) |
105 | | /* BOOT Error Record */ |
106 | | #define CPER_NOTIFY_BOOT \ |
107 | | UUID_LE(0x3D61A466, 0xAB40, 0x409a, 0xA6, 0x98, 0xF3, 0x62, \ |
108 | | 0xD4, 0x64, 0xB3, 0x8F) |
109 | | /* DMA Remapping Error */ |
110 | | #define CPER_NOTIFY_DMAR \ |
111 | | UUID_LE(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \ |
112 | | 0x72, 0x2D, 0xEB, 0x41) |
113 | | |
114 | | /* |
115 | | * Flags bits definitions for flags in struct cper_record_header |
116 | | * If set, the error has been recovered |
117 | | */ |
118 | | #define CPER_HW_ERROR_FLAGS_RECOVERED 0x1 |
119 | | /* If set, the error is for previous boot */ |
120 | 0 | #define CPER_HW_ERROR_FLAGS_PREVERR 0x2 |
121 | | /* If set, the error is injected for testing */ |
122 | | #define CPER_HW_ERROR_FLAGS_SIMULATED 0x4 |
123 | | |
124 | | /* |
125 | | * CPER section header revision, used in revision field in struct |
126 | | * cper_section_descriptor |
127 | | */ |
128 | 0 | #define CPER_SEC_REV 0x0100 |
129 | | |
130 | | /* |
131 | | * Validation bits difinition for validation_bits in struct |
132 | | * cper_section_descriptor. If set, corresponding fields in struct |
133 | | * cper_section_descriptor contain valid information. |
134 | | * |
135 | | * corresponds fru_id |
136 | | */ |
137 | | #define CPER_SEC_VALID_FRU_ID 0x1 |
138 | | /* corresponds fru_text */ |
139 | | #define CPER_SEC_VALID_FRU_TEXT 0x2 |
140 | | |
141 | | /* |
142 | | * Flags bits definitions for flags in struct cper_section_descriptor |
143 | | * |
144 | | * If set, the section is associated with the error condition |
145 | | * directly, and should be focused on |
146 | | */ |
147 | 0 | #define CPER_SEC_PRIMARY 0x0001 |
148 | | |
149 | | /* |
150 | | * All tables and structs must be byte-packed to match CPER |
151 | | * specification, since the tables are provided by the system BIOS |
152 | | */ |
153 | | #pragma pack(1) |
154 | | |
155 | | struct cper_record_header { |
156 | | char signature[CPER_SIG_SIZE]; /* must be CPER_SIG_RECORD */ |
157 | | __u16 revision; /* must be CPER_RECORD_REV */ |
158 | | __u32 signature_end; /* must be CPER_SIG_END */ |
159 | | __u16 section_count; |
160 | | __u32 error_severity; |
161 | | __u32 validation_bits; |
162 | | __u32 record_length; |
163 | | __u64 timestamp; |
164 | | uuid_le platform_id; |
165 | | uuid_le partition_id; |
166 | | uuid_le creator_id; |
167 | | uuid_le notification_type; |
168 | | __u64 record_id; |
169 | | __u32 flags; |
170 | | __u64 persistence_information; |
171 | | __u8 reserved[12]; /* must be zero */ |
172 | | }; |
173 | | |
174 | | struct cper_section_descriptor { |
175 | | __u32 section_offset; /* Offset in bytes of the |
176 | | * section body from the base |
177 | | * of the record header */ |
178 | | __u32 section_length; |
179 | | __u16 revision; /* must be CPER_RECORD_REV */ |
180 | | __u8 validation_bits; |
181 | | __u8 reserved; /* must be zero */ |
182 | | __u32 flags; |
183 | | uuid_le section_type; |
184 | | uuid_le fru_id; |
185 | | __u32 section_severity; |
186 | | __u8 fru_text[20]; |
187 | | }; |
188 | | |
189 | | /* Reset to default packing */ |
190 | | #pragma pack() |
191 | | |
192 | | #endif |