xref: /illumos-gate/usr/src/uts/sun4u/io/px/px_err_impl.h (revision 0dee7919e2f2a6479d16b370af93747b9416b242)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PX_ERR_IMPL_H
28 #define	_SYS_PX_ERR_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Bit Error handling tables:
38  * bit		Bit Number
39  * counter	Counter for number of errors countered for this bit
40  * err_handler	Error Handler Function
41  * erpt_handler	Ereport Handler Function
42  * class_name	Class Name used for sending ereports for this bit.
43  */
44 typedef struct px_err_bit_desc {
45 	uint_t		bit;
46 	uint_t		counter;
47 	int		(*err_handler)();
48 	int		(*erpt_handler)();
49 	char		*class_name;
50 } px_err_bit_desc_t;
51 
52 /*
53  * Reg Error handling tables:
54  *
55  * enabled		enable this register error handler
56  *
57  * *intr_mask_p		bitmask for enabled interrupts
58  * *log_mask_p		bitmask for logged  interrupts
59  * *count_mask_p	bitmask for counted interrupts
60  *
61  * *err_bit_tbl		error bit table
62  * err_bit_keys		number of entries in the error bit table.
63  *
64  * last_reg		last captured register
65  * log_addr		interrupt log    register offset
66  * enable_addr		interrupt enable register offset
67  * status_addr		interrupt status register offset
68  * clear_addr		interrupt clear  register offset
69  *
70  * *msg			error messages table
71  */
72 typedef struct px_err_reg_desc {
73 	boolean_t		enabled;
74 	uint64_t		*intr_mask_p;
75 	uint64_t		*log_mask_p;
76 	uint64_t		*count_mask_p;
77 	px_err_bit_desc_t	*err_bit_tbl;
78 	uint_t			err_bit_keys;
79 	uint64_t		last_reg;
80 	uint32_t		log_addr;
81 	uint32_t		enable_addr;
82 	uint32_t		status_addr;
83 	uint32_t		clear_addr;
84 	char			*msg;
85 } px_err_reg_desc_t;
86 
87 /*
88  * Macro to create the error handling forward declaration
89  *
90  * The error handlers examines error, determine the nature of the error
91  * and return error status in terms of PX_FATAL_HW | PX_FATAL_GOS | ...
92  * terminology.
93  */
94 #define	PX_ERR_BIT_HANDLE_DEC(n)	int px_err_ ## n ## _handle\
95 	(dev_info_t *rpdip, caddr_t csr_base, ddi_fm_error_t *derr, \
96 	px_err_reg_desc_t *err_reg_descr, px_err_bit_desc_t *err_bit_descr)
97 #define	PX_ERR_BIT_HANDLE(n)		px_err_ ## n ## _handle
98 
99 /*
100  * Macro to create the ereport forward declaration
101  */
102 #define	PX_ERPT_SEND_DEC(n)	int px_err_ ## n ## _send_ereport\
103 	(dev_info_t *rpdip, caddr_t csr_base, uint64_t ss_reg, \
104 	ddi_fm_error_t *derr, char *class_name)
105 #define	PX_ERPT_SEND(n)		px_err_ ## n ## _send_ereport
106 
107 /*
108  * Predefined error handling functions.
109  */
110 int px_err_fatal_hw_handle(dev_info_t *rpdip, caddr_t csr_base,
111 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
112 	px_err_bit_desc_t *err_bit_descr);
113 int px_err_fatal_gos_handle(dev_info_t *rpdip, caddr_t csr_base,
114 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
115 	px_err_bit_desc_t *err_bit_descr);
116 int px_err_fatal_stuck_handle(dev_info_t *rpdip, caddr_t csr_base,
117 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
118 	px_err_bit_desc_t *err_bit_descr);
119 int px_err_fatal_sw_handle(dev_info_t *rpdip, caddr_t csr_base,
120 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
121 	px_err_bit_desc_t *err_bit_descr);
122 int px_err_non_fatal_handle(dev_info_t *rpdip, caddr_t csr_base,
123 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
124 	px_err_bit_desc_t *err_bit_descr);
125 int px_err_ok_handle(dev_info_t *rpdip, caddr_t csr_base,
126 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
127 	px_err_bit_desc_t *err_bit_descr);
128 int px_err_unknown_handle(dev_info_t *rpdip, caddr_t csr_base,
129 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
130 	px_err_bit_desc_t *err_bit_descr);
131 
132 /*
133  * Predefined ereport functions
134  */
135 PX_ERPT_SEND_DEC(do_not);
136 
137 
138 /*
139  * JBC error handling and ereport forward declarations
140  */
141 
142 #define	PX_ERR_JBC_CLASS(n)	PCIEX_FIRE "." FIRE_JBC_ ## n
143 
144 /*
145  * Fire JBC error Handling Forward Declarations
146  * the must-panic type errors such as PX_FATAL_GOS or
147  * post-reset-diagnosed type error such as PX_FATAL_HW
148  * are not furthur diagnosed here because there is no
149  * justification to find out more as immediate error
150  * handling. FMA DE will do the post analysis.
151  */
152 int px_err_jbc_merge_handle(dev_info_t *rpdip, caddr_t csr_base,
153 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
154 	px_err_bit_desc_t *err_bit_descr);
155 int px_err_jbc_jbusint_in_handle(dev_info_t *rpdip, caddr_t csr_base,
156 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
157 	px_err_bit_desc_t *err_bit_descr);
158 int px_err_jbc_dmcint_odcd_handle(dev_info_t *rpdip, caddr_t csr_base,
159 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
160 	px_err_bit_desc_t *err_bit_descr);
161 int px_err_jbc_csr_handle(dev_info_t *rpdip, caddr_t csr_base,
162 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
163 	px_err_bit_desc_t *err_bit_descr);
164 
165 /* Fire JBC error ereport Forward Declarations */
166 PX_ERPT_SEND_DEC(jbc_fatal);
167 PX_ERPT_SEND_DEC(jbc_merge);
168 PX_ERPT_SEND_DEC(jbc_in);
169 PX_ERPT_SEND_DEC(jbc_out);
170 PX_ERPT_SEND_DEC(jbc_odcd);
171 PX_ERPT_SEND_DEC(jbc_idc);
172 PX_ERPT_SEND_DEC(jbc_csr);
173 
174 
175 /*
176  * DMC error handling and ereport forward declarations
177  */
178 
179 #define	PX_ERR_DMC_CLASS(n)	PCIEX_FIRE "." FIRE_DMC_ ## n
180 
181 /* Fire Bit Error Handling Forward Declarations */
182 int px_err_imu_rbne_handle(dev_info_t *rpdip, caddr_t csr_base,
183 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
184 	px_err_bit_desc_t *err_bit_descr);
185 int px_err_imu_pme_handle(dev_info_t *rpdip, caddr_t csr_base,
186 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
187 	px_err_bit_desc_t *err_bit_descr);
188 int px_err_imu_eq_ovfl_handle(dev_info_t *rpdip, caddr_t csr_base,
189 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
190 	px_err_bit_desc_t *err_bit_descr);
191 int px_err_mmu_rbne_handle(dev_info_t *rpdip, caddr_t csr_base,
192 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
193 	px_err_bit_desc_t *err_bit_descr);
194 int px_err_mmu_tfa_handle(dev_info_t *rpdip, caddr_t csr_base,
195 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
196 	px_err_bit_desc_t *err_bit_descr);
197 int px_err_mmu_tte_cae_handle(dev_info_t *rpdip, caddr_t csr_base,
198 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
199 	px_err_bit_desc_t *err_bit_descr);
200 int px_err_mmu_tblwlk_handle(dev_info_t *rpdip, caddr_t csr_base,
201 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
202 	px_err_bit_desc_t *err_bit_descr);
203 
204 /* Fire Ereport Handling Forward Declarations */
205 PX_ERPT_SEND_DEC(imu_rds);
206 PX_ERPT_SEND_DEC(imu_scs);
207 PX_ERPT_SEND_DEC(imu);
208 PX_ERPT_SEND_DEC(mmu_tfar_tfsr);
209 PX_ERPT_SEND_DEC(mmu);
210 
211 /*
212  * PEC error handling and ereport forward declarations
213  */
214 
215 #define	PX_ERR_PEC_CLASS(n)	PCIEX_FIRE "." FIRE_PEC_ ## n
216 
217 int px_err_tlu_lup_handle(dev_info_t *rpdip, caddr_t csr_base,
218 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
219 	px_err_bit_desc_t *err_bit_descr);
220 
221 /* Fire Ereport Handling Forward Declarations */
222 int px_err_pciex_ue_handle(dev_info_t *rpdip, caddr_t csr_base,
223     ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
224     px_err_bit_desc_t *err_bit_descr);
225 int px_err_pciex_ce_handle(dev_info_t *rpdip, caddr_t csr_base,
226     ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
227     px_err_bit_desc_t *err_bit_descr);
228 
229 PX_ERPT_SEND_DEC(pec_ilu);
230 PX_ERPT_SEND_DEC(pciex_rx_ue);
231 PX_ERPT_SEND_DEC(pciex_tx_ue);
232 PX_ERPT_SEND_DEC(pciex_rx_tx_ue);
233 PX_ERPT_SEND_DEC(pciex_ue);
234 PX_ERPT_SEND_DEC(pciex_ce);
235 PX_ERPT_SEND_DEC(pciex_rx_oe);
236 PX_ERPT_SEND_DEC(pciex_rx_tx_oe);
237 PX_ERPT_SEND_DEC(pciex_oe);
238 PX_ERPT_SEND_DEC(pciex_lup);
239 PX_ERPT_SEND_DEC(pciex_ldn);
240 
241 #ifdef	__cplusplus
242 }
243 #endif
244 
245 #endif	/* _SYS_PX_ERR_IMPL_H */
246