1*1772Sjl139090 /* 2*1772Sjl139090 * CDDL HEADER START 3*1772Sjl139090 * 4*1772Sjl139090 * The contents of this file are subject to the terms of the 5*1772Sjl139090 * Common Development and Distribution License (the "License"). 6*1772Sjl139090 * You may not use this file except in compliance with the License. 7*1772Sjl139090 * 8*1772Sjl139090 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1772Sjl139090 * or http://www.opensolaris.org/os/licensing. 10*1772Sjl139090 * See the License for the specific language governing permissions 11*1772Sjl139090 * and limitations under the License. 12*1772Sjl139090 * 13*1772Sjl139090 * When distributing Covered Code, include this CDDL HEADER in each 14*1772Sjl139090 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1772Sjl139090 * If applicable, add the following below this CDDL HEADER, with the 16*1772Sjl139090 * fields enclosed by brackets "[]" replaced with your own identifying 17*1772Sjl139090 * information: Portions Copyright [yyyy] [name of copyright owner] 18*1772Sjl139090 * 19*1772Sjl139090 * CDDL HEADER END 20*1772Sjl139090 */ 21*1772Sjl139090 /* 22*1772Sjl139090 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*1772Sjl139090 * Use is subject to license terms. 24*1772Sjl139090 */ 25*1772Sjl139090 26*1772Sjl139090 #ifndef _SYS_PCMU_ERR_H 27*1772Sjl139090 #define _SYS_PCMU_ERR_H 28*1772Sjl139090 29*1772Sjl139090 #pragma ident "%Z%%M% %I% %E% SMI" 30*1772Sjl139090 31*1772Sjl139090 #include <sys/ddifm.h> 32*1772Sjl139090 33*1772Sjl139090 #ifdef __cplusplus 34*1772Sjl139090 extern "C" { 35*1772Sjl139090 #endif 36*1772Sjl139090 37*1772Sjl139090 #ifdef _KERNEL 38*1772Sjl139090 39*1772Sjl139090 #define PBM_PRIMARY 1 40*1772Sjl139090 #define PBM_SECONDARY 0 41*1772Sjl139090 #define PBM_NONFATAL 0 42*1772Sjl139090 #define PBM_FATAL 1 43*1772Sjl139090 #define FM_LOG_PCI 0 44*1772Sjl139090 #define FM_LOG_PBM 1 45*1772Sjl139090 #define ECC_MAX_ERRS 6 46*1772Sjl139090 #define TARGET_MAX_ERRS 6 47*1772Sjl139090 48*1772Sjl139090 /* 49*1772Sjl139090 * Since pcmu_pbm_err_handler() is called by various interrupt/trap/callback 50*1772Sjl139090 * handlers, it is necessary for it to know where it is being called from. 51*1772Sjl139090 * Below are the flags passed to pcmu_pbm_err_handler() to give it knowledge 52*1772Sjl139090 * of it's caller. 53*1772Sjl139090 */ 54*1772Sjl139090 #define PCI_TRAP_CALL 0x0 55*1772Sjl139090 #define PCI_CB_CALL 0x1 56*1772Sjl139090 #define PCI_INTR_CALL 0x2 57*1772Sjl139090 #define PCI_BUS_EXIT_CALL 0x3 58*1772Sjl139090 #define PCI_ECC_CALL 0x4 59*1772Sjl139090 60*1772Sjl139090 extern errorq_t *pcmu_ecc_queue; /* per-system ecc handling queue */ 61*1772Sjl139090 62*1772Sjl139090 struct pcmu_errstate { 63*1772Sjl139090 char *pcmu_err_class; 64*1772Sjl139090 uint16_t pcmu_cfg_stat; 65*1772Sjl139090 uint16_t pcmu_cfg_comm; 66*1772Sjl139090 uint64_t pcmu_pa; 67*1772Sjl139090 }; 68*1772Sjl139090 69*1772Sjl139090 /* 70*1772Sjl139090 * pbm errstate use to encompass the state for all errors 71*1772Sjl139090 * detected by the pci block 72*1772Sjl139090 */ 73*1772Sjl139090 struct pcmu_pbm_errstate { 74*1772Sjl139090 char *pbm_err_class; 75*1772Sjl139090 int pcbm_pri; 76*1772Sjl139090 int pbm_log; 77*1772Sjl139090 uint32_t pbm_err; 78*1772Sjl139090 uint32_t pbm_multi; 79*1772Sjl139090 char *pbm_bridge_type; 80*1772Sjl139090 uint64_t pbm_ctl_stat; 81*1772Sjl139090 uint64_t pbm_afsr; 82*1772Sjl139090 uint64_t pbm_afar; 83*1772Sjl139090 uint64_t pbm_va_log; 84*1772Sjl139090 uint64_t pbm_err_sl; 85*1772Sjl139090 uint64_t pcbm_pcix_stat; 86*1772Sjl139090 uint32_t pcbm_pcix_pfar; 87*1772Sjl139090 pcmu_errstate_t pcbm_pci; 88*1772Sjl139090 char *pcmu_pbm_terr_class; 89*1772Sjl139090 }; 90*1772Sjl139090 91*1772Sjl139090 /* 92*1772Sjl139090 * ecc errstate used to store all state captured, 93*1772Sjl139090 * upon detection of an ecc error. 94*1772Sjl139090 */ 95*1772Sjl139090 struct pcmu_ecc_errstate { 96*1772Sjl139090 char *ecc_bridge_type; 97*1772Sjl139090 pcmu_ecc_t *pecc_p; 98*1772Sjl139090 uint64_t ecc_afsr; 99*1772Sjl139090 uint64_t ecc_afar; 100*1772Sjl139090 uint64_t ecc_offset; 101*1772Sjl139090 uint64_t ecc_dev_id; 102*1772Sjl139090 uint64_t ecc_dw_offset; 103*1772Sjl139090 struct async_flt ecc_aflt; 104*1772Sjl139090 pcmu_ecc_intr_info_t ecc_ii_p; 105*1772Sjl139090 uint64_t ecc_ctrl; 106*1772Sjl139090 int pecc_pri; 107*1772Sjl139090 char ecc_unum[UNUM_NAMLEN]; 108*1772Sjl139090 uint64_t ecc_ena; 109*1772Sjl139090 uint64_t ecc_err_addr; 110*1772Sjl139090 char *ecc_err_type; 111*1772Sjl139090 int pecc_pg_ret; 112*1772Sjl139090 nvlist_t *ecc_fmri; 113*1772Sjl139090 int ecc_caller; 114*1772Sjl139090 }; 115*1772Sjl139090 116*1772Sjl139090 extern int pcmu_fm_init_child(dev_info_t *dip, dev_info_t *tdip, int cap, 117*1772Sjl139090 ddi_iblock_cookie_t *ibc); 118*1772Sjl139090 extern void pcmu_bus_enter(dev_info_t *dip, ddi_acc_handle_t handle); 119*1772Sjl139090 extern void pcmu_bus_exit(dev_info_t *dip, ddi_acc_handle_t handle); 120*1772Sjl139090 extern void pcmu_pbm_ereport_post(dev_info_t *dip, uint64_t ena, 121*1772Sjl139090 pcmu_pbm_errstate_t *pbm_err); 122*1772Sjl139090 extern void pcmu_fm_acc_setup(ddi_map_req_t *mp, dev_info_t *rdip); 123*1772Sjl139090 extern int pcmu_handle_lookup(dev_info_t *dip, int type, uint64_t fme_ena, 124*1772Sjl139090 void *afar); 125*1772Sjl139090 extern void pcmu_fm_create(pcmu_t *pcmu_p); 126*1772Sjl139090 extern void pcmu_fm_destroy(pcmu_t *pcmu_p); 127*1772Sjl139090 extern int pcmu_err_callback(dev_info_t *dip, ddi_fm_error_t *derr, 128*1772Sjl139090 const void *impl_data); 129*1772Sjl139090 #endif /* _KERNEL */ 130*1772Sjl139090 131*1772Sjl139090 #ifdef __cplusplus 132*1772Sjl139090 } 133*1772Sjl139090 #endif 134*1772Sjl139090 135*1772Sjl139090 #endif /* _SYS_PCMU_ERR_H */ 136