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 (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /* Copyright 2015 QLogic Corporation */
23
24 /*
25 * ***********************************************************************
26 * * **
27 * * NOTICE **
28 * * COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION **
29 * * ALL RIGHTS RESERVED **
30 * * **
31 * ***********************************************************************
32 *
33 */
34
35 #ifndef _QL_FM_H
36 #define _QL_FM_H
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42
43 /* standard I/O controller eclass already defined in sys/fm/ddi.h */
44 /* DDI_FM_DEVICE_INVAL_STATE "inval_state" etc */
45
46 /* qlc HBA specific ereport definitions */
47 #define QL_FM_DEVICE "qlc"
48
49 /* qlc HBA specific event defs */
50 #define QL_FM_DEVICE_DMA_ERR "qlc.dma_err"
51 #define QL_FM_DEVICE_BAD_PAYLOAD "qlc.bad_payload"
52 #define QL_FM_DEVICE_CMD_FAILED "qlc.cmd_failed"
53 #define QL_FM_DEVICE_CHIP_HANG "qlc.chip_hang"
54 #define QL_FM_DEVICE_UNKNOWN "qlc.unknown"
55 #define QL_FM_DEVICE_MBA_REQ_TRANSFER_ERR "qlc.asyn_mbx_req_err"
56 #define QL_FM_DEVICE_MBA_RSP_TRANSFER_ERR "qlc.asyn_mbx_rsp_err"
57 #define QL_FM_DEVICE_ACC_HANDLE_ERR "qlc.acc_hdl_err"
58 #define QL_FM_DEVICE_DMA_HANDLE_ERR "qlc.dma_hdl_err"
59
60 #define QL_FM_MAX_CLASS 256
61
62
63 typedef struct qlc_fm_ereport {
64 uint32_t fid; /* Fault Id */
65 char *desc;
66 char *eclass; /* Error class */
67 char *gen_eclass; /* Standard error class */
68 ddi_fault_impact_t impact_code;
69 } qlc_fm_ereport_t;
70
71
72 /* define fid */
73
74 typedef enum {
75 QL_FM_EREPORT_DMA_ERR = 0,
76 QL_FM_EREPORT_BAD_PAYLOAD,
77 QL_FM_EREPORT_CMD_FAILED,
78 QL_FM_EREPORT_CHIP_HANG,
79 QL_FM_EREPORT_UNKNOWN,
80 QL_FM_EREPORT_MBA_REQ_TRANSFER_ERR,
81 QL_FM_EREPORT_MBA_RSP_TRANSFER_ERR,
82 QL_FM_EREPORT_ACC_HANDLE_CHECK,
83 QL_FM_EREPORT_DMA_HANDLE_CHECK,
84 QL_FM_EREPORT_NONE
85 } qlc_fm_ereport_fid_t;
86
87 extern ddi_device_acc_attr_t ql_dev_acc_attr;
88 extern ddi_dma_attr_t ql_64bit_io_dma_attr;
89 extern ddi_dma_attr_t ql_32bit_io_dma_attr;
90
91 int qlc_fm_check_acc_handle(ql_adapter_state_t *, ddi_acc_handle_t);
92 int qlc_fm_check_dma_handle(ql_adapter_state_t *, ddi_dma_handle_t);
93 int qlc_fm_error_cb(dev_info_t *, ddi_fm_error_t *,
94 const void *);
95 void qlc_fm_init(ql_adapter_state_t *);
96 void qlc_fm_fini(ql_adapter_state_t *);
97 void qlc_fm_report_err_impact(ql_adapter_state_t *, uint32_t);
98 void qlc_fm_service_impact(ql_adapter_state_t *, int);
99 void qlc_fm_check_pkt_dma_handle(ql_adapter_state_t *, ql_srb_t *);
100
101
102 #ifdef __cplusplus
103 }
104 #endif
105
106 #endif /* _QL_FM_H */