2 * Copyright (c) 2002-2010 Marcel Moolenaar
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef _MACHINE_MCA_H_
30 #define _MACHINE_MCA_H_
32 struct mca_record_header {
33 uint64_t rh_seqnr; /* Record id. */
34 uint8_t rh_major; /* BCD (=02). */
35 uint8_t rh_minor; /* BCD (=00). */
36 uint8_t rh_error; /* Error severity. */
37 #define MCA_RH_ERROR_RECOVERABLE 0
38 #define MCA_RH_ERROR_FATAL 1
39 #define MCA_RH_ERROR_CORRECTED 2
41 #define MCA_RH_FLAGS_PLATFORM_ID 0x01 /* Platform_id present. */
42 #define MCA_RH_FLAGS_TIME_STAMP 0x02 /* Timestamp invalid. */
43 uint32_t rh_length; /* Size including header. */
45 #define MCA_RH_TIME_SEC 0
46 #define MCA_RH_TIME_MIN 1
47 #define MCA_RH_TIME_HOUR 2
48 #define MCA_RH_TIME_MDAY 4
49 #define MCA_RH_TIME_MON 5
50 #define MCA_RH_TIME_YEAR 6
51 #define MCA_RH_TIME_CENT 7
52 struct uuid rh_platform;
55 struct mca_section_header {
57 uint8_t sh_major; /* BCD (=02). */
58 uint8_t sh_minor; /* BCD (=00). */
60 #define MCA_SH_FLAGS_CORRECTED 0x01 /* Error has been corrected. */
61 #define MCA_SH_FLAGS_PROPAGATE 0x02 /* Possible propagation. */
62 #define MCA_SH_FLAGS_RESET 0x04 /* Reset device before use. */
63 #define MCA_SH_FLAGS_VALID 0x80 /* Flags are valid. */
65 uint32_t sh_length; /* Size including header. */
68 struct mca_cpu_record {
70 #define MCA_CPU_FLAGS_ERRMAP (1ULL << 0)
71 #define MCA_CPU_FLAGS_STATE (1ULL << 1)
72 #define MCA_CPU_FLAGS_CR_LID (1ULL << 2)
73 #define MCA_CPU_FLAGS_PSI_STRUCT (1ULL << 3)
74 #define MCA_CPU_FLAGS_CACHE(x) (((x) >> 4) & 15)
75 #define MCA_CPU_FLAGS_TLB(x) (((x) >> 8) & 15)
76 #define MCA_CPU_FLAGS_BUS(x) (((x) >> 12) & 15)
77 #define MCA_CPU_FLAGS_REG(x) (((x) >> 16) & 15)
78 #define MCA_CPU_FLAGS_MS(x) (((x) >> 20) & 15)
79 #define MCA_CPU_FLAGS_CPUID (1ULL << 24)
83 /* Nx cpu_mod (cache). */
84 /* Nx cpu_mod (TLB). */
85 /* Nx cpu_mod (bus). */
86 /* Nx cpu_mod (reg). */
87 /* Nx cpu_mod (MS). */
92 struct mca_cpu_cpuid {
97 uint64_t cpu_mod_flags;
98 #define MCA_CPU_MOD_FLAGS_INFO (1ULL << 0)
99 #define MCA_CPU_MOD_FLAGS_REQID (1ULL << 1)
100 #define MCA_CPU_MOD_FLAGS_RSPID (1ULL << 2)
101 #define MCA_CPU_MOD_FLAGS_TGTID (1ULL << 3)
102 #define MCA_CPU_MOD_FLAGS_IP (1ULL << 4)
103 uint64_t cpu_mod_info;
104 uint64_t cpu_mod_reqid;
105 uint64_t cpu_mod_rspid;
106 uint64_t cpu_mod_tgtid;
111 uint64_t cpu_psi_flags;
112 #define MCA_CPU_PSI_FLAGS_STATE (1ULL << 0)
113 #define MCA_CPU_PSI_FLAGS_BR (1ULL << 1)
114 #define MCA_CPU_PSI_FLAGS_CR (1ULL << 2)
115 #define MCA_CPU_PSI_FLAGS_AR (1ULL << 3)
116 #define MCA_CPU_PSI_FLAGS_RR (1ULL << 4)
117 #define MCA_CPU_PSI_FLAGS_FR (1ULL << 5)
118 uint8_t cpu_psi_state[1024]; /* XXX variable? */
119 uint64_t cpu_psi_br[8];
120 uint64_t cpu_psi_cr[128]; /* XXX variable? */
121 uint64_t cpu_psi_ar[128]; /* XXX variable? */
122 uint64_t cpu_psi_rr[8];
123 uint64_t cpu_psi_fr[256]; /* 16 bytes per register! */
126 struct mca_mem_record {
128 #define MCA_MEM_FLAGS_STATUS (1ULL << 0)
129 #define MCA_MEM_FLAGS_ADDR (1ULL << 1)
130 #define MCA_MEM_FLAGS_ADDRMASK (1ULL << 2)
131 #define MCA_MEM_FLAGS_NODE (1ULL << 3)
132 #define MCA_MEM_FLAGS_CARD (1ULL << 4)
133 #define MCA_MEM_FLAGS_MODULE (1ULL << 5)
134 #define MCA_MEM_FLAGS_BANK (1ULL << 6)
135 #define MCA_MEM_FLAGS_DEVICE (1ULL << 7)
136 #define MCA_MEM_FLAGS_ROW (1ULL << 8)
137 #define MCA_MEM_FLAGS_COLUMN (1ULL << 9)
138 #define MCA_MEM_FLAGS_BITPOS (1ULL << 10)
139 #define MCA_MEM_FLAGS_REQID (1ULL << 11)
140 #define MCA_MEM_FLAGS_RSPID (1ULL << 12)
141 #define MCA_MEM_FLAGS_TGTID (1ULL << 13)
142 #define MCA_MEM_FLAGS_BUSDATA (1ULL << 14)
143 #define MCA_MEM_FLAGS_OEM_ID (1ULL << 15)
144 #define MCA_MEM_FLAGS_OEM_DATA (1ULL << 16)
147 uint64_t mem_addrmask;
159 uint64_t mem_busdata;
160 struct uuid mem_oem_id;
161 uint16_t mem_oem_length; /* Size of OEM data. */
162 /* N bytes of OEM platform data. */
165 struct mca_pcibus_record {
166 uint64_t pcibus_flags;
167 #define MCA_PCIBUS_FLAGS_STATUS (1ULL << 0)
168 #define MCA_PCIBUS_FLAGS_ERROR (1ULL << 1)
169 #define MCA_PCIBUS_FLAGS_BUS (1ULL << 2)
170 #define MCA_PCIBUS_FLAGS_ADDR (1ULL << 3)
171 #define MCA_PCIBUS_FLAGS_DATA (1ULL << 4)
172 #define MCA_PCIBUS_FLAGS_CMD (1ULL << 5)
173 #define MCA_PCIBUS_FLAGS_REQID (1ULL << 6)
174 #define MCA_PCIBUS_FLAGS_RSPID (1ULL << 7)
175 #define MCA_PCIBUS_FLAGS_TGTID (1ULL << 8)
176 #define MCA_PCIBUS_FLAGS_OEM_ID (1ULL << 9)
177 #define MCA_PCIBUS_FLAGS_OEM_DATA (1ULL << 10)
178 uint64_t pcibus_status;
179 uint16_t pcibus_error;
182 uint64_t pcibus_addr;
183 uint64_t pcibus_data;
185 uint64_t pcibus_reqid;
186 uint64_t pcibus_rspid;
187 uint64_t pcibus_tgtid;
188 struct uuid pcibus_oem_id;
189 uint16_t pcibus_oem_length; /* Size of OEM data. */
190 /* N bytes of OEM platform data. */
193 struct mca_pcidev_record {
194 uint64_t pcidev_flags;
195 #define MCA_PCIDEV_FLAGS_STATUS (1ULL << 0)
196 #define MCA_PCIDEV_FLAGS_INFO (1ULL << 1)
197 #define MCA_PCIDEV_FLAGS_REG_MEM (1ULL << 2)
198 #define MCA_PCIDEV_FLAGS_REG_IO (1ULL << 3)
199 #define MCA_PCIDEV_FLAGS_REG_DATA (1ULL << 4)
200 #define MCA_PCIDEV_FLAGS_OEM_DATA (1ULL << 5)
201 uint64_t pcidev_status;
203 uint16_t info_vendor;
204 uint16_t info_device;
205 uint32_t info_ccfn; /* Class code & funct. nr. */
206 #define MCA_PCIDEV_INFO_CLASS(x) ((x) & 0xffffff)
207 #define MCA_PCIDEV_INFO_FUNCTION(x) (((x) >> 24) & 0xff)
210 uint8_t info_segment;
214 uint32_t pcidev_reg_mem;
215 uint32_t pcidev_reg_io;
217 /* M bytes of OEM platform data. */
220 struct mca_pcidev_reg {
221 uint64_t pcidev_reg_addr;
222 uint64_t pcidev_reg_data;
225 #define MCA_UUID_CPU \
226 {0xe429faf1,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
227 #define MCA_UUID_MEMORY \
228 {0xe429faf2,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
229 #define MCA_UUID_SEL \
230 {0xe429faf3,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
231 #define MCA_UUID_PCI_BUS \
232 {0xe429faf4,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
233 #define MCA_UUID_SMBIOS \
234 {0xe429faf5,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
235 #define MCA_UUID_PCI_DEV \
236 {0xe429faf6,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
237 #define MCA_UUID_GENERIC \
238 {0xe429faf7,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
242 void ia64_mca_init(void);
243 void ia64_mca_init_ap(void);
244 void ia64_mca_save_state(int);
248 #endif /* _MACHINE_MCA_H_ */