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