xref: /titanic_51/usr/src/uts/sun4u/opl/sys/pcicmu/pcmu_err.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_PCMU_ERR_H
27 #define	_SYS_PCMU_ERR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/ddifm.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef _KERNEL
38 
39 #define	PBM_PRIMARY		1
40 #define	PBM_SECONDARY		0
41 #define	PBM_NONFATAL		0
42 #define	PBM_FATAL		1
43 #define	FM_LOG_PCI		0
44 #define	FM_LOG_PBM		1
45 #define	ECC_MAX_ERRS		6
46 #define	TARGET_MAX_ERRS		6
47 
48 /*
49  * Since pcmu_pbm_err_handler() is called by various interrupt/trap/callback
50  * handlers, it is necessary for it to know where it is being called from.
51  * Below are the flags passed to pcmu_pbm_err_handler() to give it knowledge
52  * of it's caller.
53  */
54 #define	PCI_TRAP_CALL		0x0
55 #define	PCI_CB_CALL		0x1
56 #define	PCI_INTR_CALL		0x2
57 #define	PCI_BUS_EXIT_CALL	0x3
58 #define	PCI_ECC_CALL		0x4
59 
60 extern errorq_t *pcmu_ecc_queue;	/* per-system ecc handling queue */
61 
62 struct pcmu_errstate {
63 	char *pcmu_err_class;
64 	uint16_t pcmu_cfg_stat;
65 	uint16_t pcmu_cfg_comm;
66 	uint64_t pcmu_pa;
67 };
68 
69 /*
70  * pbm errstate use to encompass the state for all errors
71  * detected by the pci block
72  */
73 struct pcmu_pbm_errstate {
74 	char *pbm_err_class;
75 	int pcbm_pri;
76 	int pbm_log;
77 	uint32_t pbm_err;
78 	uint32_t pbm_multi;
79 	char *pbm_bridge_type;
80 	uint64_t pbm_ctl_stat;
81 	uint64_t pbm_afsr;
82 	uint64_t pbm_afar;
83 	uint64_t pbm_va_log;
84 	uint64_t pbm_err_sl;
85 	uint64_t pcbm_pcix_stat;
86 	uint32_t pcbm_pcix_pfar;
87 	pcmu_errstate_t pcbm_pci;
88 	char *pcmu_pbm_terr_class;
89 };
90 
91 /*
92  * ecc errstate used to store all state captured,
93  * upon detection of an ecc error.
94  */
95 struct pcmu_ecc_errstate {
96 	char *ecc_bridge_type;
97 	pcmu_ecc_t *pecc_p;
98 	uint64_t ecc_afsr;
99 	uint64_t ecc_afar;
100 	uint64_t ecc_offset;
101 	uint64_t ecc_dev_id;
102 	uint64_t ecc_dw_offset;
103 	struct async_flt ecc_aflt;
104 	pcmu_ecc_intr_info_t ecc_ii_p;
105 	uint64_t ecc_ctrl;
106 	int pecc_pri;
107 	char ecc_unum[UNUM_NAMLEN];
108 	uint64_t ecc_ena;
109 	uint64_t ecc_err_addr;
110 	char *ecc_err_type;
111 	int pecc_pg_ret;
112 	nvlist_t *ecc_fmri;
113 	int ecc_caller;
114 };
115 
116 extern int pcmu_fm_init_child(dev_info_t *dip, dev_info_t *tdip, int cap,
117 		ddi_iblock_cookie_t *ibc);
118 extern void pcmu_bus_enter(dev_info_t *dip, ddi_acc_handle_t handle);
119 extern void pcmu_bus_exit(dev_info_t *dip, ddi_acc_handle_t handle);
120 extern void pcmu_pbm_ereport_post(dev_info_t *dip, uint64_t ena,
121 		pcmu_pbm_errstate_t *pbm_err);
122 extern void pcmu_fm_acc_setup(ddi_map_req_t *mp, dev_info_t *rdip);
123 extern int pcmu_handle_lookup(dev_info_t *dip, int type, uint64_t fme_ena,
124 		void *afar);
125 extern void pcmu_fm_create(pcmu_t *pcmu_p);
126 extern void pcmu_fm_destroy(pcmu_t *pcmu_p);
127 extern int pcmu_err_callback(dev_info_t *dip, ddi_fm_error_t *derr,
128 		const void *impl_data);
129 #endif /* _KERNEL */
130 
131 #ifdef	__cplusplus
132 }
133 #endif
134 
135 #endif	/* _SYS_PCMU_ERR_H */
136