1/* 2 * linux/arch/alpha/kernel/err_ev6.c 3 * 4 * Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation) 5 * 6 * Error handling code supporting Alpha systems 7 */ 8 9#include <linux/sched.h> 10 11#include <asm/io.h> 12#include <asm/irq_regs.h> 13#include <asm/hwrpb.h> 14#include <asm/smp.h> 15#include <asm/err_common.h> 16#include <asm/err_ev6.h> 17 18#include "err_impl.h" 19#include "proto.h" 20 21static int 22ev6_parse_ibox(u64 i_stat, int print) 23{ 24 int status = MCHK_DISPOSITION_REPORT; 25 26#define EV6__I_STAT__PAR (1UL << 29) 27#define EV6__I_STAT__ERRMASK (EV6__I_STAT__PAR) 28 29 if (!(i_stat & EV6__I_STAT__ERRMASK)) 30 return MCHK_DISPOSITION_UNKNOWN_ERROR; 31 32 if (!print) 33 return status; 34 35 if (i_stat & EV6__I_STAT__PAR) 36 printk("%s Icache parity error\n", err_print_prefix); 37 38 return status; 39} 40 41static int 42ev6_parse_mbox(u64 mm_stat, u64 d_stat, u64 c_stat, int print) 43{ 44 int status = MCHK_DISPOSITION_REPORT; 45 46#define EV6__MM_STAT__DC_TAG_PERR (1UL << 10) 47#define EV6__MM_STAT__ERRMASK (EV6__MM_STAT__DC_TAG_PERR) 48#define EV6__D_STAT__TPERR_P0 (1UL << 0) 49#define EV6__D_STAT__TPERR_P1 (1UL << 1) 50#define EV6__D_STAT__ECC_ERR_ST (1UL << 2) 51#define EV6__D_STAT__ECC_ERR_LD (1UL << 3) 52#define EV6__D_STAT__SEO (1UL << 4) 53#define EV6__D_STAT__ERRMASK (EV6__D_STAT__TPERR_P0 | \ 54 EV6__D_STAT__TPERR_P1 | \ 55 EV6__D_STAT__ECC_ERR_ST | \ 56 EV6__D_STAT__ECC_ERR_LD | \ 57 EV6__D_STAT__SEO) 58 59 if (!(d_stat & EV6__D_STAT__ERRMASK) && 60 !(mm_stat & EV6__MM_STAT__ERRMASK)) 61 return MCHK_DISPOSITION_UNKNOWN_ERROR; 62 63 if (!print) 64 return status; 65 66 if (mm_stat & EV6__MM_STAT__DC_TAG_PERR) 67 printk("%s Dcache tag parity error on probe\n", 68 err_print_prefix); 69 if (d_stat & EV6__D_STAT__TPERR_P0) 70 printk("%s Dcache tag parity error - pipe 0\n", 71 err_print_prefix); 72 if (d_stat & EV6__D_STAT__TPERR_P1) 73 printk("%s Dcache tag parity error - pipe 1\n", 74 err_print_prefix); 75 if (d_stat & EV6__D_STAT__ECC_ERR_ST) 76 printk("%s ECC error occurred on a store\n", 77 err_print_prefix); 78 if (d_stat & EV6__D_STAT__ECC_ERR_LD) 79 printk("%s ECC error occurred on a %s load\n", 80 err_print_prefix, 81 c_stat ? "" : "speculative "); 82 if (d_stat & EV6__D_STAT__SEO) 83 printk("%s Dcache second error\n", err_print_prefix); 84 85 return status; 86} 87 88static int 89ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn, 90 u64 c_stat, u64 c_sts, int print) 91{ 92 static const char * const sourcename[] = { 93 "UNKNOWN", "UNKNOWN", "UNKNOWN", 94 "MEMORY", "BCACHE", "DCACHE", 95 "BCACHE PROBE", "BCACHE PROBE" 96 }; 97 static const char * const streamname[] = { "D", "I" }; 98 static const char * const bitsname[] = { "SINGLE", "DOUBLE" }; 99 int status = MCHK_DISPOSITION_REPORT; 100 int source = -1, stream = -1, bits = -1; 101 102#define EV6__C_STAT__BC_PERR (0x01) 103#define EV6__C_STAT__DC_PERR (0x02) 104#define EV6__C_STAT__DSTREAM_MEM_ERR (0x03) 105#define EV6__C_STAT__DSTREAM_BC_ERR (0x04) 106#define EV6__C_STAT__DSTREAM_DC_ERR (0x05) 107#define EV6__C_STAT__PROBE_BC_ERR0 (0x06) /* both 6 and 7 indicate... */ 108#define EV6__C_STAT__PROBE_BC_ERR1 (0x07) /* ...probe bc error. */ 109#define EV6__C_STAT__ISTREAM_MEM_ERR (0x0B) 110#define EV6__C_STAT__ISTREAM_BC_ERR (0x0C) 111#define EV6__C_STAT__DSTREAM_MEM_DBL (0x13) 112#define EV6__C_STAT__DSTREAM_BC_DBL (0x14) 113#define EV6__C_STAT__ISTREAM_MEM_DBL (0x1B) 114#define EV6__C_STAT__ISTREAM_BC_DBL (0x1C) 115#define EV6__C_STAT__SOURCE_MEMORY (0x03) 116#define EV6__C_STAT__SOURCE_BCACHE (0x04) 117#define EV6__C_STAT__SOURCE__S (0) 118#define EV6__C_STAT__SOURCE__M (0x07) 119#define EV6__C_STAT__ISTREAM__S (3) 120#define EV6__C_STAT__ISTREAM__M (0x01) 121#define EV6__C_STAT__DOUBLE__S (4) 122#define EV6__C_STAT__DOUBLE__M (0x01) 123#define EV6__C_STAT__ERRMASK (0x1F) 124#define EV6__C_STS__SHARED (1 << 0) 125#define EV6__C_STS__DIRTY (1 << 1) 126#define EV6__C_STS__VALID (1 << 2) 127#define EV6__C_STS__PARITY (1 << 3) 128 129 if (!(c_stat & EV6__C_STAT__ERRMASK)) 130 return MCHK_DISPOSITION_UNKNOWN_ERROR; 131 132 if (!print) 133 return status; 134 135 source = EXTRACT(c_stat, EV6__C_STAT__SOURCE); 136 stream = EXTRACT(c_stat, EV6__C_STAT__ISTREAM); 137 bits = EXTRACT(c_stat, EV6__C_STAT__DOUBLE); 138 139 if (c_stat & EV6__C_STAT__BC_PERR) { 140 printk("%s Bcache tag parity error\n", err_print_prefix); 141 source = -1; 142 } 143 144 if (c_stat & EV6__C_STAT__DC_PERR) { 145 printk("%s Dcache tag parity error\n", err_print_prefix); 146 source = -1; 147 } 148 149 if (c_stat == EV6__C_STAT__PROBE_BC_ERR0 || 150 c_stat == EV6__C_STAT__PROBE_BC_ERR1) { 151 printk("%s Bcache single-bit error on a probe hit\n", 152 err_print_prefix); 153 source = -1; 154 } 155 156 if (source != -1) 157 printk("%s %s-STREAM %s-BIT ECC error from %s\n", 158 err_print_prefix, 159 streamname[stream], bitsname[bits], sourcename[source]); 160 161 printk("%s Address: 0x%016llx\n" 162 " Syndrome[upper.lower]: %02llx.%02llx\n", 163 err_print_prefix, 164 c_addr, 165 c2_syn, c1_syn); 166 167 if (source == EV6__C_STAT__SOURCE_MEMORY || 168 source == EV6__C_STAT__SOURCE_BCACHE) 169 printk("%s Block status: %s%s%s%s\n", 170 err_print_prefix, 171 (c_sts & EV6__C_STS__SHARED) ? "SHARED " : "", 172 (c_sts & EV6__C_STS__DIRTY) ? "DIRTY " : "", 173 (c_sts & EV6__C_STS__VALID) ? "VALID " : "", 174 (c_sts & EV6__C_STS__PARITY) ? "PARITY " : ""); 175 176 return status; 177} 178 179void 180ev6_register_error_handlers(void) 181{ 182 /* None right now. */ 183} 184 185int 186ev6_process_logout_frame(struct el_common *mchk_header, int print) 187{ 188 struct el_common_EV6_mcheck *ev6mchk = 189 (struct el_common_EV6_mcheck *)mchk_header; 190 int status = MCHK_DISPOSITION_UNKNOWN_ERROR; 191 192 status |= ev6_parse_ibox(ev6mchk->I_STAT, print); 193 status |= ev6_parse_mbox(ev6mchk->MM_STAT, ev6mchk->DC_STAT, 194 ev6mchk->C_STAT, print); 195 status |= ev6_parse_cbox(ev6mchk->C_ADDR, ev6mchk->DC1_SYNDROME, 196 ev6mchk->DC0_SYNDROME, ev6mchk->C_STAT, 197 ev6mchk->C_STS, print); 198 199 if (!print) 200 return status; 201 202 if (status != MCHK_DISPOSITION_DISMISS) { 203 char *saved_err_prefix = err_print_prefix; 204 205 /* 206 * Dump some additional information from the frame 207 */ 208 printk("%s EXC_ADDR: 0x%016lx IER_CM: 0x%016lx" 209 " ISUM: 0x%016lx\n" 210 " PAL_BASE: 0x%016lx I_CTL: 0x%016lx" 211 " PCTX: 0x%016lx\n", 212 err_print_prefix, 213 ev6mchk->EXC_ADDR, ev6mchk->IER_CM, ev6mchk->ISUM, 214 ev6mchk->PAL_BASE, ev6mchk->I_CTL, ev6mchk->PCTX); 215 216 if (status == MCHK_DISPOSITION_UNKNOWN_ERROR) { 217 printk("%s UNKNOWN error, frame follows:\n", 218 err_print_prefix); 219 } else { 220 /* had decode -- downgrade print level for frame */ 221 err_print_prefix = KERN_NOTICE; 222 } 223 224 mchk_dump_logout_frame(mchk_header); 225 226 err_print_prefix = saved_err_prefix; 227 } 228 229 return status; 230} 231 232void 233ev6_machine_check(unsigned long vector, unsigned long la_ptr) 234{ 235 struct el_common *mchk_header = (struct el_common *)la_ptr; 236 237 /* 238 * Sync the processor 239 */ 240 mb(); 241 draina(); 242 243 /* 244 * Parse the logout frame without printing first. If the only error(s) 245 * found are have a disposition of "dismiss", then just dismiss them 246 * and don't print any message 247 */ 248 if (ev6_process_logout_frame(mchk_header, 0) != 249 MCHK_DISPOSITION_DISMISS) { 250 char *saved_err_prefix = err_print_prefix; 251 err_print_prefix = KERN_CRIT; 252 253 /* 254 * Either a nondismissable error was detected or no 255 * recognized error was detected in the logout frame 256 * -- report the error in either case 257 */ 258 printk("%s*CPU %s Error (Vector 0x%x) reported on CPU %d:\n", 259 err_print_prefix, 260 (vector == SCB_Q_PROCERR)?"Correctable":"Uncorrectable", 261 (unsigned int)vector, (int)smp_processor_id()); 262 263 ev6_process_logout_frame(mchk_header, 1); 264 dik_show_regs(get_irq_regs(), NULL); 265 266 err_print_prefix = saved_err_prefix; 267 } 268 269 /* 270 * Release the logout frame 271 */ 272 wrmces(0x7); 273 mb(); 274} 275 276