1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _ERROR_H 28 #define _ERROR_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #define CPU_RQ_ENTRIES 64 37 #define CPU_NRQ_ENTRIES 64 38 39 40 /* 41 * Resumable and Non-resumable queues 42 */ 43 #define CPU_RQ 0x3e 44 #define CPU_NRQ 0x3f 45 #define Q_ENTRY_SIZE 64 46 #define CPU_RQ_SIZE (CPU_RQ_ENTRIES * Q_ENTRY_SIZE) 47 #define CPU_NRQ_SIZE (CPU_NRQ_ENTRIES * Q_ENTRY_SIZE) 48 49 /* 50 * Sun4v Error Report error Descriptor describes the type of the error 51 */ 52 #define ERRH_DESC_UNDEFINED 0 /* Undefined */ 53 #define ERRH_DESC_UCOR_RE 1 /* Uncorrected resumable error */ 54 #define ERRH_DESC_PR_NRE 2 /* Precise non-resumable error */ 55 #define ERRH_DESC_DEF_NRE 3 /* Deferred non-resumalbe error */ 56 #define ERRH_DESC_WARN_RE 4 /* Power-off for vBSC HostShutdown() */ 57 58 /* 59 * Sun4v Error Report Error Attributes specifies the attributes of the error 60 */ 61 #define ERRH_ATTR_CPU 0x00000001 62 #define ERRH_ATTR_MEM 0x00000002 63 #define ERRH_ATTR_PIO 0x00000004 64 #define ERRH_ATTR_IRF 0x00000008 /* Integer register file */ 65 /* Floating-point register file */ 66 #define ERRH_ATTR_FRF 0x00000010 67 #define ERRH_ATTR_RQF 0x80000000 /* Resumablee Queue Full */ 68 69 /* 70 * For Excution mode 71 */ 72 #define ERRH_MODE_MASK 0x03000000 73 #define ERRH_MODE_SHIFT 24 74 #define ERRH_MODE_UNKNOWN 0 75 #define ERRH_MODE_USER 1 76 #define ERRH_MODE_PRIV 2 77 78 /* 79 * For the second argument passed to process_nonresumable_error(), it is 80 * an uint64_t. The upper 32 bits are reserved for various flags, the 81 * lower 32 bits are used to pass the "current tl-1". Right now only bit 82 * 32 in the upper 32 bits is being used as user's fill/spill flag. 83 * If bit 32 is set, it means the first error in the error 84 * queue happened in user fill/spill trap and it needs to be handled 85 * differently. 86 * 87 * -Argument 2 of process_nonresumable_error() 88 * ---------------------------------------------- 89 * | reserved |x| current_tl - 1 | 90 * ---------------------------------------------- 91 * 63 32 31 0 92 * x - bit 32, user fill/spill trap flag 93 */ 94 #define ERRH_U_SPILL_FILL 0x100000000 95 #define ERRH_U_SPILL_FILL_SHIFT 32 96 #define ERRH_TL_MASK 0xffffffff 97 98 #ifndef _ASM 99 /* 100 * For debug print out 101 */ 102 #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 103 104 /* 105 * Sun4v Error Report record 106 */ 107 typedef struct { 108 uint64_t ehdl; /* Unique error handle */ 109 uint64_t stick; /* Value of the %STICK register */ 110 uint32_t desc; /* Error Descriptor */ 111 uint32_t attr; /* error attributes bit field */ 112 uint64_t ra; /* Real address */ 113 uint32_t sz; /* Size of affected mem region */ 114 uint16_t cpuid; /* Virtual ID of the affected CPU */ 115 } errh_er_t; 116 117 typedef struct errh_async_flt { 118 struct async_flt cmn_asyncflt; /* common fault structure */ 119 errh_er_t errh_er; /* sun4v er record */ 120 } errh_async_flt_t; 121 122 /* 123 * Global functions 124 */ 125 void mem_scrub(uint64_t, uint64_t); 126 void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 127 void error_init(void); 128 void cpu_async_log_err(void *); 129 void cpu_ce_log_err(struct async_flt *); 130 void cpu_ue_log_err(struct async_flt *); 131 void mem_sync(caddr_t, size_t); 132 133 #endif /* _ASM */ 134 135 #ifdef __cplusplus 136 } 137 #endif 138 139 #endif /* _ERROR_H */ 140