Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: mca_drv.c |
| 3 | * Purpose: Generic MCA handling layer |
| 4 | * |
| 5 | * Copyright (C) 2004 FUJITSU LIMITED |
| 6 | * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com) |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 7 | * Copyright (C) 2005 Silicon Graphics, Inc |
| 8 | * Copyright (C) 2005 Keith Owens <kaos@sgi.com> |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 9 | * Copyright (C) 2006 Russ Anderson <rja@sgi.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/types.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/sched.h> |
| 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/irq.h> |
| 16 | #include <linux/kallsyms.h> |
| 17 | #include <linux/smp_lock.h> |
| 18 | #include <linux/bootmem.h> |
| 19 | #include <linux/acpi.h> |
| 20 | #include <linux/timer.h> |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/kernel.h> |
| 23 | #include <linux/smp.h> |
| 24 | #include <linux/workqueue.h> |
| 25 | #include <linux/mm.h> |
| 26 | |
| 27 | #include <asm/delay.h> |
| 28 | #include <asm/machvec.h> |
| 29 | #include <asm/page.h> |
| 30 | #include <asm/ptrace.h> |
| 31 | #include <asm/system.h> |
| 32 | #include <asm/sal.h> |
| 33 | #include <asm/mca.h> |
| 34 | |
| 35 | #include <asm/irq.h> |
| 36 | #include <asm/hw_irq.h> |
| 37 | |
| 38 | #include "mca_drv.h" |
| 39 | |
| 40 | /* max size of SAL error record (default) */ |
| 41 | static int sal_rec_max = 10000; |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* from mca_drv_asm.S */ |
| 44 | extern void *mca_handler_bhhook(void); |
| 45 | |
| 46 | static DEFINE_SPINLOCK(mca_bh_lock); |
| 47 | |
| 48 | typedef enum { |
| 49 | MCA_IS_LOCAL = 0, |
| 50 | MCA_IS_GLOBAL = 1 |
| 51 | } mca_type_t; |
| 52 | |
| 53 | #define MAX_PAGE_ISOLATE 1024 |
| 54 | |
| 55 | static struct page *page_isolate[MAX_PAGE_ISOLATE]; |
| 56 | static int num_page_isolate = 0; |
| 57 | |
| 58 | typedef enum { |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 59 | ISOLATE_NG, |
| 60 | ISOLATE_OK, |
| 61 | ISOLATE_NONE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | } isolate_status_t; |
| 63 | |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 64 | typedef enum { |
| 65 | MCA_NOT_RECOVERED = 0, |
| 66 | MCA_RECOVERED = 1 |
| 67 | } recovery_status_t; |
| 68 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | /* |
| 70 | * This pool keeps pointers to the section part of SAL error record |
| 71 | */ |
| 72 | static struct { |
| 73 | slidx_list_t *buffer; /* section pointer list pool */ |
| 74 | int cur_idx; /* Current index of section pointer list pool */ |
| 75 | int max_idx; /* Maximum index of section pointer list pool */ |
| 76 | } slidx_pool; |
| 77 | |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 78 | static int |
| 79 | fatal_mca(const char *fmt, ...) |
| 80 | { |
| 81 | va_list args; |
| 82 | |
| 83 | va_start(args, fmt); |
| 84 | vprintk(fmt, args); |
| 85 | va_end(args); |
| 86 | |
| 87 | return MCA_NOT_RECOVERED; |
| 88 | } |
| 89 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | /** |
| 91 | * mca_page_isolate - isolate a poisoned page in order not to use it later |
| 92 | * @paddr: poisoned memory location |
| 93 | * |
| 94 | * Return value: |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 95 | * one of isolate_status_t, ISOLATE_OK/NG/NONE. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | */ |
| 97 | |
| 98 | static isolate_status_t |
| 99 | mca_page_isolate(unsigned long paddr) |
| 100 | { |
| 101 | int i; |
| 102 | struct page *p; |
| 103 | |
| 104 | /* whether physical address is valid or not */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 105 | if (!ia64_phys_addr_valid(paddr)) |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 106 | return ISOLATE_NONE; |
| 107 | |
Russ Anderson | 56f87b8 | 2005-11-04 13:57:00 -0600 | [diff] [blame] | 108 | if (!pfn_valid(paddr >> PAGE_SHIFT)) |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 109 | return ISOLATE_NONE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | /* convert physical address to physical page number */ |
| 112 | p = pfn_to_page(paddr>>PAGE_SHIFT); |
| 113 | |
| 114 | /* check whether a page number have been already registered or not */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 115 | for (i = 0; i < num_page_isolate; i++) |
| 116 | if (page_isolate[i] == p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | return ISOLATE_OK; /* already listed */ |
| 118 | |
| 119 | /* limitation check */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 120 | if (num_page_isolate == MAX_PAGE_ISOLATE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | return ISOLATE_NG; |
| 122 | |
| 123 | /* kick pages having attribute 'SLAB' or 'Reserved' */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 124 | if (PageSlab(p) || PageReserved(p)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | return ISOLATE_NG; |
| 126 | |
| 127 | /* add attribute 'Reserved' and register the page */ |
Russ Anderson | cbb9214 | 2005-11-04 16:58:28 -0600 | [diff] [blame] | 128 | get_page(p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | SetPageReserved(p); |
| 130 | page_isolate[num_page_isolate++] = p; |
| 131 | |
| 132 | return ISOLATE_OK; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * mca_hanlder_bh - Kill the process which occurred memory read error |
| 137 | * @paddr: poisoned address received from MCA Handler |
| 138 | */ |
| 139 | |
| 140 | void |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 141 | mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | { |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 143 | printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " |
| 144 | "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", |
| 145 | raw_smp_processor_id(), current->pid, current->uid, |
| 146 | iip, ipsr, paddr, current->comm); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
| 148 | spin_lock(&mca_bh_lock); |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 149 | switch (mca_page_isolate(paddr)) { |
| 150 | case ISOLATE_OK: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | printk(KERN_DEBUG "Page isolation: ( %lx ) success.\n", paddr); |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 152 | break; |
| 153 | case ISOLATE_NG: |
Russ Anderson | ea0e92a | 2006-03-07 15:23:25 -0800 | [diff] [blame] | 154 | printk(KERN_CRIT "Page isolation: ( %lx ) failure.\n", paddr); |
Hidetoshi Seto | 4881e2c | 2005-09-20 16:34:41 +0900 | [diff] [blame] | 155 | break; |
| 156 | default: |
| 157 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | } |
| 159 | spin_unlock(&mca_bh_lock); |
| 160 | |
| 161 | /* This process is about to be killed itself */ |
Russ Anderson | b1b901c | 2005-04-06 00:07:00 -0700 | [diff] [blame] | 162 | do_exit(SIGKILL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | /** |
| 166 | * mca_make_peidx - Make index of processor error section |
| 167 | * @slpi: pointer to record of processor error section |
| 168 | * @peidx: pointer to index of processor error section |
| 169 | */ |
| 170 | |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 171 | static void |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | mca_make_peidx(sal_log_processor_info_t *slpi, peidx_table_t *peidx) |
| 173 | { |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 174 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | * calculate the start address of |
| 176 | * "struct cpuid_info" and "sal_processor_static_info_t". |
| 177 | */ |
| 178 | u64 total_check_num = slpi->valid.num_cache_check |
| 179 | + slpi->valid.num_tlb_check |
| 180 | + slpi->valid.num_bus_check |
| 181 | + slpi->valid.num_reg_file_check |
| 182 | + slpi->valid.num_ms_check; |
| 183 | u64 head_size = sizeof(sal_log_mod_error_info_t) * total_check_num |
| 184 | + sizeof(sal_log_processor_info_t); |
| 185 | u64 mid_size = slpi->valid.cpuid_info * sizeof(struct sal_cpuid_info); |
| 186 | |
| 187 | peidx_head(peidx) = slpi; |
| 188 | peidx_mid(peidx) = (struct sal_cpuid_info *) |
| 189 | (slpi->valid.cpuid_info ? ((char*)slpi + head_size) : NULL); |
| 190 | peidx_bottom(peidx) = (sal_processor_static_info_t *) |
| 191 | (slpi->valid.psi_static_struct ? |
| 192 | ((char*)slpi + head_size + mid_size) : NULL); |
| 193 | } |
| 194 | |
| 195 | /** |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 196 | * mca_make_slidx - Make index of SAL error record |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | * @buffer: pointer to SAL error record |
| 198 | * @slidx: pointer to index of SAL error record |
| 199 | * |
| 200 | * Return value: |
| 201 | * 1 if record has platform error / 0 if not |
| 202 | */ |
| 203 | #define LOG_INDEX_ADD_SECT_PTR(sect, ptr) \ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 204 | {slidx_list_t *hl = &slidx_pool.buffer[slidx_pool.cur_idx]; \ |
| 205 | hl->hdr = ptr; \ |
| 206 | list_add(&hl->list, &(sect)); \ |
| 207 | slidx_pool.cur_idx = (slidx_pool.cur_idx + 1)%slidx_pool.max_idx; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 209 | static int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | mca_make_slidx(void *buffer, slidx_table_t *slidx) |
| 211 | { |
| 212 | int platform_err = 0; |
| 213 | int record_len = ((sal_log_record_header_t*)buffer)->len; |
| 214 | u32 ercd_pos; |
| 215 | int sects; |
| 216 | sal_log_section_hdr_t *sp; |
| 217 | |
| 218 | /* |
| 219 | * Initialize index referring current record |
| 220 | */ |
| 221 | INIT_LIST_HEAD(&(slidx->proc_err)); |
| 222 | INIT_LIST_HEAD(&(slidx->mem_dev_err)); |
| 223 | INIT_LIST_HEAD(&(slidx->sel_dev_err)); |
| 224 | INIT_LIST_HEAD(&(slidx->pci_bus_err)); |
| 225 | INIT_LIST_HEAD(&(slidx->smbios_dev_err)); |
| 226 | INIT_LIST_HEAD(&(slidx->pci_comp_err)); |
| 227 | INIT_LIST_HEAD(&(slidx->plat_specific_err)); |
| 228 | INIT_LIST_HEAD(&(slidx->host_ctlr_err)); |
| 229 | INIT_LIST_HEAD(&(slidx->plat_bus_err)); |
| 230 | INIT_LIST_HEAD(&(slidx->unsupported)); |
| 231 | |
| 232 | /* |
| 233 | * Extract a Record Header |
| 234 | */ |
| 235 | slidx->header = buffer; |
| 236 | |
| 237 | /* |
| 238 | * Extract each section records |
| 239 | * (arranged from "int ia64_log_platform_info_print()") |
| 240 | */ |
| 241 | for (ercd_pos = sizeof(sal_log_record_header_t), sects = 0; |
| 242 | ercd_pos < record_len; ercd_pos += sp->len, sects++) { |
| 243 | sp = (sal_log_section_hdr_t *)((char*)buffer + ercd_pos); |
| 244 | if (!efi_guidcmp(sp->guid, SAL_PROC_DEV_ERR_SECT_GUID)) { |
| 245 | LOG_INDEX_ADD_SECT_PTR(slidx->proc_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 246 | } else if (!efi_guidcmp(sp->guid, |
| 247 | SAL_PLAT_MEM_DEV_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | platform_err = 1; |
| 249 | LOG_INDEX_ADD_SECT_PTR(slidx->mem_dev_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 250 | } else if (!efi_guidcmp(sp->guid, |
| 251 | SAL_PLAT_SEL_DEV_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | platform_err = 1; |
| 253 | LOG_INDEX_ADD_SECT_PTR(slidx->sel_dev_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 254 | } else if (!efi_guidcmp(sp->guid, |
| 255 | SAL_PLAT_PCI_BUS_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | platform_err = 1; |
| 257 | LOG_INDEX_ADD_SECT_PTR(slidx->pci_bus_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 258 | } else if (!efi_guidcmp(sp->guid, |
| 259 | SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | platform_err = 1; |
| 261 | LOG_INDEX_ADD_SECT_PTR(slidx->smbios_dev_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 262 | } else if (!efi_guidcmp(sp->guid, |
| 263 | SAL_PLAT_PCI_COMP_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | platform_err = 1; |
| 265 | LOG_INDEX_ADD_SECT_PTR(slidx->pci_comp_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 266 | } else if (!efi_guidcmp(sp->guid, |
| 267 | SAL_PLAT_SPECIFIC_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | platform_err = 1; |
| 269 | LOG_INDEX_ADD_SECT_PTR(slidx->plat_specific_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 270 | } else if (!efi_guidcmp(sp->guid, |
| 271 | SAL_PLAT_HOST_CTLR_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | platform_err = 1; |
| 273 | LOG_INDEX_ADD_SECT_PTR(slidx->host_ctlr_err, sp); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 274 | } else if (!efi_guidcmp(sp->guid, |
| 275 | SAL_PLAT_BUS_ERR_SECT_GUID)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | platform_err = 1; |
| 277 | LOG_INDEX_ADD_SECT_PTR(slidx->plat_bus_err, sp); |
| 278 | } else { |
| 279 | LOG_INDEX_ADD_SECT_PTR(slidx->unsupported, sp); |
| 280 | } |
| 281 | } |
| 282 | slidx->n_sections = sects; |
| 283 | |
| 284 | return platform_err; |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * init_record_index_pools - Initialize pool of lists for SAL record index |
| 289 | * |
| 290 | * Return value: |
| 291 | * 0 on Success / -ENOMEM on Failure |
| 292 | */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 293 | static int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | init_record_index_pools(void) |
| 295 | { |
| 296 | int i; |
| 297 | int rec_max_size; /* Maximum size of SAL error records */ |
| 298 | int sect_min_size; /* Minimum size of SAL error sections */ |
| 299 | /* minimum size table of each section */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 300 | static int sal_log_sect_min_sizes[] = { |
| 301 | sizeof(sal_log_processor_info_t) |
| 302 | + sizeof(sal_processor_static_info_t), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | sizeof(sal_log_mem_dev_err_info_t), |
| 304 | sizeof(sal_log_sel_dev_err_info_t), |
| 305 | sizeof(sal_log_pci_bus_err_info_t), |
| 306 | sizeof(sal_log_smbios_dev_err_info_t), |
| 307 | sizeof(sal_log_pci_comp_err_info_t), |
| 308 | sizeof(sal_log_plat_specific_err_info_t), |
| 309 | sizeof(sal_log_host_ctlr_err_info_t), |
| 310 | sizeof(sal_log_plat_bus_err_info_t), |
| 311 | }; |
| 312 | |
| 313 | /* |
| 314 | * MCA handler cannot allocate new memory on flight, |
| 315 | * so we preallocate enough memory to handle a SAL record. |
| 316 | * |
| 317 | * Initialize a handling set of slidx_pool: |
| 318 | * 1. Pick up the max size of SAL error records |
| 319 | * 2. Pick up the min size of SAL error sections |
| 320 | * 3. Allocate the pool as enough to 2 SAL records |
| 321 | * (now we can estimate the maxinum of section in a record.) |
| 322 | */ |
| 323 | |
| 324 | /* - 1 - */ |
| 325 | rec_max_size = sal_rec_max; |
| 326 | |
| 327 | /* - 2 - */ |
| 328 | sect_min_size = sal_log_sect_min_sizes[0]; |
| 329 | for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++) |
| 330 | if (sect_min_size > sal_log_sect_min_sizes[i]) |
| 331 | sect_min_size = sal_log_sect_min_sizes[i]; |
| 332 | |
| 333 | /* - 3 - */ |
| 334 | slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1; |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 335 | slidx_pool.buffer = (slidx_list_t *) |
| 336 | kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | |
| 338 | return slidx_pool.buffer ? 0 : -ENOMEM; |
| 339 | } |
| 340 | |
| 341 | |
| 342 | /***************************************************************************** |
| 343 | * Recovery functions * |
| 344 | *****************************************************************************/ |
| 345 | |
| 346 | /** |
| 347 | * is_mca_global - Check whether this MCA is global or not |
| 348 | * @peidx: pointer of index of processor error section |
| 349 | * @pbci: pointer to pal_bus_check_info_t |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 350 | * @sos: pointer to hand off struct between SAL and OS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | * |
| 352 | * Return value: |
| 353 | * MCA_IS_LOCAL / MCA_IS_GLOBAL |
| 354 | */ |
| 355 | |
| 356 | static mca_type_t |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 357 | is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci, |
| 358 | struct ia64_sal_os_state *sos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | { |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 360 | pal_processor_state_info_t *psp = |
| 361 | (pal_processor_state_info_t*)peidx_psp(peidx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 363 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | * PAL can request a rendezvous, if the MCA has a global scope. |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 365 | * If "rz_always" flag is set, SAL requests MCA rendezvous |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | * in spite of global MCA. |
| 367 | * Therefore it is local MCA when rendezvous has not been requested. |
| 368 | * Failed to rendezvous, the system must be down. |
| 369 | */ |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 370 | switch (sos->rv_rc) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | case -1: /* SAL rendezvous unsuccessful */ |
| 372 | return MCA_IS_GLOBAL; |
| 373 | case 0: /* SAL rendezvous not required */ |
| 374 | return MCA_IS_LOCAL; |
| 375 | case 1: /* SAL rendezvous successful int */ |
| 376 | case 2: /* SAL rendezvous successful int with init */ |
| 377 | default: |
| 378 | break; |
| 379 | } |
| 380 | |
| 381 | /* |
| 382 | * If One or more Cache/TLB/Reg_File/Uarch_Check is here, |
| 383 | * it would be a local MCA. (i.e. processor internal error) |
| 384 | */ |
| 385 | if (psp->tc || psp->cc || psp->rc || psp->uc) |
| 386 | return MCA_IS_LOCAL; |
| 387 | |
| 388 | /* |
| 389 | * Bus_Check structure with Bus_Check.ib (internal bus error) flag set |
| 390 | * would be a global MCA. (e.g. a system bus address parity error) |
| 391 | */ |
| 392 | if (!pbci || pbci->ib) |
| 393 | return MCA_IS_GLOBAL; |
| 394 | |
| 395 | /* |
| 396 | * Bus_Check structure with Bus_Check.eb (external bus error) flag set |
| 397 | * could be either a local MCA or a global MCA. |
| 398 | * |
| 399 | * Referring Bus_Check.bsi: |
| 400 | * 0: Unknown/unclassified |
| 401 | * 1: BERR# |
| 402 | * 2: BINIT# |
| 403 | * 3: Hard Fail |
| 404 | * (FIXME: Are these SGI specific or generic bsi values?) |
| 405 | */ |
| 406 | if (pbci->eb) |
| 407 | switch (pbci->bsi) { |
| 408 | case 0: |
| 409 | /* e.g. a load from poisoned memory */ |
| 410 | return MCA_IS_LOCAL; |
| 411 | case 1: |
| 412 | case 2: |
| 413 | case 3: |
| 414 | return MCA_IS_GLOBAL; |
| 415 | } |
| 416 | |
| 417 | return MCA_IS_GLOBAL; |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * recover_from_read_error - Try to recover the errors which type are "read"s. |
| 422 | * @slidx: pointer of index of SAL error record |
| 423 | * @peidx: pointer of index of processor error section |
| 424 | * @pbci: pointer of pal_bus_check_info |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 425 | * @sos: pointer to hand off struct between SAL and OS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | * |
| 427 | * Return value: |
| 428 | * 1 on Success / 0 on Failure |
| 429 | */ |
| 430 | |
| 431 | static int |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 432 | recover_from_read_error(slidx_table_t *slidx, |
| 433 | peidx_table_t *peidx, pal_bus_check_info_t *pbci, |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 434 | struct ia64_sal_os_state *sos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | { |
| 436 | sal_log_mod_error_info_t *smei; |
| 437 | pal_min_state_area_t *pmsa; |
| 438 | struct ia64_psr *psr1, *psr2; |
| 439 | ia64_fptr_t *mca_hdlr_bh = (ia64_fptr_t*)mca_handler_bhhook; |
| 440 | |
| 441 | /* Is target address valid? */ |
| 442 | if (!pbci->tv) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 443 | return fatal_mca(KERN_ALERT "MCA: target address not valid\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | |
| 445 | /* |
| 446 | * cpu read or memory-mapped io read |
| 447 | * |
| 448 | * offending process affected process OS MCA do |
| 449 | * kernel mode kernel mode down system |
| 450 | * kernel mode user mode kill the process |
| 451 | * user mode kernel mode down system (*) |
| 452 | * user mode user mode kill the process |
| 453 | * |
| 454 | * (*) You could terminate offending user-mode process |
| 455 | * if (pbci->pv && pbci->pl != 0) *and* if you sure |
| 456 | * the process not have any locks of kernel. |
| 457 | */ |
| 458 | |
Hidetoshi Seto | a947464 | 2006-02-09 14:42:55 -0800 | [diff] [blame] | 459 | /* Is minstate valid? */ |
| 460 | if (!peidx_bottom(peidx) || !(peidx_bottom(peidx)->valid.minstate)) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 461 | return fatal_mca(KERN_ALERT "MCA: minstate not valid\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr); |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 463 | psr2 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_xpsr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | |
| 465 | /* |
| 466 | * Check the privilege level of interrupted context. |
| 467 | * If it is user-mode, then terminate affected process. |
| 468 | */ |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 469 | |
| 470 | pmsa = sos->pal_min_state; |
| 471 | if (psr1->cpl != 0 || |
| 472 | ((psr2->cpl != 0) && mca_recover_range(pmsa->pmsa_iip))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | smei = peidx_bus_check(peidx, 0); |
| 474 | if (smei->valid.target_identifier) { |
| 475 | /* |
| 476 | * setup for resume to bottom half of MCA, |
| 477 | * "mca_handler_bhhook" |
| 478 | */ |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 479 | /* pass to bhhook as argument (gr8, ...) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | pmsa->pmsa_gr[8-1] = smei->target_identifier; |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 481 | pmsa->pmsa_gr[9-1] = pmsa->pmsa_iip; |
| 482 | pmsa->pmsa_gr[10-1] = pmsa->pmsa_ipsr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | /* set interrupted return address (but no use) */ |
| 484 | pmsa->pmsa_br0 = pmsa->pmsa_iip; |
| 485 | /* change resume address to bottom half */ |
| 486 | pmsa->pmsa_iip = mca_hdlr_bh->fp; |
| 487 | pmsa->pmsa_gr[1-1] = mca_hdlr_bh->gp; |
| 488 | /* set cpl with kernel mode */ |
| 489 | psr2 = (struct ia64_psr *)&pmsa->pmsa_ipsr; |
| 490 | psr2->cpl = 0; |
| 491 | psr2->ri = 0; |
Russ Anderson | d2a28ad | 2006-03-24 09:49:52 -0800 | [diff] [blame] | 492 | psr2->bn = 1; |
Russ Anderson | b1b901c | 2005-04-06 00:07:00 -0700 | [diff] [blame] | 493 | psr2->i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 495 | return MCA_RECOVERED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | } |
| 499 | |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 500 | return fatal_mca(KERN_ALERT "MCA: kernel context not recovered," |
| 501 | " iip 0x%lx\n", pmsa->pmsa_iip); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | /** |
| 505 | * recover_from_platform_error - Recover from platform error. |
| 506 | * @slidx: pointer of index of SAL error record |
| 507 | * @peidx: pointer of index of processor error section |
| 508 | * @pbci: pointer of pal_bus_check_info |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 509 | * @sos: pointer to hand off struct between SAL and OS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | * |
| 511 | * Return value: |
| 512 | * 1 on Success / 0 on Failure |
| 513 | */ |
| 514 | |
| 515 | static int |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 516 | recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, |
| 517 | pal_bus_check_info_t *pbci, |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 518 | struct ia64_sal_os_state *sos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | { |
| 520 | int status = 0; |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 521 | pal_processor_state_info_t *psp = |
| 522 | (pal_processor_state_info_t*)peidx_psp(peidx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | |
| 524 | if (psp->bc && pbci->eb && pbci->bsi == 0) { |
| 525 | switch(pbci->type) { |
| 526 | case 1: /* partial read */ |
| 527 | case 3: /* full line(cpu) read */ |
| 528 | case 9: /* I/O space read */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 529 | status = recover_from_read_error(slidx, peidx, pbci, |
| 530 | sos); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | break; |
| 532 | case 0: /* unknown */ |
| 533 | case 2: /* partial write */ |
| 534 | case 4: /* full line write */ |
| 535 | case 5: /* implicit or explicit write-back operation */ |
| 536 | case 6: /* snoop probe */ |
| 537 | case 7: /* incoming or outgoing ptc.g */ |
| 538 | case 8: /* write coalescing transactions */ |
| 539 | case 10: /* I/O space write */ |
| 540 | case 11: /* inter-processor interrupt message(IPI) */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 541 | case 12: /* interrupt acknowledge or |
| 542 | external task priority cycle */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | default: |
| 544 | break; |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | return status; |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * recover_from_processor_error |
| 553 | * @platform: whether there are some platform error section or not |
| 554 | * @slidx: pointer of index of SAL error record |
| 555 | * @peidx: pointer of index of processor error section |
| 556 | * @pbci: pointer of pal_bus_check_info |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 557 | * @sos: pointer to hand off struct between SAL and OS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | * |
| 559 | * Return value: |
| 560 | * 1 on Success / 0 on Failure |
| 561 | */ |
| 562 | /* |
| 563 | * Later we try to recover when below all conditions are satisfied. |
| 564 | * 1. Only one processor error section is exist. |
| 565 | * 2. BUS_CHECK is exist and the others are not exist.(Except TLB_CHECK) |
| 566 | * 3. The entry of BUS_CHECK_INFO is 1. |
| 567 | * 4. "External bus error" flag is set and the others are not set. |
| 568 | */ |
| 569 | |
| 570 | static int |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 571 | recover_from_processor_error(int platform, slidx_table_t *slidx, |
| 572 | peidx_table_t *peidx, pal_bus_check_info_t *pbci, |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 573 | struct ia64_sal_os_state *sos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | { |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 575 | pal_processor_state_info_t *psp = |
| 576 | (pal_processor_state_info_t*)peidx_psp(peidx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 578 | /* |
Russ Anderson | a14f25a | 2005-11-04 13:39:38 -0600 | [diff] [blame] | 579 | * Processor recovery status must key off of the PAL recovery |
| 580 | * status in the Processor State Parameter. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | */ |
Russ Anderson | a14f25a | 2005-11-04 13:39:38 -0600 | [diff] [blame] | 582 | |
| 583 | /* |
| 584 | * The machine check is corrected. |
| 585 | */ |
| 586 | if (psp->cm == 1) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 587 | return MCA_RECOVERED; |
Russ Anderson | a14f25a | 2005-11-04 13:39:38 -0600 | [diff] [blame] | 588 | |
| 589 | /* |
| 590 | * The error was not contained. Software must be reset. |
| 591 | */ |
| 592 | if (psp->us || psp->ci == 0) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 593 | return fatal_mca(KERN_ALERT "MCA: error not contained\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 594 | |
| 595 | /* |
Russ Anderson | e1c4855 | 2006-03-03 16:42:26 -0600 | [diff] [blame] | 596 | * The cache check and bus check bits have four possible states |
| 597 | * cc bc |
| 598 | * 0 0 Weird record, not recovered |
| 599 | * 1 0 Cache error, not recovered |
| 600 | * 0 1 I/O error, attempt recovery |
| 601 | * 1 1 Memory error, attempt recovery |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | */ |
| 603 | if (psp->bc == 0 || pbci == NULL) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 604 | return fatal_mca(KERN_ALERT "MCA: No bus check\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | |
| 606 | /* |
| 607 | * Sorry, we cannot handle so many. |
| 608 | */ |
| 609 | if (peidx_bus_check_num(peidx) > 1) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 610 | return fatal_mca(KERN_ALERT "MCA: Too many bus checks\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | /* |
| 612 | * Well, here is only one bus error. |
| 613 | */ |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 614 | if (pbci->ib) |
| 615 | return fatal_mca(KERN_ALERT "MCA: Internal Bus error\n"); |
| 616 | if (pbci->cc) |
| 617 | return fatal_mca(KERN_ALERT "MCA: Cache-cache error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | if (pbci->eb && pbci->bsi > 0) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 619 | return fatal_mca(KERN_ALERT "MCA: External bus check fatal status\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 620 | |
| 621 | /* |
| 622 | * This is a local MCA and estimated as recoverble external bus error. |
| 623 | * (e.g. a load from poisoned memory) |
| 624 | * This means "there are some platform errors". |
| 625 | */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 626 | if (platform) |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 627 | return recover_from_platform_error(slidx, peidx, pbci, sos); |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 628 | /* |
| 629 | * On account of strange SAL error record, we cannot recover. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 630 | */ |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 631 | return fatal_mca(KERN_ALERT "MCA: Strange SAL record\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | /** |
| 635 | * mca_try_to_recover - Try to recover from MCA |
| 636 | * @rec: pointer to a SAL error record |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 637 | * @sos: pointer to hand off struct between SAL and OS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 638 | * |
| 639 | * Return value: |
| 640 | * 1 on Success / 0 on Failure |
| 641 | */ |
| 642 | |
| 643 | static int |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 644 | mca_try_to_recover(void *rec, struct ia64_sal_os_state *sos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | { |
| 646 | int platform_err; |
| 647 | int n_proc_err; |
| 648 | slidx_table_t slidx; |
| 649 | peidx_table_t peidx; |
| 650 | pal_bus_check_info_t pbci; |
| 651 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | /* Make index of SAL error record */ |
| 653 | platform_err = mca_make_slidx(rec, &slidx); |
| 654 | |
| 655 | /* Count processor error sections */ |
| 656 | n_proc_err = slidx_count(&slidx, proc_err); |
| 657 | |
| 658 | /* Now, OS can recover when there is one processor error section */ |
| 659 | if (n_proc_err > 1) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 660 | return fatal_mca(KERN_ALERT "MCA: Too Many Errors\n"); |
| 661 | else if (n_proc_err == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | /* Weird SAL record ... We need not to recover */ |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 663 | return fatal_mca(KERN_ALERT "MCA: Weird SAL record\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | |
| 665 | /* Make index of processor error section */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 666 | mca_make_peidx((sal_log_processor_info_t*) |
| 667 | slidx_first_entry(&slidx.proc_err)->hdr, &peidx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | |
| 669 | /* Extract Processor BUS_CHECK[0] */ |
| 670 | *((u64*)&pbci) = peidx_check_info(&peidx, bus_check, 0); |
| 671 | |
| 672 | /* Check whether MCA is global or not */ |
Keith Owens | 7f613c7 | 2005-09-11 17:22:53 +1000 | [diff] [blame] | 673 | if (is_mca_global(&peidx, &pbci, sos)) |
Russ Anderson | 1899796 | 2006-04-27 10:07:08 -0500 | [diff] [blame] | 674 | return fatal_mca(KERN_ALERT "MCA: global MCA\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | |
| 676 | /* Try to recover a processor error */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 677 | return recover_from_processor_error(platform_err, &slidx, &peidx, |
| 678 | &pbci, sos); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | /* |
| 682 | * ============================================================================= |
| 683 | */ |
| 684 | |
| 685 | int __init mca_external_handler_init(void) |
| 686 | { |
| 687 | if (init_record_index_pools()) |
| 688 | return -ENOMEM; |
| 689 | |
| 690 | /* register external mca handlers */ |
Hidetoshi Seto | 20305e5 | 2005-09-16 13:44:56 +0900 | [diff] [blame] | 691 | if (ia64_reg_MCA_extension(mca_try_to_recover)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | printk(KERN_ERR "ia64_reg_MCA_extension failed.\n"); |
| 693 | kfree(slidx_pool.buffer); |
| 694 | return -EFAULT; |
| 695 | } |
| 696 | return 0; |
| 697 | } |
| 698 | |
| 699 | void __exit mca_external_handler_exit(void) |
| 700 | { |
| 701 | /* unregister external mca handlers */ |
| 702 | ia64_unreg_MCA_extension(); |
| 703 | kfree(slidx_pool.buffer); |
| 704 | } |
| 705 | |
| 706 | module_init(mca_external_handler_init); |
| 707 | module_exit(mca_external_handler_exit); |
| 708 | |
| 709 | module_param(sal_rec_max, int, 0644); |
| 710 | MODULE_PARM_DESC(sal_rec_max, "Max size of SAL error record"); |
| 711 | |
| 712 | MODULE_DESCRIPTION("ia64 platform dependent mca handler driver"); |
| 713 | MODULE_LICENSE("GPL"); |