xref: /onnv-gate/usr/src/uts/common/io/nxge/nxge_fm.c (revision 11236:1127b4f9e96b)
13859Sml29623 /*
23859Sml29623  * CDDL HEADER START
33859Sml29623  *
43859Sml29623  * The contents of this file are subject to the terms of the
53859Sml29623  * Common Development and Distribution License (the "License").
63859Sml29623  * You may not use this file except in compliance with the License.
73859Sml29623  *
83859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93859Sml29623  * or http://www.opensolaris.org/os/licensing.
103859Sml29623  * See the License for the specific language governing permissions
113859Sml29623  * and limitations under the License.
123859Sml29623  *
133859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
143859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
163859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
173859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
183859Sml29623  *
193859Sml29623  * CDDL HEADER END
203859Sml29623  */
213859Sml29623 /*
22*11236SStephen.Hanson@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #include <sys/nxge/nxge_impl.h>
276495Sspeer #include <sys/nxge/nxge_hio.h>
283859Sml29623 #include <sys/ddifm.h>
293859Sml29623 #include <sys/fm/protocol.h>
303859Sml29623 #include <sys/fm/util.h>
313859Sml29623 #include <sys/fm/io/ddi.h>
323859Sml29623 
333859Sml29623 static nxge_fm_ereport_attr_t
343859Sml29623 *nxge_fm_get_ereport_attr(nxge_fm_ereport_id_t);
353859Sml29623 
365060Syc148097 static int
375060Syc148097 nxge_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err, const void *impl_data);
385060Syc148097 
393859Sml29623 nxge_fm_ereport_attr_t	nxge_fm_ereport_pcs[] = {
403859Sml29623 	{NXGE_FM_EREPORT_XPCS_LINK_DOWN,	"10g_link_down",
413859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
423859Sml29623 						DDI_SERVICE_LOST},
433859Sml29623 	{NXGE_FM_EREPORT_XPCS_TX_LINK_FAULT,	"10g_tx_link_fault",
443859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
453859Sml29623 						DDI_SERVICE_DEGRADED},
463859Sml29623 	{NXGE_FM_EREPORT_XPCS_RX_LINK_FAULT,	"10g_rx_link_fault",
473859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
483859Sml29623 						DDI_SERVICE_DEGRADED},
493859Sml29623 	{NXGE_FM_EREPORT_PCS_LINK_DOWN,		"1g_link_down",
503859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
513859Sml29623 						DDI_SERVICE_LOST},
523859Sml29623 	{NXGE_FM_EREPORT_PCS_REMOTE_FAULT,	"1g_remote_fault",
533859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
543859Sml29623 						DDI_SERVICE_DEGRADED},
553859Sml29623 };
563859Sml29623 
573859Sml29623 nxge_fm_ereport_attr_t	nxge_fm_ereport_mif[] = {
583859Sml29623 	{NXGE_FM_EREPORT_MIF_ACCESS_FAIL,	"transceiver_access_fail"}
593859Sml29623 };
603859Sml29623 
613859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_fflp[] = {
623859Sml29623 	{NXGE_FM_EREPORT_FFLP_TCAM_ERR,		"classifier_tcam_err",
633859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
643859Sml29623 						DDI_SERVICE_UNAFFECTED},
653859Sml29623 	{NXGE_FM_EREPORT_FFLP_VLAN_PAR_ERR,	"classifier_vlan_par_err",
663859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
673859Sml29623 						DDI_SERVICE_UNAFFECTED},
683859Sml29623 	{NXGE_FM_EREPORT_FFLP_HASHT_DATA_ERR,	"classifier_hasht_data_err",
693859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
703859Sml29623 						DDI_SERVICE_UNAFFECTED},
713859Sml29623 	{NXGE_FM_EREPORT_FFLP_HASHT_LOOKUP_ERR,	"classifier_hasht_lookup_err",
723859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
733859Sml29623 						DDI_SERVICE_UNAFFECTED},
743859Sml29623 	{NXGE_FM_EREPORT_FFLP_ACCESS_FAIL,	"classifier_access_fail",
753859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
763859Sml29623 						DDI_SERVICE_DEGRADED}
773859Sml29623 };
783859Sml29623 
793859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_ipp[] = {
803859Sml29623 	{NXGE_FM_EREPORT_IPP_EOP_MISS,		"rx_eop_miss",
813859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
823859Sml29623 						DDI_SERVICE_LOST},
833859Sml29623 	{NXGE_FM_EREPORT_IPP_SOP_MISS,		"rx_sop_miss",
843859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
853859Sml29623 						DDI_SERVICE_LOST},
863859Sml29623 	{NXGE_FM_EREPORT_IPP_DFIFO_UE,		"rx_dfifo_ucorr_err",
873859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
883859Sml29623 						DDI_SERVICE_LOST},
893859Sml29623 	{NXGE_FM_EREPORT_IPP_DFIFO_CE,		"rx_dfifo_corr_err",
903859Sml29623 						DDI_FM_DEVICE_INTERN_CORR,
913859Sml29623 						DDI_SERVICE_UNAFFECTED},
923859Sml29623 	{NXGE_FM_EREPORT_IPP_PFIFO_PERR,	"rx_dfifo_parity_err",
933859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
943859Sml29623 						DDI_SERVICE_LOST},
953859Sml29623 	{NXGE_FM_EREPORT_IPP_ECC_ERR_MAX,	"rx_ecc_err_max",
963859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
973859Sml29623 						DDI_SERVICE_UNAFFECTED},
983859Sml29623 	{NXGE_FM_EREPORT_IPP_PFIFO_OVER,	"rx_pfifo_overflow",
993859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1003859Sml29623 						DDI_SERVICE_LOST},
1013859Sml29623 	{NXGE_FM_EREPORT_IPP_PFIFO_UND,		"rx_pfifo_underrun",
1023859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1033859Sml29623 						DDI_SERVICE_LOST},
1043859Sml29623 	{NXGE_FM_EREPORT_IPP_BAD_CS_MX,		"rx_bad_cksum_max",
1053859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1063859Sml29623 						DDI_SERVICE_UNAFFECTED},
1073859Sml29623 	{NXGE_FM_EREPORT_IPP_PKT_DIS_MX,	"rx_pkt_discard_max",
1083859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1093859Sml29623 						DDI_SERVICE_UNAFFECTED},
1103859Sml29623 	{NXGE_FM_EREPORT_IPP_RESET_FAIL,	"rx_reset_fail",
1113859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
1123859Sml29623 						DDI_SERVICE_LOST}
1133859Sml29623 };
1143859Sml29623 
1153859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_rdmc[] = {
1163859Sml29623 	{NXGE_FM_EREPORT_RDMC_DCF_ERR,		"rxdma_dcf_err",
1173859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1183859Sml29623 						DDI_SERVICE_LOST},
1193859Sml29623 	{NXGE_FM_EREPORT_RDMC_RCR_ACK_ERR,	"rxdma_rcr_ack_err",
1203859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1213859Sml29623 						DDI_SERVICE_DEGRADED},
1223859Sml29623 	{NXGE_FM_EREPORT_RDMC_DC_FIFO_ERR,	"rxdma_dc_fifo_err",
1233859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1243859Sml29623 						DDI_SERVICE_LOST},
1253859Sml29623 	{NXGE_FM_EREPORT_RDMC_RCR_SHA_PAR,	"rxdma_rcr_sha_par_err",
1263859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1273859Sml29623 						DDI_SERVICE_DEGRADED},
1283859Sml29623 	{NXGE_FM_EREPORT_RDMC_RBR_PRE_PAR,	"rxdma_rbr_pre_par_err",
1293859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1303859Sml29623 						DDI_SERVICE_DEGRADED},
1313859Sml29623 	{NXGE_FM_EREPORT_RDMC_RBR_TMOUT,	"rxdma_rbr_tmout",
1323859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
1333859Sml29623 						DDI_SERVICE_DEGRADED},
1343859Sml29623 	{NXGE_FM_EREPORT_RDMC_RSP_CNT_ERR,	"rxdma_rsp_cnt_err",
1353859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1363859Sml29623 						DDI_SERVICE_DEGRADED},
1373859Sml29623 	{NXGE_FM_EREPORT_RDMC_BYTE_EN_BUS,	"rxdma_byte_en_bus",
1383859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1393859Sml29623 						DDI_SERVICE_DEGRADED},
1403859Sml29623 	{NXGE_FM_EREPORT_RDMC_RSP_DAT_ERR,	"rxdma_rsp_dat_err",
1413859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1423859Sml29623 						DDI_SERVICE_DEGRADED},
1433859Sml29623 	{NXGE_FM_EREPORT_RDMC_ID_MISMATCH,	"rxdma_id_mismatch",
1443859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1453859Sml29623 						DDI_SERVICE_LOST},
1463859Sml29623 	{NXGE_FM_EREPORT_RDMC_ZCP_EOP_ERR,	"rxdma_zcp_eop_err",
1473859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1483859Sml29623 						DDI_SERVICE_LOST},
1493859Sml29623 	{NXGE_FM_EREPORT_RDMC_IPP_EOP_ERR,	"rxdma_ipp_eop_err",
1503859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1513859Sml29623 						DDI_SERVICE_LOST},
1525165Syc148097 	{NXGE_FM_EREPORT_RDMC_RCR_ERR,		"rxdma_completion_err",
1533859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1543859Sml29623 						DDI_SERVICE_UNAFFECTED},
1553859Sml29623 	{NXGE_FM_EREPORT_RDMC_CONFIG_ERR,	"rxdma_config_err",
1563859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1573859Sml29623 						DDI_SERVICE_DEGRADED},
1583859Sml29623 	{NXGE_FM_EREPORT_RDMC_RCRINCON,		"rxdma_rcrincon",
1593859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1603859Sml29623 						DDI_SERVICE_DEGRADED},
1613859Sml29623 	{NXGE_FM_EREPORT_RDMC_RCRFULL,		"rxdma_rcrfull",
1623859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1633859Sml29623 						DDI_SERVICE_DEGRADED},
1643859Sml29623 	{NXGE_FM_EREPORT_RDMC_RBRFULL,		"rxdma_rbrfull",
1653859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1663859Sml29623 						DDI_SERVICE_DEGRADED},
1673859Sml29623 	{NXGE_FM_EREPORT_RDMC_RBRLOGPAGE,	"rxdma_rbrlogpage",
1683859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1693859Sml29623 						DDI_SERVICE_DEGRADED},
1703859Sml29623 	{NXGE_FM_EREPORT_RDMC_CFIGLOGPAGE,	"rxdma_cfiglogpage",
1713859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1723859Sml29623 						DDI_SERVICE_DEGRADED}
1733859Sml29623 };
1743859Sml29623 
1753859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_zcp[] = {
1763859Sml29623 	{NXGE_FM_EREPORT_ZCP_RRFIFO_UNDERRUN,	"rxzcopy_rrfifo_underrun",
1773859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1783859Sml29623 						DDI_SERVICE_UNAFFECTED},
1793859Sml29623 	{NXGE_FM_EREPORT_ZCP_RSPFIFO_UNCORR_ERR,
1803859Sml29623 						"rxzcopy_rspfifo_uncorr_err",
1813859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1823859Sml29623 						DDI_SERVICE_UNAFFECTED},
1833859Sml29623 	{NXGE_FM_EREPORT_ZCP_STAT_TBL_PERR,	"rxzcopy_stat_tbl_perr",
1843859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1853859Sml29623 						DDI_SERVICE_UNAFFECTED},
1863859Sml29623 	{NXGE_FM_EREPORT_ZCP_DYN_TBL_PERR,	"rxzcopy_dyn_tbl_perr",
1873859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1883859Sml29623 						DDI_SERVICE_UNAFFECTED},
1893859Sml29623 	{NXGE_FM_EREPORT_ZCP_BUF_TBL_PERR,	"rxzcopy_buf_tbl_perr",
1903859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
1913859Sml29623 						DDI_SERVICE_UNAFFECTED},
1923859Sml29623 	{NXGE_FM_EREPORT_ZCP_CFIFO_ECC,		"rxzcopy_cfifo_ecc",
1933859Sml29623 						DDI_FM_DEVICE_INTERN_CORR,
1943859Sml29623 						DDI_SERVICE_UNAFFECTED},
1953859Sml29623 	{NXGE_FM_EREPORT_ZCP_RRFIFO_OVERRUN,	"rxzcopy_rrfifo_overrun",
1963859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
1973859Sml29623 						DDI_SERVICE_UNAFFECTED},
1983859Sml29623 	{NXGE_FM_EREPORT_ZCP_BUFFER_OVERFLOW,	"rxzcopy_buffer_overflow",
1993859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2003859Sml29623 						DDI_SERVICE_LOST},
2013859Sml29623 	{NXGE_FM_EREPORT_ZCP_TT_PROGRAM_ERR,	"rxzcopy_tt_program_err",
2023859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2033859Sml29623 						DDI_SERVICE_UNAFFECTED},
2043859Sml29623 	{NXGE_FM_EREPORT_ZCP_RSP_TT_INDEX_ERR,	"rxzcopy_rsp_tt_index_err",
2053859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2063859Sml29623 						DDI_SERVICE_UNAFFECTED},
2073859Sml29623 	{NXGE_FM_EREPORT_ZCP_SLV_TT_INDEX_ERR,	"rxzcopy_slv_tt_index_err",
2083859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2093859Sml29623 						DDI_SERVICE_UNAFFECTED},
2103859Sml29623 	{NXGE_FM_EREPORT_ZCP_TT_INDEX_ERR,	"rxzcopy_tt_index_err",
2113859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2123859Sml29623 						DDI_SERVICE_UNAFFECTED},
2133859Sml29623 	{NXGE_FM_EREPORT_ZCP_ACCESS_FAIL,	"rxzcopy_access_fail",
2143859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2153859Sml29623 						DDI_SERVICE_LOST},
2163859Sml29623 };
2173859Sml29623 
2183859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_rxmac[] = {
2193859Sml29623 	{NXGE_FM_EREPORT_RXMAC_UNDERFLOW,	"rxmac_underflow",
2203859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2213859Sml29623 						DDI_SERVICE_UNAFFECTED},
2223859Sml29623 	{NXGE_FM_EREPORT_RXMAC_CRC_ERRCNT_EXP,	"rxmac_crc_errcnt_exp",
2233859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2243859Sml29623 						DDI_SERVICE_UNAFFECTED},
2253859Sml29623 	{NXGE_FM_EREPORT_RXMAC_LENGTH_ERRCNT_EXP,
2263859Sml29623 						"rxmac_length_errcnt_exp",
2273859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2283859Sml29623 						DDI_SERVICE_UNAFFECTED},
2293859Sml29623 	{NXGE_FM_EREPORT_RXMAC_VIOL_ERRCNT_EXP,	"rxmac_viol_errcnt_exp",
2303859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2313859Sml29623 						DDI_SERVICE_UNAFFECTED},
2323859Sml29623 	{NXGE_FM_EREPORT_RXMAC_RXFRAG_CNT_EXP,	"rxmac_rxfrag_cnt_exp",
2333859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2343859Sml29623 						DDI_SERVICE_UNAFFECTED},
2353859Sml29623 	{NXGE_FM_EREPORT_RXMAC_ALIGN_ECNT_EXP,	"rxmac_align_ecnt_exp",
2363859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2373859Sml29623 						DDI_SERVICE_UNAFFECTED},
2383859Sml29623 	{NXGE_FM_EREPORT_RXMAC_LINKFAULT_CNT_EXP,
2393859Sml29623 						"rxmac_linkfault_cnt_exp",
2403859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2413859Sml29623 						DDI_SERVICE_UNAFFECTED},
2423859Sml29623 	{NXGE_FM_EREPORT_RXMAC_RESET_FAIL,	"rxmac_reset_fail",
2433859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2443859Sml29623 						DDI_SERVICE_UNAFFECTED},
2453859Sml29623 };
2463859Sml29623 
2473859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_tdmc[] = {
2483859Sml29623 	{NXGE_FM_EREPORT_TDMC_PREF_BUF_PAR_ERR,	"txdma_pref_buf_par_err",
2493859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2503859Sml29623 						DDI_SERVICE_DEGRADED},
2513859Sml29623 	{NXGE_FM_EREPORT_TDMC_MBOX_ERR,		"txdma_mbox_err",
2523859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2533859Sml29623 						DDI_SERVICE_DEGRADED},
2543859Sml29623 	{NXGE_FM_EREPORT_TDMC_NACK_PREF,	"txdma_nack_pref",
2553859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2563859Sml29623 						DDI_SERVICE_DEGRADED},
2573859Sml29623 	{NXGE_FM_EREPORT_TDMC_NACK_PKT_RD,	"txdma_nack_pkt_rd",
2583859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2593859Sml29623 						DDI_SERVICE_DEGRADED},
2603859Sml29623 	{NXGE_FM_EREPORT_TDMC_PKT_SIZE_ERR,	"txdma_pkt_size_err",
2613859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2623859Sml29623 						DDI_SERVICE_DEGRADED},
2633859Sml29623 	{NXGE_FM_EREPORT_TDMC_TX_RING_OFLOW,	"txdma_tx_ring_oflow",
2643859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2653859Sml29623 						DDI_SERVICE_DEGRADED},
2663859Sml29623 	{NXGE_FM_EREPORT_TDMC_CONF_PART_ERR,	"txdma_conf_part_err",
2673859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2683859Sml29623 						DDI_SERVICE_DEGRADED},
2693859Sml29623 	{NXGE_FM_EREPORT_TDMC_PKT_PRT_ERR,	"txdma_pkt_prt_err",
2703859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2713859Sml29623 						DDI_SERVICE_DEGRADED},
2723859Sml29623 	{NXGE_FM_EREPORT_TDMC_RESET_FAIL,	"txdma_reset_fail",
2733859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
2743859Sml29623 						DDI_SERVICE_LOST},
2753859Sml29623 };
2763859Sml29623 
2773859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_txc[] = {
2783859Sml29623 	{NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR,	"tx_ro_correct_err",
2793859Sml29623 						DDI_FM_DEVICE_INTERN_CORR,
2803859Sml29623 						DDI_SERVICE_UNAFFECTED},
2813859Sml29623 	{NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR,	"tx_ro_uncorrect_err",
2823859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2833859Sml29623 						DDI_SERVICE_UNAFFECTED},
2843859Sml29623 	{NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR,	"tx_sf_correct_err",
2853859Sml29623 						DDI_FM_DEVICE_INTERN_CORR,
2863859Sml29623 						DDI_SERVICE_UNAFFECTED},
2873859Sml29623 	{NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR,	"tx_sf_uncorrect_err",
2883859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2893859Sml29623 						DDI_SERVICE_UNAFFECTED},
2903859Sml29623 	{NXGE_FM_EREPORT_TXC_ASSY_DEAD,		"tx_assembly_uncorrect_err",
2913859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
2923859Sml29623 						DDI_SERVICE_UNAFFECTED},
2933859Sml29623 	{NXGE_FM_EREPORT_TXC_REORDER_ERR,	"tx_reorder_err",
2943859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
2953859Sml29623 						DDI_SERVICE_LOST},
2963859Sml29623 };
2973859Sml29623 
2983859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_txmac[] = {
2993859Sml29623 	{NXGE_FM_EREPORT_TXMAC_UNDERFLOW,	"txmac_underflow",
3003859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3013859Sml29623 						DDI_SERVICE_UNAFFECTED},
3023859Sml29623 	{NXGE_FM_EREPORT_TXMAC_OVERFLOW,	"txmac_overflow",
3033859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3043859Sml29623 						DDI_SERVICE_UNAFFECTED},
3053859Sml29623 	{NXGE_FM_EREPORT_TXMAC_TXFIFO_XFR_ERR,	"txmac_txfifo_xfr_err",
3063859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3073859Sml29623 						DDI_SERVICE_UNAFFECTED},
3083859Sml29623 	{NXGE_FM_EREPORT_TXMAC_MAX_PKT_ERR,	"txmac_max_pkt_err",
3093859Sml29623 						DDI_FM_DEVICE_INTERN_UNCORR,
3103859Sml29623 						DDI_SERVICE_UNAFFECTED},
3113859Sml29623 	{NXGE_FM_EREPORT_TXMAC_RESET_FAIL,	"txmac_reset_fail",
3123859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
3133859Sml29623 						DDI_SERVICE_UNAFFECTED},
3143859Sml29623 };
3153859Sml29623 
3163859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_espc[] = {
3173859Sml29623 	{NXGE_FM_EREPORT_ESPC_ACCESS_FAIL,	"eprom_access_fail",
3183859Sml29623 						DDI_FM_DEVICE_NO_RESPONSE,
3193859Sml29623 						DDI_SERVICE_LOST},
3203859Sml29623 };
3213859Sml29623 
3225060Syc148097 nxge_fm_ereport_attr_t nxge_fm_ereport_xaui[] = {
3235060Syc148097 	{NXGE_FM_EREPORT_XAUI_ERR,		"xaui_bad_or_missing",
3245060Syc148097 						NXGE_FM_DEVICE_XAUI_ERR,
3255060Syc148097 						DDI_SERVICE_LOST},
3265060Syc148097 };
3275060Syc148097 
3285060Syc148097 nxge_fm_ereport_attr_t nxge_fm_ereport_xfp[] = {
3295060Syc148097 	{NXGE_FM_EREPORT_XFP_ERR,		"xfp_bad_or_missing",
3305060Syc148097 						NXGE_FM_DEVICE_XFP_ERR,
3315060Syc148097 						DDI_SERVICE_LOST},
3325060Syc148097 };
3335060Syc148097 
3343859Sml29623 nxge_fm_ereport_attr_t nxge_fm_ereport_sw[] = {
3353859Sml29623 	{NXGE_FM_EREPORT_SW_INVALID_PORT_NUM,	"invalid_port_num",
3363859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3373859Sml29623 						DDI_SERVICE_LOST},
3383859Sml29623 	{NXGE_FM_EREPORT_SW_INVALID_CHAN_NUM,	"invalid_chan_num",
3393859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3403859Sml29623 						DDI_SERVICE_LOST},
3413859Sml29623 	{NXGE_FM_EREPORT_SW_INVALID_PARAM,	"invalid_param",
3423859Sml29623 						DDI_FM_DEVICE_INVAL_STATE,
3433859Sml29623 						DDI_SERVICE_LOST},
3443859Sml29623 };
3453859Sml29623 
3463859Sml29623 void
nxge_fm_init(p_nxge_t nxgep,ddi_device_acc_attr_t * reg_attr,ddi_dma_attr_t * dma_attr)3473859Sml29623 nxge_fm_init(p_nxge_t nxgep, ddi_device_acc_attr_t *reg_attr,
348*11236SStephen.Hanson@Sun.COM 	ddi_dma_attr_t *dma_attr)
3493859Sml29623 {
3503859Sml29623 	ddi_iblock_cookie_t iblk;
3513859Sml29623 
3525060Syc148097 	/*
3535060Syc148097 	 * fm-capable in nxge.conf can be used to set fm_capabilities.
3545060Syc148097 	 * If fm-capable is not defined, then the last argument passed to
3555060Syc148097 	 * ddi_prop_get_int will be returned as the capabilities.
3565060Syc148097 	 */
3573859Sml29623 	nxgep->fm_capabilities = ddi_prop_get_int(DDI_DEV_T_ANY, nxgep->dip,
3585060Syc148097 	    DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "fm-capable",
3595060Syc148097 	    DDI_FM_EREPORT_CAPABLE | DDI_FM_ERRCB_CAPABLE);
3605060Syc148097 
3616495Sspeer 	NXGE_ERROR_MSG((nxgep, DDI_CTL,
3626929Smisaki 	    "FM capable = %d\n", nxgep->fm_capabilities));
3633859Sml29623 
3646495Sspeer 	if (isLDOMguest(nxgep)) {
3656495Sspeer 		nxgep->fm_capabilities = DDI_FM_NOT_CAPABLE;
3666495Sspeer 		return;
3676495Sspeer 	}
3686495Sspeer 
3695060Syc148097 	/*
3705060Syc148097 	 * Register capabilities with IO Fault Services. The capabilities
3715060Syc148097 	 * set above may not be supported by the parent nexus, in that case
3725060Syc148097 	 * some capability bits may be cleared.
3735060Syc148097 	 */
3745060Syc148097 	if (nxgep->fm_capabilities)
3753859Sml29623 		ddi_fm_init(nxgep->dip, &nxgep->fm_capabilities, &iblk);
3763859Sml29623 
3775060Syc148097 	/*
3785060Syc148097 	 * Initialize pci ereport capabilities if ereport capable
3795060Syc148097 	 */
3805060Syc148097 	if (DDI_FM_EREPORT_CAP(nxgep->fm_capabilities) ||
3815060Syc148097 	    DDI_FM_ERRCB_CAP(nxgep->fm_capabilities)) {
3825060Syc148097 		pci_ereport_setup(nxgep->dip);
3835060Syc148097 	}
3845060Syc148097 
3855060Syc148097 	/* Register error callback if error callback capable */
3865060Syc148097 	if (DDI_FM_ERRCB_CAP(nxgep->fm_capabilities)) {
3875060Syc148097 		ddi_fm_handler_register(nxgep->dip,
3885060Syc148097 		    nxge_fm_error_cb, (void*) nxgep);
3895060Syc148097 	}
3905060Syc148097 
3915060Syc148097 	/*
3925060Syc148097 	 * DDI_FLGERR_ACC indicates:
3935060Syc148097 	 * o Driver will check its access handle(s) for faults on
3945060Syc148097 	 *   a regular basis by calling ddi_fm_acc_err_get
3955060Syc148097 	 * o Driver is able to cope with incorrect results of I/O
3965060Syc148097 	 *   operations resulted from an I/O fault
3975060Syc148097 	 */
3985060Syc148097 	if (DDI_FM_ACC_ERR_CAP(nxgep->fm_capabilities)) {
3995060Syc148097 		reg_attr->devacc_attr_access  = DDI_FLAGERR_ACC;
4003859Sml29623 	} else {
4015060Syc148097 		reg_attr->devacc_attr_access  = DDI_DEFAULT_ACC;
4025060Syc148097 	}
4035060Syc148097 
4045060Syc148097 	/*
4055060Syc148097 	 * DDI_DMA_FLAGERR indicates:
4065060Syc148097 	 * o Driver will check its DMA handle(s) for faults on a
4075060Syc148097 	 *   regular basis using ddi_fm_dma_err_get
4085060Syc148097 	 * o Driver is able to cope with incorrect results of DMA
4095060Syc148097 	 *   operations resulted from an I/O fault
4105060Syc148097 	 */
4115060Syc148097 	if (DDI_FM_DMA_ERR_CAP(nxgep->fm_capabilities))
4125060Syc148097 		dma_attr->dma_attr_flags |= DDI_DMA_FLAGERR;
4135060Syc148097 	else
4144439Sml29623 		dma_attr->dma_attr_flags &= ~DDI_DMA_FLAGERR;
4155060Syc148097 
4163859Sml29623 }
4173859Sml29623 
4183859Sml29623 void
nxge_fm_fini(p_nxge_t nxgep)4193859Sml29623 nxge_fm_fini(p_nxge_t nxgep)
4203859Sml29623 {
4213859Sml29623 	/* Only unregister FMA capabilities if we registered some */
4223859Sml29623 	if (nxgep->fm_capabilities) {
4233859Sml29623 
4243859Sml29623 		/*
4253859Sml29623 		 * Release any resources allocated by pci_ereport_setup()
4263859Sml29623 		 */
4273859Sml29623 		if (DDI_FM_EREPORT_CAP(nxgep->fm_capabilities) ||
4283859Sml29623 		    DDI_FM_ERRCB_CAP(nxgep->fm_capabilities))
4293859Sml29623 			pci_ereport_teardown(nxgep->dip);
4303859Sml29623 
4313859Sml29623 		/*
4323859Sml29623 		 * Un-register error callback if error callback capable
4333859Sml29623 		 */
4343859Sml29623 		if (DDI_FM_ERRCB_CAP(nxgep->fm_capabilities))
4353859Sml29623 			ddi_fm_handler_unregister(nxgep->dip);
4363859Sml29623 
4373859Sml29623 		/* Unregister from IO Fault Services */
4383859Sml29623 		ddi_fm_fini(nxgep->dip);
4393859Sml29623 	}
4403859Sml29623 }
4413859Sml29623 
4425060Syc148097 /*ARGSUSED*/
4435060Syc148097 /*
4445060Syc148097  * Simply call pci_ereport_post which generates ereports for errors
4455060Syc148097  * that occur in the PCI local bus configuration status registers.
4465060Syc148097  */
4475060Syc148097 static int
nxge_fm_error_cb(dev_info_t * dip,ddi_fm_error_t * err,const void * impl_data)4485060Syc148097 nxge_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err,
4495060Syc148097 	const void *impl_data)
4503859Sml29623 {
4515060Syc148097 	pci_ereport_post(dip, err, NULL);
4525060Syc148097 	return (err->fme_status);
4535060Syc148097 }
4543859Sml29623 
4553859Sml29623 
4563859Sml29623 static nxge_fm_ereport_attr_t *
nxge_fm_get_ereport_attr(nxge_fm_ereport_id_t ereport_id)4573859Sml29623 nxge_fm_get_ereport_attr(nxge_fm_ereport_id_t ereport_id)
4583859Sml29623 {
4593859Sml29623 	nxge_fm_ereport_attr_t *attr;
4605060Syc148097 	uint8_t	blk_id = (ereport_id >> EREPORT_FM_ID_SHIFT) &
4615060Syc148097 	    EREPORT_FM_ID_MASK;
4625060Syc148097 	uint8_t index = ereport_id & EREPORT_INDEX_MASK;
4633859Sml29623 
4643859Sml29623 	switch (blk_id) {
4653859Sml29623 	case FM_SW_ID:
4663859Sml29623 		attr = &nxge_fm_ereport_sw[index];
4673859Sml29623 		break;
4683859Sml29623 	case FM_PCS_ID:
4693859Sml29623 		attr = &nxge_fm_ereport_pcs[index];
4703859Sml29623 		break;
4713859Sml29623 	case FM_TXMAC_ID:
4723859Sml29623 		attr = &nxge_fm_ereport_txmac[index];
4733859Sml29623 		break;
4743859Sml29623 	case FM_RXMAC_ID:
4753859Sml29623 		attr = &nxge_fm_ereport_rxmac[index];
4763859Sml29623 		break;
4773859Sml29623 	case FM_MIF_ID:
4783859Sml29623 		attr = &nxge_fm_ereport_mif[index];
4793859Sml29623 		break;
4803859Sml29623 	case FM_FFLP_ID:
4813859Sml29623 		attr = &nxge_fm_ereport_fflp[index];
4823859Sml29623 		break;
4833859Sml29623 	case FM_ZCP_ID:
4843859Sml29623 		attr = &nxge_fm_ereport_zcp[index];
4853859Sml29623 		break;
4863859Sml29623 	case FM_RXDMA_ID:
4873859Sml29623 		attr = &nxge_fm_ereport_rdmc[index];
4883859Sml29623 		break;
4893859Sml29623 	case FM_TXDMA_ID:
4903859Sml29623 		attr = &nxge_fm_ereport_tdmc[index];
4913859Sml29623 		break;
4923859Sml29623 	case FM_IPP_ID:
4933859Sml29623 		attr = &nxge_fm_ereport_ipp[index];
4943859Sml29623 		break;
4953859Sml29623 	case FM_TXC_ID:
4963859Sml29623 		attr = &nxge_fm_ereport_txc[index];
4973859Sml29623 		break;
4983859Sml29623 	case FM_ESPC_ID:
4993859Sml29623 		attr = &nxge_fm_ereport_espc[index];
5003859Sml29623 		break;
5015060Syc148097 	case FM_XAUI_ID:
5025060Syc148097 		attr = &nxge_fm_ereport_xaui[index];
5035060Syc148097 		break;
5045060Syc148097 	case FM_XFP_ID:
5055060Syc148097 		attr = &nxge_fm_ereport_xfp[index];
5065060Syc148097 		break;
5073859Sml29623 	default:
5083859Sml29623 		attr = NULL;
5093859Sml29623 	}
5103859Sml29623 
5113859Sml29623 	return (attr);
5123859Sml29623 }
5133859Sml29623 
5143859Sml29623 static void
nxge_fm_ereport(p_nxge_t nxgep,uint8_t err_portn,uint8_t err_chan,nxge_fm_ereport_attr_t * ereport)5153859Sml29623 nxge_fm_ereport(p_nxge_t nxgep, uint8_t err_portn, uint8_t err_chan,
5163859Sml29623 					nxge_fm_ereport_attr_t *ereport)
5173859Sml29623 {
5183859Sml29623 	uint64_t		ena;
5193859Sml29623 	char			eclass[FM_MAX_CLASS];
5203859Sml29623 	char			*err_str;
5213859Sml29623 	p_nxge_stats_t		statsp;
5223859Sml29623 
5233859Sml29623 	(void) snprintf(eclass, FM_MAX_CLASS, "%s.%s", DDI_FM_DEVICE,
5246929Smisaki 	    ereport->eclass);
5253859Sml29623 	err_str = ereport->str;
5263859Sml29623 	ena = fm_ena_generate(0, FM_ENA_FMT1);
5273859Sml29623 	statsp = nxgep->statsp;
5283859Sml29623 
5295523Syc148097 	switch (ereport->index) {
5303859Sml29623 		case NXGE_FM_EREPORT_XPCS_LINK_DOWN:
5313859Sml29623 		case NXGE_FM_EREPORT_XPCS_TX_LINK_FAULT:
5323859Sml29623 		case NXGE_FM_EREPORT_XPCS_RX_LINK_FAULT:
5333859Sml29623 		case NXGE_FM_EREPORT_PCS_LINK_DOWN:
5343859Sml29623 		case NXGE_FM_EREPORT_PCS_REMOTE_FAULT:
5353859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5365060Syc148097 			    DDI_NOSLEEP,
5375060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5385060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5395060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5405060Syc148097 			    NULL);
5413859Sml29623 			break;
5423859Sml29623 		case NXGE_FM_EREPORT_IPP_EOP_MISS:
5433859Sml29623 		case NXGE_FM_EREPORT_IPP_SOP_MISS:
5443859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5455060Syc148097 			    DDI_NOSLEEP,
5465060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5475060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5485060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5495060Syc148097 			    ERNAME_DFIFO_RD_PTR, DATA_TYPE_UINT16,
5505060Syc148097 			    statsp->ipp_stats.errlog.dfifo_rd_ptr,
5515060Syc148097 			    ERNAME_IPP_STATE_MACH, DATA_TYPE_UINT32,
5525060Syc148097 			    statsp->ipp_stats.errlog.state_mach,
5535060Syc148097 			    NULL);
5543859Sml29623 			break;
5553859Sml29623 		case NXGE_FM_EREPORT_IPP_DFIFO_UE:
5563859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5575060Syc148097 			    DDI_NOSLEEP,
5585060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5595060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5605060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5615060Syc148097 			    ERNAME_DFIFO_ENTRY, DATA_TYPE_UINT16,
5625060Syc148097 			    nxgep->ipp.status.bits.w0.dfifo_ecc_err_idx,
5635060Syc148097 			    ERNAME_DFIFO_SYNDROME, DATA_TYPE_UINT16,
5645060Syc148097 			    statsp->ipp_stats.errlog.ecc_syndrome,
5655060Syc148097 			    NULL);
5663859Sml29623 			break;
5673859Sml29623 		case NXGE_FM_EREPORT_IPP_PFIFO_PERR:
5683859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5695060Syc148097 			    DDI_NOSLEEP,
5705060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5715060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5725060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5735060Syc148097 			    ERNAME_PFIFO_ENTRY, DATA_TYPE_UINT8,
5745060Syc148097 			    nxgep->ipp.status.bits.w0.pre_fifo_perr_idx,
5755060Syc148097 			    NULL);
5763859Sml29623 			break;
5773859Sml29623 		case NXGE_FM_EREPORT_IPP_DFIFO_CE:
5783859Sml29623 		case NXGE_FM_EREPORT_IPP_ECC_ERR_MAX:
5793859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5805060Syc148097 			    DDI_NOSLEEP,
5815060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5825060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5835060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5845060Syc148097 			    NULL);
5853859Sml29623 			break;
5863859Sml29623 		case NXGE_FM_EREPORT_IPP_PFIFO_OVER:
5873859Sml29623 		case NXGE_FM_EREPORT_IPP_PFIFO_UND:
5883859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
5895060Syc148097 			    DDI_NOSLEEP,
5905060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
5915060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
5925060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
5935060Syc148097 			    ERNAME_IPP_STATE_MACH, DATA_TYPE_UINT32,
5945060Syc148097 			    statsp->ipp_stats.errlog.state_mach,
5955060Syc148097 			    NULL);
5963859Sml29623 			break;
5973859Sml29623 		case NXGE_FM_EREPORT_IPP_BAD_CS_MX:
5983859Sml29623 		case NXGE_FM_EREPORT_IPP_PKT_DIS_MX:
5993859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6005060Syc148097 			    DDI_NOSLEEP,
6015060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6025060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6035060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
6045060Syc148097 			    NULL);
6053859Sml29623 			break;
6063859Sml29623 		case NXGE_FM_EREPORT_FFLP_TCAM_ERR:
6073859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6085060Syc148097 			    DDI_NOSLEEP,
6095060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6105060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6115060Syc148097 			    ERNAME_TCAM_ERR_LOG, DATA_TYPE_UINT32,
6125060Syc148097 			    statsp->fflp_stats.errlog.tcam,
6135060Syc148097 			    NULL);
6143859Sml29623 			break;
6153859Sml29623 		case NXGE_FM_EREPORT_FFLP_VLAN_PAR_ERR:
6163859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6175060Syc148097 			    DDI_NOSLEEP,
6185060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6195060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6205060Syc148097 			    ERNAME_VLANTAB_ERR_LOG, DATA_TYPE_UINT32,
6215060Syc148097 			    statsp->fflp_stats.errlog.vlan,
6225060Syc148097 			    NULL);
6233859Sml29623 			break;
6243859Sml29623 		case NXGE_FM_EREPORT_FFLP_HASHT_DATA_ERR:
6253859Sml29623 		{
6263859Sml29623 			int rdc_grp;
6273859Sml29623 			hash_tbl_data_log_t hash_log;
6283859Sml29623 
6293859Sml29623 			for (rdc_grp = 0; rdc_grp < MAX_PARTITION; rdc_grp++) {
6303859Sml29623 				hash_log.value = nxgep->classifier.fflp_stats->
6316929Smisaki 				    errlog.hash_pio[rdc_grp];
6323859Sml29623 				if (hash_log.bits.ldw.pio_err) {
6333859Sml29623 					ddi_fm_ereport_post(nxgep->dip, eclass,
6346929Smisaki 					    ena, DDI_NOSLEEP,
6356929Smisaki 					    FM_VERSION, DATA_TYPE_UINT8,
6366929Smisaki 					    FM_EREPORT_VERS0,
6376929Smisaki 					    ERNAME_DETAILED_ERR_TYPE,
6386929Smisaki 					    DATA_TYPE_STRING, err_str,
6396929Smisaki 					    ERNAME_HASHTAB_ERR_LOG,
6406929Smisaki 					    DATA_TYPE_UINT32,
6416929Smisaki 					    nxgep->classifier.fflp_stats->
6426929Smisaki 					    errlog.hash_pio[rdc_grp], NULL);
6433859Sml29623 				}
6443859Sml29623 			}
6453859Sml29623 		}
6463859Sml29623 			break;
6473859Sml29623 		case NXGE_FM_EREPORT_FFLP_HASHT_LOOKUP_ERR:
6483859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6495060Syc148097 			    DDI_NOSLEEP,
6505060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6515060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6525060Syc148097 			    ERNAME_HASHT_LOOKUP_ERR_LOG0, DATA_TYPE_UINT32,
6535060Syc148097 			    statsp->fflp_stats.errlog. hash_lookup1,
6545060Syc148097 			    ERNAME_HASHT_LOOKUP_ERR_LOG1, DATA_TYPE_UINT32,
6555060Syc148097 			    statsp->fflp_stats.errlog.hash_lookup2,
6565060Syc148097 			    NULL);
6573859Sml29623 			break;
6583859Sml29623 		case NXGE_FM_EREPORT_RDMC_DCF_ERR:
6593859Sml29623 		case NXGE_FM_EREPORT_RDMC_RBR_TMOUT:
6603859Sml29623 		case NXGE_FM_EREPORT_RDMC_RSP_CNT_ERR:
6613859Sml29623 		case NXGE_FM_EREPORT_RDMC_BYTE_EN_BUS:
6623859Sml29623 		case NXGE_FM_EREPORT_RDMC_RSP_DAT_ERR:
6633859Sml29623 		case NXGE_FM_EREPORT_RDMC_RCR_ACK_ERR:
6643859Sml29623 		case NXGE_FM_EREPORT_RDMC_DC_FIFO_ERR:
6653859Sml29623 		case NXGE_FM_EREPORT_RDMC_CONFIG_ERR:
6663859Sml29623 		case NXGE_FM_EREPORT_RDMC_RCRINCON:
6673859Sml29623 		case NXGE_FM_EREPORT_RDMC_RCRFULL:
6683859Sml29623 		case NXGE_FM_EREPORT_RDMC_RBRFULL:
6693859Sml29623 		case NXGE_FM_EREPORT_RDMC_RBRLOGPAGE:
6703859Sml29623 		case NXGE_FM_EREPORT_RDMC_CFIGLOGPAGE:
6713859Sml29623 		case NXGE_FM_EREPORT_RDMC_ID_MISMATCH:
6723859Sml29623 		case NXGE_FM_EREPORT_RDMC_ZCP_EOP_ERR:
6733859Sml29623 		case NXGE_FM_EREPORT_RDMC_IPP_EOP_ERR:
6743859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6755060Syc148097 			    DDI_NOSLEEP,
6765060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6775060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6785060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
6795060Syc148097 			    ERNAME_ERR_DCHAN, DATA_TYPE_UINT8, err_chan,
6805060Syc148097 			    NULL);
6813859Sml29623 			break;
6823859Sml29623 		case NXGE_FM_EREPORT_RDMC_RBR_PRE_PAR:
6833859Sml29623 		case NXGE_FM_EREPORT_RDMC_RCR_SHA_PAR:
6843859Sml29623 			{
6853859Sml29623 			uint32_t err_log;
6863859Sml29623 			if (ereport->index == NXGE_FM_EREPORT_RDMC_RBR_PRE_PAR)
6873859Sml29623 				err_log = (uint32_t)statsp->
6886929Smisaki 				    rdc_stats[err_chan].errlog.pre_par.value;
6893859Sml29623 			else
6903859Sml29623 				err_log = (uint32_t)statsp->
6916929Smisaki 				    rdc_stats[err_chan].errlog.sha_par.value;
6923859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
6935060Syc148097 			    DDI_NOSLEEP,
6945060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
6955060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
6965060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
6975060Syc148097 			    ERNAME_ERR_DCHAN, DATA_TYPE_UINT8, err_chan,
6985060Syc148097 			    ERNAME_RDMC_PAR_ERR_LOG, DATA_TYPE_UINT8, err_log,
6995060Syc148097 			    NULL);
7003859Sml29623 			}
7013859Sml29623 			break;
7025165Syc148097 		case NXGE_FM_EREPORT_RDMC_RCR_ERR:
7033859Sml29623 			{
7043859Sml29623 			uint8_t err_type;
7053859Sml29623 			err_type = statsp->
7066929Smisaki 			    rdc_stats[err_chan].errlog.compl_err_type;
7073859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7085060Syc148097 			    DDI_NOSLEEP,
7095060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7105060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7115060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7125060Syc148097 			    ERNAME_ERR_DCHAN, DATA_TYPE_UINT8, err_chan,
7135060Syc148097 			    ERNAME_RDC_ERR_TYPE, DATA_TYPE_UINT8, err_type,
7145060Syc148097 			    NULL);
7153859Sml29623 			}
7163859Sml29623 			break;
7173859Sml29623 
7183859Sml29623 		case NXGE_FM_EREPORT_ZCP_RRFIFO_UNDERRUN:
7193859Sml29623 		case NXGE_FM_EREPORT_ZCP_RRFIFO_OVERRUN:
7203859Sml29623 		case NXGE_FM_EREPORT_ZCP_BUFFER_OVERFLOW:
7213859Sml29623 			{
7223859Sml29623 			uint32_t sm;
7233859Sml29623 			sm = statsp->
7246929Smisaki 			    zcp_stats.errlog.state_mach.bits.ldw.state;
7253859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7265060Syc148097 			    DDI_NOSLEEP,
7275060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7285060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7295060Syc148097 			    sm, DATA_TYPE_UINT32,
7305060Syc148097 			    NULL);
7313859Sml29623 			break;
7323859Sml29623 			}
7333859Sml29623 		case NXGE_FM_EREPORT_ZCP_CFIFO_ECC:
7343859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7355060Syc148097 			    DDI_NOSLEEP,
7365060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7375060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7385060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7395060Syc148097 			    NULL);
7403859Sml29623 			break;
7413859Sml29623 		case NXGE_FM_EREPORT_ZCP_RSPFIFO_UNCORR_ERR:
7423859Sml29623 		case NXGE_FM_EREPORT_ZCP_STAT_TBL_PERR:
7433859Sml29623 		case NXGE_FM_EREPORT_ZCP_DYN_TBL_PERR:
7443859Sml29623 		case NXGE_FM_EREPORT_ZCP_BUF_TBL_PERR:
7453859Sml29623 		case NXGE_FM_EREPORT_ZCP_TT_PROGRAM_ERR:
7463859Sml29623 		case NXGE_FM_EREPORT_ZCP_RSP_TT_INDEX_ERR:
7473859Sml29623 		case NXGE_FM_EREPORT_ZCP_SLV_TT_INDEX_ERR:
7483859Sml29623 		case NXGE_FM_EREPORT_ZCP_TT_INDEX_ERR:
7493859Sml29623 		case NXGE_FM_EREPORT_RXMAC_UNDERFLOW:
7503859Sml29623 		case NXGE_FM_EREPORT_RXMAC_CRC_ERRCNT_EXP:
7513859Sml29623 		case NXGE_FM_EREPORT_RXMAC_LENGTH_ERRCNT_EXP:
7523859Sml29623 		case NXGE_FM_EREPORT_RXMAC_VIOL_ERRCNT_EXP:
7533859Sml29623 		case NXGE_FM_EREPORT_RXMAC_RXFRAG_CNT_EXP:
7543859Sml29623 		case NXGE_FM_EREPORT_RXMAC_LINKFAULT_CNT_EXP:
7553859Sml29623 		case NXGE_FM_EREPORT_RXMAC_ALIGN_ECNT_EXP:
7563859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7575060Syc148097 			    DDI_NOSLEEP,
7585060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7595060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7605060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7615060Syc148097 			    NULL);
7623859Sml29623 			break;
7633859Sml29623 		case NXGE_FM_EREPORT_TDMC_MBOX_ERR:
7643859Sml29623 		case NXGE_FM_EREPORT_TDMC_TX_RING_OFLOW:
7653859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7665060Syc148097 			    DDI_NOSLEEP,
7675060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7685060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7695060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7705060Syc148097 			    ERNAME_ERR_DCHAN, DATA_TYPE_UINT8, err_chan,
7715060Syc148097 			    NULL);
7723859Sml29623 			break;
7733859Sml29623 		case NXGE_FM_EREPORT_TDMC_PREF_BUF_PAR_ERR:
7743859Sml29623 		case NXGE_FM_EREPORT_TDMC_NACK_PREF:
7753859Sml29623 		case NXGE_FM_EREPORT_TDMC_NACK_PKT_RD:
7763859Sml29623 		case NXGE_FM_EREPORT_TDMC_PKT_SIZE_ERR:
7773859Sml29623 		case NXGE_FM_EREPORT_TDMC_CONF_PART_ERR:
7783859Sml29623 		case NXGE_FM_EREPORT_TDMC_PKT_PRT_ERR:
7793859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7805060Syc148097 			    DDI_NOSLEEP,
7815060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7825060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7835060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7845060Syc148097 			    ERNAME_ERR_DCHAN, DATA_TYPE_UINT8, err_chan,
7855060Syc148097 			    ERNAME_TDMC_ERR_LOG1, DATA_TYPE_UINT32,
7865060Syc148097 			    statsp->tdc_stats[err_chan].errlog.logl.value,
7875060Syc148097 			    ERNAME_TDMC_ERR_LOG1, DATA_TYPE_UINT32,
7885060Syc148097 			    statsp->tdc_stats[err_chan].errlog.logh.value,
7895060Syc148097 			    DATA_TYPE_UINT32,
7905060Syc148097 			    NULL);
7913859Sml29623 			break;
7923859Sml29623 		case NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR:
7933859Sml29623 		case NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR:
7943859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
7955060Syc148097 			    DDI_NOSLEEP,
7965060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
7975060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
7985060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
7995060Syc148097 			    ERNAME_TXC_ROECC_ADDR, DATA_TYPE_UINT16,
8005060Syc148097 			    statsp->txc_stats.errlog.ro_st.roecc.
8015060Syc148097 			    bits.ldw.ecc_address,
8025060Syc148097 			    ERNAME_TXC_ROECC_DATA0, DATA_TYPE_UINT32,
8035060Syc148097 			    statsp->txc_stats.errlog.ro_st.d0.
8045060Syc148097 			    bits.ldw.ro_ecc_data0,
8055060Syc148097 			    ERNAME_TXC_ROECC_DATA1, DATA_TYPE_UINT32,
8065060Syc148097 			    statsp->txc_stats.errlog.ro_st.d1.
8075060Syc148097 			    bits.ldw.ro_ecc_data1,
8085060Syc148097 			    ERNAME_TXC_ROECC_DATA2, DATA_TYPE_UINT32,
8095060Syc148097 			    statsp->txc_stats.errlog.ro_st.d2.
8105060Syc148097 			    bits.ldw.ro_ecc_data2,
8115060Syc148097 			    ERNAME_TXC_ROECC_DATA3, DATA_TYPE_UINT32,
8125060Syc148097 			    statsp->txc_stats.errlog.ro_st.d3.
8135060Syc148097 			    bits.ldw.ro_ecc_data3,
8145060Syc148097 			    ERNAME_TXC_ROECC_DATA4, DATA_TYPE_UINT32,
8155060Syc148097 			    statsp->txc_stats.errlog.ro_st.d4.
8165060Syc148097 			    bits.ldw.ro_ecc_data4,
8175060Syc148097 			    NULL);
8183859Sml29623 			break;
8193859Sml29623 		case NXGE_FM_EREPORT_TXC_REORDER_ERR:
8203859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
8215060Syc148097 			    DDI_NOSLEEP,
8225060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
8235060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
8245060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
8255060Syc148097 			    ERNAME_TXC_RO_STATE0, DATA_TYPE_UINT32,
8265060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.st0.value,
8275060Syc148097 			    ERNAME_TXC_RO_STATE1, DATA_TYPE_UINT32,
8285060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.st1.value,
8295060Syc148097 			    ERNAME_TXC_RO_STATE2, DATA_TYPE_UINT32,
8305060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.st2.value,
8315060Syc148097 			    ERNAME_TXC_RO_STATE3, DATA_TYPE_UINT32,
8325060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.st3.value,
8335060Syc148097 			    ERNAME_TXC_RO_STATE_CTL, DATA_TYPE_UINT32,
8345060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.ctl.value,
8355060Syc148097 			    ERNAME_TXC_RO_TIDS, DATA_TYPE_UINT32,
8365060Syc148097 			    (uint32_t)statsp->txc_stats.errlog.ro_st.tids.value,
8375060Syc148097 			    NULL);
8383859Sml29623 			break;
8393859Sml29623 		case NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR:
8403859Sml29623 		case NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR:
8413859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
8425060Syc148097 			    DDI_NOSLEEP,
8435060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
8445060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
8455060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
8465060Syc148097 			    ERNAME_TXC_SFECC_ADDR, DATA_TYPE_UINT32,
8475060Syc148097 			    statsp->txc_stats.errlog.sf_st.sfecc.
8485060Syc148097 			    bits.ldw.ecc_address,
8495060Syc148097 			    ERNAME_TXC_SFECC_DATA0, DATA_TYPE_UINT32,
8505060Syc148097 			    statsp->txc_stats.errlog.sf_st.d0.
8515060Syc148097 			    bits.ldw.sf_ecc_data0,
8525060Syc148097 			    ERNAME_TXC_SFECC_DATA0, DATA_TYPE_UINT32,
8535060Syc148097 			    statsp->txc_stats.errlog.sf_st.d1.
8545060Syc148097 			    bits.ldw.sf_ecc_data1,
8555060Syc148097 			    ERNAME_TXC_SFECC_DATA0, DATA_TYPE_UINT32,
8565060Syc148097 			    statsp->txc_stats.errlog.sf_st.d2.
8575060Syc148097 			    bits.ldw.sf_ecc_data2,
8585060Syc148097 			    ERNAME_TXC_SFECC_DATA0, DATA_TYPE_UINT32,
8595060Syc148097 			    statsp->txc_stats.errlog.sf_st.d3.
8605060Syc148097 			    bits.ldw.sf_ecc_data3,
8615060Syc148097 			    ERNAME_TXC_SFECC_DATA0, DATA_TYPE_UINT32,
8625060Syc148097 			    statsp->txc_stats.errlog.sf_st.d4.
8635060Syc148097 			    bits.ldw.sf_ecc_data4,
8645060Syc148097 			    NULL);
8653859Sml29623 			break;
8663859Sml29623 		case NXGE_FM_EREPORT_TXMAC_UNDERFLOW:
8673859Sml29623 		case NXGE_FM_EREPORT_TXMAC_OVERFLOW:
8683859Sml29623 		case NXGE_FM_EREPORT_TXMAC_TXFIFO_XFR_ERR:
8693859Sml29623 		case NXGE_FM_EREPORT_TXMAC_MAX_PKT_ERR:
8705060Syc148097 		case NXGE_FM_EREPORT_XAUI_ERR:
8715060Syc148097 		case NXGE_FM_EREPORT_XFP_ERR:
8723859Sml29623 		case NXGE_FM_EREPORT_SW_INVALID_PORT_NUM:
8733859Sml29623 		case NXGE_FM_EREPORT_SW_INVALID_CHAN_NUM:
8743859Sml29623 		case NXGE_FM_EREPORT_SW_INVALID_PARAM:
8753859Sml29623 			ddi_fm_ereport_post(nxgep->dip, eclass, ena,
8765060Syc148097 			    DDI_NOSLEEP,
8775060Syc148097 			    FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0,
8785060Syc148097 			    ERNAME_DETAILED_ERR_TYPE, DATA_TYPE_STRING, err_str,
8795060Syc148097 			    ERNAME_ERR_PORTN, DATA_TYPE_UINT8, err_portn,
8805060Syc148097 			    NULL);
8813859Sml29623 			break;
8823859Sml29623 	}
8833859Sml29623 }
8843859Sml29623 
8853859Sml29623 void
nxge_fm_report_error(p_nxge_t nxgep,uint8_t err_portn,uint8_t err_chan,nxge_fm_ereport_id_t fm_ereport_id)8863859Sml29623 nxge_fm_report_error(p_nxge_t nxgep, uint8_t err_portn, uint8_t err_chan,
8873859Sml29623 					nxge_fm_ereport_id_t fm_ereport_id)
8883859Sml29623 {
8895060Syc148097 	nxge_fm_ereport_attr_t		*fm_ereport_attr;
8903859Sml29623 
8913859Sml29623 	fm_ereport_attr = nxge_fm_get_ereport_attr(fm_ereport_id);
8925523Syc148097 	if (fm_ereport_attr != NULL &&
8935523Syc148097 	    (DDI_FM_EREPORT_CAP(nxgep->fm_capabilities))) {
8943859Sml29623 		nxge_fm_ereport(nxgep, err_portn, err_chan, fm_ereport_attr);
8953859Sml29623 		ddi_fm_service_impact(nxgep->dip, fm_ereport_attr->impact);
8963859Sml29623 	}
8973859Sml29623 }
8983859Sml29623 
8993859Sml29623 int
fm_check_acc_handle(ddi_acc_handle_t handle)9003859Sml29623 fm_check_acc_handle(ddi_acc_handle_t handle)
9013859Sml29623 {
9023859Sml29623 	ddi_fm_error_t err;
9033859Sml29623 
9043859Sml29623 	ddi_fm_acc_err_get(handle, &err, DDI_FME_VERSION);
9053859Sml29623 #ifndef	NXGE_FM_S10
9063859Sml29623 	ddi_fm_acc_err_clear(handle, DDI_FME_VERSION);
9073859Sml29623 #endif
9083859Sml29623 	return (err.fme_status);
9093859Sml29623 }
9103859Sml29623 
9113859Sml29623 int
fm_check_dma_handle(ddi_dma_handle_t handle)9123859Sml29623 fm_check_dma_handle(ddi_dma_handle_t handle)
9133859Sml29623 {
9143859Sml29623 	ddi_fm_error_t err;
9153859Sml29623 
9163859Sml29623 	ddi_fm_dma_err_get(handle, &err, DDI_FME_VERSION);
9173859Sml29623 	return (err.fme_status);
9183859Sml29623 }
919