xref: /onnv-gate/usr/src/uts/sun4/io/px/px_pec.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_PX_PEC_H
28*0Sstevel@tonic-gate #define	_SYS_PX_PEC_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <sys/ontrap.h>
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #ifdef	__cplusplus
36*0Sstevel@tonic-gate extern "C" {
37*0Sstevel@tonic-gate #endif
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate /*
40*0Sstevel@tonic-gate  * The following structure represents the pci-express configuration
41*0Sstevel@tonic-gate  * header for a fire PEC.
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate typedef struct px_config_header {
44*0Sstevel@tonic-gate 	volatile uint16_t ch_vendor_id;
45*0Sstevel@tonic-gate 	volatile uint16_t ch_device_id;
46*0Sstevel@tonic-gate 	volatile uint16_t ch_command_reg;
47*0Sstevel@tonic-gate 	volatile uint16_t ch_status_reg;
48*0Sstevel@tonic-gate 	volatile uint8_t ch_revision_id_reg;
49*0Sstevel@tonic-gate 	volatile uint8_t ch_programming_if_code_reg;
50*0Sstevel@tonic-gate 	volatile uint8_t ch_sub_class_reg;
51*0Sstevel@tonic-gate 	volatile uint8_t ch_base_class_reg;
52*0Sstevel@tonic-gate 	volatile uint8_t ch_cache_line_size_reg;
53*0Sstevel@tonic-gate 	volatile uint8_t ch_latency_timer_reg;
54*0Sstevel@tonic-gate 	volatile uint8_t ch_header_type_reg;
55*0Sstevel@tonic-gate } px_config_header_t;
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate /*
58*0Sstevel@tonic-gate  * Bit fields of ch_status_reg for cmn_err's %b
59*0Sstevel@tonic-gate  */
60*0Sstevel@tonic-gate #define	PX_STATUS_BITS "\020\
61*0Sstevel@tonic-gate \11signaled-parity-error\
62*0Sstevel@tonic-gate \14signaled-target-abort\
63*0Sstevel@tonic-gate \15received-target-abort\
64*0Sstevel@tonic-gate \16received-master-abort\
65*0Sstevel@tonic-gate \17signaled-system-error\
66*0Sstevel@tonic-gate \20detected-parity-error"
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate /*
69*0Sstevel@tonic-gate  * pec block soft state structure:
70*0Sstevel@tonic-gate  *
71*0Sstevel@tonic-gate  * Each px node has its own private pec block structure.
72*0Sstevel@tonic-gate  */
73*0Sstevel@tonic-gate typedef struct px_pec {
74*0Sstevel@tonic-gate 	px_t		*pec_px_p;	/* link back to px soft state */
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate 	/*
77*0Sstevel@tonic-gate 	 * PCI configuration header block for the PBM:
78*0Sstevel@tonic-gate 	 * config_header_t *pec_config_header;
79*0Sstevel@tonic-gate 	 * ddi_acc_handle_t pec_config_ac;
80*0Sstevel@tonic-gate 	 */
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate 	/*
83*0Sstevel@tonic-gate 	 * Memory address range on this PBM used to determine DMA on this pec
84*0Sstevel@tonic-gate 	 */
85*0Sstevel@tonic-gate 	px_iopfn_t		pec_base32_pfn;
86*0Sstevel@tonic-gate 	px_iopfn_t		pec_last32_pfn;
87*0Sstevel@tonic-gate 	px_iopfn_t		pec_base64_pfn;
88*0Sstevel@tonic-gate 	px_iopfn_t		pec_last64_pfn;
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate 	/*
91*0Sstevel@tonic-gate 	 * support for ddi_poke:
92*0Sstevel@tonic-gate 	 */
93*0Sstevel@tonic-gate 	on_trap_data_t	*pec_ontrap_data;
94*0Sstevel@tonic-gate 	kmutex_t	pec_pokefault_mutex;
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate #define	PBM_NAMESTR_BUFLEN 	64
97*0Sstevel@tonic-gate 	/* driver name & instance */
98*0Sstevel@tonic-gate 	char		pec_nameinst_str[PBM_NAMESTR_BUFLEN];
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate 	/* nodename & node_addr */
101*0Sstevel@tonic-gate 	char		*pec_nameaddr_str;
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate 	/* MSIQ used for correctable/fatal/non fatala PCIe messages */
104*0Sstevel@tonic-gate 	msiqid_t	pec_corr_msg_msiq_id;
105*0Sstevel@tonic-gate 	msiqid_t	pec_non_fatal_msg_msiq_id;
106*0Sstevel@tonic-gate 	msiqid_t	pec_fatal_msg_msiq_id;
107*0Sstevel@tonic-gate 	msiq_rec_t	*pec_msiq_rec_p;
108*0Sstevel@tonic-gate } px_pec_t;
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /*
111*0Sstevel@tonic-gate  * forward declarations (object creation and destruction):
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate extern int px_pec_attach(px_t *px_p);
115*0Sstevel@tonic-gate extern void px_pec_detach(px_t *px_p);
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate extern uint_t px_pec_corr_msg_intr(caddr_t arg);
118*0Sstevel@tonic-gate extern uint_t px_pec_non_fatal_msg_intr(caddr_t arg);
119*0Sstevel@tonic-gate extern uint_t px_pec_fatal_msg_intr(caddr_t arg);
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate #ifdef	__cplusplus
122*0Sstevel@tonic-gate }
123*0Sstevel@tonic-gate #endif
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate #endif	/* _SYS_PX_PEC_H */
126