xref: /titanic_44/usr/src/uts/sun4/io/px/px_fm.h (revision f6db9f272f0061301cfaa1c0001b7d636eae31f4)
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_FM_H
28 #define	_SYS_PX_FM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	PX_ERR_PIL	14
37 #define	PX_ERR_LOW_PIL  9
38 
39 /*
40  * Error handlers maybe called due to trap or interrupts
41  * occured.
42  */
43 #define	PX_TRAP_CALL	0
44 #define	PX_INTR_CALL	1
45 #define	PX_LIB_CALL	2
46 
47 /*
48  * Definition of Fire internal error severity -
49  *   PX_FATAL_HW: errors that automatically cause Fire HW reset,
50  *   PX_FATAL_GOS: errors that causes OS cease to function immediately,
51  *   PX_STUCK_FATAL: errors that is likely to spam, causing hang,
52  *   PX_FATAL_SW: errors that cause partial OS lose function,
53  *   PX_NONFATAL: errors that can be recovered or ignored.
54  */
55 #define	PX_FATAL_HW		0x10
56 #define	PX_FATAL_GOS		0x8
57 #define	PX_STUCK_FATAL		0x4
58 #define	PX_FATAL_SW		0x2
59 #define	PX_NONFATAL		0x1
60 #define	PX_OK			DDI_FM_OK
61 #define	PX_ERR_UNKNOWN		0x80
62 
63 #define	PX_FM_FABRIC_CLASS	PCIEX_FIRE ".fabric"
64 #define	PX_FM_FABRIC_MSG_CODE	"msg_code"
65 #define	PX_FM_FABRIC_REQ_ID	"req_id"
66 
67 #define	PX_FABRIC_ERR_SEV(reg, chk, chk_gos) \
68 	((reg & chk) ? ((reg & chk_gos) ? \
69 	PX_FATAL_GOS : PX_FATAL_SW) : PX_NONFATAL)
70 
71 /*
72  * Error handling FMA hook
73  */
74 extern void px_bus_enter(dev_info_t *dip, ddi_acc_handle_t handle);
75 extern void px_bus_exit(dev_info_t *dip, ddi_acc_handle_t handle);
76 extern int px_fm_attach(px_t *px_p);
77 extern void px_fm_detach(px_t *px_p);
78 extern int px_fm_init_child(dev_info_t *, dev_info_t *, int,
79     ddi_iblock_cookie_t *);
80 extern void px_fm_acc_setup(ddi_map_req_t *, dev_info_t *);
81 extern int px_handle_lookup(dev_info_t *, int, uint64_t, void *);
82 extern int px_fm_callback(dev_info_t *, ddi_fm_error_t *, const void *);
83 extern int px_err_handle(px_t *px_p, ddi_fm_error_t *derr, int caller,
84     boolean_t checkjbc);
85 
86 /*
87  * Fire interrupt handlers
88  */
89 extern uint_t px_err_cb_intr(caddr_t arg);
90 extern uint_t px_err_dmc_pec_intr(caddr_t arg);
91 extern uint_t px_err_fabric_intr(px_t *px_p, msgcode_t msg_code,
92     pcie_req_id_t rid);
93 
94 /*
95  * Common error handling functions
96  */
97 extern void px_err_safeacc_check(px_t *px_p, ddi_fm_error_t *derr);
98 #define	PX_FM_PANIC	\
99 	if (!panicstr)	fm_panic
100 
101 #ifdef	__cplusplus
102 }
103 #endif
104 
105 #endif	/* _SYS_PX_FM_H */
106