xref: /onnv-gate/usr/src/uts/sun4u/io/px/px_err_impl.h (revision 3274:b750a4e2f4f5)
127Sjchu /*
227Sjchu  * CDDL HEADER START
327Sjchu  *
427Sjchu  * The contents of this file are subject to the terms of the
51772Sjl139090  * Common Development and Distribution License (the "License").
61772Sjl139090  * You may not use this file except in compliance with the License.
727Sjchu  *
827Sjchu  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
927Sjchu  * or http://www.opensolaris.org/os/licensing.
1027Sjchu  * See the License for the specific language governing permissions
1127Sjchu  * and limitations under the License.
1227Sjchu  *
1327Sjchu  * When distributing Covered Code, include this CDDL HEADER in each
1427Sjchu  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1527Sjchu  * If applicable, add the following below this CDDL HEADER, with the
1627Sjchu  * fields enclosed by brackets "[]" replaced with your own identifying
1727Sjchu  * information: Portions Copyright [yyyy] [name of copyright owner]
1827Sjchu  *
1927Sjchu  * CDDL HEADER END
2027Sjchu  */
2127Sjchu /*
221772Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2327Sjchu  * Use is subject to license terms.
2427Sjchu  */
2527Sjchu 
2627Sjchu #ifndef	_SYS_PX_ERR_IMPL_H
2727Sjchu #define	_SYS_PX_ERR_IMPL_H
2827Sjchu 
2927Sjchu #pragma ident	"%Z%%M%	%I%	%E% SMI"
3027Sjchu 
3127Sjchu #ifdef	__cplusplus
3227Sjchu extern "C" {
3327Sjchu #endif
3427Sjchu 
3527Sjchu /*
3627Sjchu  * Bit Error handling tables:
3727Sjchu  * bit		Bit Number
3827Sjchu  * counter	Counter for number of errors countered for this bit
3927Sjchu  * err_handler	Error Handler Function
4027Sjchu  * erpt_handler	Ereport Handler Function
4127Sjchu  * class_name	Class Name used for sending ereports for this bit.
4227Sjchu  */
4327Sjchu typedef struct px_err_bit_desc {
4427Sjchu 	uint_t		bit;
4527Sjchu 	uint_t		counter;
4627Sjchu 	int		(*err_handler)();
4727Sjchu 	int		(*erpt_handler)();
4827Sjchu 	char		*class_name;
4927Sjchu } px_err_bit_desc_t;
5027Sjchu 
5127Sjchu /*
5227Sjchu  * Reg Error handling tables:
5327Sjchu  *
542509Sschwartz  * chip_mask		mask of chip types supporting this error register
5527Sjchu  *
5627Sjchu  * *intr_mask_p		bitmask for enabled interrupts
5727Sjchu  * *log_mask_p		bitmask for logged  interrupts
5827Sjchu  * *count_mask_p	bitmask for counted interrupts
5927Sjchu  *
6027Sjchu  * *err_bit_tbl		error bit table
6127Sjchu  * err_bit_keys		number of entries in the error bit table.
6227Sjchu  *
632509Sschwartz  * reg_bank		register bank base
642509Sschwartz  *
6527Sjchu  * last_reg		last captured register
6627Sjchu  * log_addr		interrupt log    register offset
6727Sjchu  * enable_addr		interrupt enable register offset
6827Sjchu  * status_addr		interrupt status register offset
6927Sjchu  * clear_addr		interrupt clear  register offset
7027Sjchu  *
7127Sjchu  * *msg			error messages table
7227Sjchu  */
7327Sjchu typedef struct px_err_reg_desc {
742509Sschwartz 	uint8_t			chip_mask;
7527Sjchu 	uint64_t		*intr_mask_p;
7627Sjchu 	uint64_t		*log_mask_p;
7727Sjchu 	uint64_t		*count_mask_p;
7827Sjchu 	px_err_bit_desc_t	*err_bit_tbl;
7927Sjchu 	uint_t			err_bit_keys;
802509Sschwartz 	uint_t			reg_bank;
8127Sjchu 	uint64_t		last_reg;
8227Sjchu 	uint32_t		log_addr;
8327Sjchu 	uint32_t		enable_addr;
8427Sjchu 	uint32_t		status_addr;
8527Sjchu 	uint32_t		clear_addr;
8627Sjchu 	char			*msg;
8727Sjchu } px_err_reg_desc_t;
8827Sjchu 
8927Sjchu /*
9027Sjchu  * Macro to create the error handling forward declaration
9127Sjchu  *
9227Sjchu  * The error handlers examines error, determine the nature of the error
93*3274Set142600  * and return error status in terms of PX_HW_RESET | PX_PANIC | ...
9427Sjchu  * terminology.
9527Sjchu  */
9627Sjchu #define	PX_ERR_BIT_HANDLE_DEC(n)	int px_err_ ## n ## _handle\
9727Sjchu 	(dev_info_t *rpdip, caddr_t csr_base, ddi_fm_error_t *derr, \
9827Sjchu 	px_err_reg_desc_t *err_reg_descr, px_err_bit_desc_t *err_bit_descr)
9927Sjchu #define	PX_ERR_BIT_HANDLE(n)		px_err_ ## n ## _handle
10027Sjchu 
10127Sjchu /*
102383Set142600  * Macro to create the ereport forward declaration
103383Set142600  */
104383Set142600 #define	PX_ERPT_SEND_DEC(n)	int px_err_ ## n ## _send_ereport\
105383Set142600 	(dev_info_t *rpdip, caddr_t csr_base, uint64_t ss_reg, \
106739Sjchu 	ddi_fm_error_t *derr, uint_t bit, char *class_name)
107383Set142600 #define	PX_ERPT_SEND(n)		px_err_ ## n ## _send_ereport
108383Set142600 
109383Set142600 /*
110739Sjchu  * Macro to test for primary vs secondary
111739Sjchu  */
112739Sjchu #define	PX_ERR_IS_PRI(bit) (bit < 32)
113739Sjchu 
114739Sjchu /*
11527Sjchu  * Predefined error handling functions.
11627Sjchu  */
117*3274Set142600 void px_err_log_handle(dev_info_t *rpdip, px_err_reg_desc_t *err_reg_descr,
118*3274Set142600 	px_err_bit_desc_t *err_bit_descr, char *msg);
119*3274Set142600 int px_err_hw_reset_handle(dev_info_t *rpdip, caddr_t csr_base,
12027Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
12127Sjchu 	px_err_bit_desc_t *err_bit_descr);
122*3274Set142600 int px_err_panic_handle(dev_info_t *rpdip, caddr_t csr_base,
12327Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
12427Sjchu 	px_err_bit_desc_t *err_bit_descr);
125*3274Set142600 int px_err_protected_handle(dev_info_t *rpdip, caddr_t csr_base,
12627Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
12727Sjchu 	px_err_bit_desc_t *err_bit_descr);
128*3274Set142600 int px_err_no_panic_handle(dev_info_t *rpdip, caddr_t csr_base,
12927Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
13027Sjchu 	px_err_bit_desc_t *err_bit_descr);
131*3274Set142600 int px_err_no_error_handle(dev_info_t *rpdip, caddr_t csr_base,
13227Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
13327Sjchu 	px_err_bit_desc_t *err_bit_descr);
13427Sjchu 
13527Sjchu /*
136383Set142600  * Predefined ereport functions
13727Sjchu  */
138383Set142600 PX_ERPT_SEND_DEC(do_not);
13927Sjchu 
14027Sjchu 
14127Sjchu /*
1421772Sjl139090  * JBC/UBC error handling and ereport forward declarations
14327Sjchu  */
14427Sjchu 
14527Sjchu #define	PX_ERR_JBC_CLASS(n)	PCIEX_FIRE "." FIRE_JBC_ ## n
1461772Sjl139090 #define	PX_ERR_UBC_CLASS(n)	PCIEX_OBERON "." FIRE_UBC_ ## n
14727Sjchu 
14827Sjchu /*
14927Sjchu  * Fire JBC error Handling Forward Declarations
150*3274Set142600  * the must-panic type errors such as PX_PANIC or
151*3274Set142600  * post-reset-diagnosed type error such as PX_HW_RESET
15227Sjchu  * are not furthur diagnosed here because there is no
15327Sjchu  * justification to find out more as immediate error
15427Sjchu  * handling. FMA DE will do the post analysis.
15527Sjchu  */
15627Sjchu int px_err_jbc_merge_handle(dev_info_t *rpdip, caddr_t csr_base,
15727Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
15827Sjchu 	px_err_bit_desc_t *err_bit_descr);
15927Sjchu int px_err_jbc_jbusint_in_handle(dev_info_t *rpdip, caddr_t csr_base,
16027Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
16127Sjchu 	px_err_bit_desc_t *err_bit_descr);
16227Sjchu int px_err_jbc_dmcint_odcd_handle(dev_info_t *rpdip, caddr_t csr_base,
16327Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
16427Sjchu 	px_err_bit_desc_t *err_bit_descr);
1652276Sschwartz int px_err_jbc_safe_acc_handle(dev_info_t *rpdip, caddr_t csr_base,
1662276Sschwartz 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
1672276Sschwartz 	px_err_bit_desc_t *err_bit_descr);
16827Sjchu 
16927Sjchu /* Fire JBC error ereport Forward Declarations */
17027Sjchu PX_ERPT_SEND_DEC(jbc_fatal);
17127Sjchu PX_ERPT_SEND_DEC(jbc_merge);
17227Sjchu PX_ERPT_SEND_DEC(jbc_in);
17327Sjchu PX_ERPT_SEND_DEC(jbc_out);
17427Sjchu PX_ERPT_SEND_DEC(jbc_odcd);
17527Sjchu PX_ERPT_SEND_DEC(jbc_idc);
17627Sjchu PX_ERPT_SEND_DEC(jbc_csr);
17727Sjchu 
1781772Sjl139090 /* Oberon UBC error ereport Forward Declarations */
1791772Sjl139090 PX_ERPT_SEND_DEC(ubc_fatal);
1801772Sjl139090 
18127Sjchu 
18227Sjchu /*
18327Sjchu  * DMC error handling and ereport forward declarations
18427Sjchu  */
18527Sjchu 
18627Sjchu #define	PX_ERR_DMC_CLASS(n)	PCIEX_FIRE "." FIRE_DMC_ ## n
18727Sjchu 
18827Sjchu /* Fire Bit Error Handling Forward Declarations */
18927Sjchu int px_err_imu_eq_ovfl_handle(dev_info_t *rpdip, caddr_t csr_base,
19027Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
19127Sjchu 	px_err_bit_desc_t *err_bit_descr);
19227Sjchu int px_err_mmu_rbne_handle(dev_info_t *rpdip, caddr_t csr_base,
19327Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
19427Sjchu 	px_err_bit_desc_t *err_bit_descr);
19527Sjchu int px_err_mmu_tfa_handle(dev_info_t *rpdip, caddr_t csr_base,
19627Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
19727Sjchu 	px_err_bit_desc_t *err_bit_descr);
198*3274Set142600 int px_err_mmu_parity_handle(dev_info_t *rpdip, caddr_t csr_base,
19927Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
20027Sjchu 	px_err_bit_desc_t *err_bit_descr);
20127Sjchu 
20227Sjchu /* Fire Ereport Handling Forward Declarations */
20327Sjchu PX_ERPT_SEND_DEC(imu_rds);
20427Sjchu PX_ERPT_SEND_DEC(imu_scs);
20527Sjchu PX_ERPT_SEND_DEC(imu);
20627Sjchu PX_ERPT_SEND_DEC(mmu_tfar_tfsr);
20727Sjchu PX_ERPT_SEND_DEC(mmu);
20827Sjchu 
20927Sjchu /*
21027Sjchu  * PEC error handling and ereport forward declarations
21127Sjchu  */
21227Sjchu 
21327Sjchu #define	PX_ERR_PEC_CLASS(n)	PCIEX_FIRE "." FIRE_PEC_ ## n
2141772Sjl139090 #define	PX_ERR_PEC_OB_CLASS(n)	PCIEX_OBERON "." FIRE_PEC_ ## n
21527Sjchu 
216*3274Set142600 int px_err_wuc_ruc_handle(dev_info_t *rpdip, caddr_t csr_base,
217*3274Set142600 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
218*3274Set142600 	px_err_bit_desc_t *err_bit_descr);
219118Sjchu int px_err_tlu_lup_handle(dev_info_t *rpdip, caddr_t csr_base,
220118Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
221118Sjchu 	px_err_bit_desc_t *err_bit_descr);
2221147Sjchu int px_err_tlu_ldn_handle(dev_info_t *rpdip, caddr_t csr_base,
2231147Sjchu 	ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
2241147Sjchu 	px_err_bit_desc_t *err_bit_descr);
225118Sjchu 
22627Sjchu /* Fire Ereport Handling Forward Declarations */
227383Set142600 int px_err_pciex_ue_handle(dev_info_t *rpdip, caddr_t csr_base,
228383Set142600     ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
229383Set142600     px_err_bit_desc_t *err_bit_descr);
230383Set142600 int px_err_pciex_ce_handle(dev_info_t *rpdip, caddr_t csr_base,
231383Set142600     ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr,
232383Set142600     px_err_bit_desc_t *err_bit_descr);
233383Set142600 
23427Sjchu PX_ERPT_SEND_DEC(pec_ilu);
23527Sjchu PX_ERPT_SEND_DEC(pciex_rx_ue);
23627Sjchu PX_ERPT_SEND_DEC(pciex_tx_ue);
23727Sjchu PX_ERPT_SEND_DEC(pciex_rx_tx_ue);
23827Sjchu PX_ERPT_SEND_DEC(pciex_ue);
23927Sjchu PX_ERPT_SEND_DEC(pciex_ce);
24027Sjchu PX_ERPT_SEND_DEC(pciex_rx_oe);
24127Sjchu PX_ERPT_SEND_DEC(pciex_rx_tx_oe);
24227Sjchu PX_ERPT_SEND_DEC(pciex_oe);
24327Sjchu 
24427Sjchu #ifdef	__cplusplus
24527Sjchu }
24627Sjchu #endif
24727Sjchu 
24827Sjchu #endif	/* _SYS_PX_ERR_IMPL_H */
249