xref: /titanic_52/usr/src/uts/sun4/io/px/px_debug.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_PX_DEBUG_H
27 #define	_SYS_PX_DEBUG_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/varargs.h>	/* va_list */
34 #include <sys/promif.h>		/* prom_printf */
35 
36 typedef enum {	/* same sequence as px_debug_sym[] */
37 	/*  0 */ DBG_ATTACH,
38 	/*  1 */ DBG_DETACH,
39 	/*  2 */ DBG_MAP,
40 	/*  3 */ DBG_CTLOPS,
41 
42 	/*  4 */ DBG_INTROPS,
43 	/*  5 */ DBG_A_INTX,
44 	/*  6 */ DBG_R_INTX,
45 	/*  7 */ DBG_INTX_INTR,
46 
47 	/*  8 */ DBG_MSIQ,
48 	/*  9 */ DBG_MSIQ_INTR,
49 	/* 10 */ DBG_MSG,
50 	/* 11 */ DBG_MSG_INTR,
51 
52 	/* 12 */ DBG_A_MSIX,
53 	/* 13 */ DBG_R_MSIX,
54 	/* 14 */ DBG_MSIX_INTR,
55 	/* 15 */ DBG_ERR_INTR,
56 
57 	/* 16 */ DBG_DMA_ALLOCH,
58 	/* 17 */ DBG_DMA_FREEH,
59 	/* 18 */ DBG_DMA_BINDH,
60 	/* 19 */ DBG_DMA_UNBINDH,
61 
62 	/* 20 */ DBG_CHK_MOD,
63 	/* 21 */ DBG_BYPASS,
64 	/* 22 */ DBG_FAST_DVMA,
65 	/* 23 */ DBG_INIT_CLD,
66 
67 	/* 24 */ DBG_DMA_MAP,
68 	/* 25 */ DBG_DMA_WIN,
69 	/* 26 */ DBG_MAP_WIN,
70 	/* 27 */ DBG_UNMAP_WIN,
71 
72 	/* 28 */ DBG_DMA_CTL,
73 	/* 29 */ DBG_DMA_SYNC,
74 	/* 30 */ DBG_RSV1,
75 	/* 31 */ DBG_RSV2,
76 
77 	/* 32 */ DBG_IB,
78 	/* 33 */ DBG_CB,
79 	/* 34 */ DBG_DMC,
80 	/* 35 */ DBG_PEC,
81 
82 	/* 36 */ DBG_ILU,
83 	/* 37 */ DBG_TLU,
84 	/* 38 */ DBG_LPU,
85 	/* 39 */ DBG_MMU,
86 
87 	/* 40 */ DBG_OPEN,
88 	/* 41 */ DBG_CLOSE,
89 	/* 42 */ DBG_IOCTL,
90 	/* 43 */ DBG_PWR,
91 
92 	/* 44 */ DBG_LIB_CFG,
93 	/* 45 */ DBG_LIB_INT,
94 	/* 46 */ DBG_LIB_DMA,
95 	/* 47 */ DBG_LIB_MSIQ,
96 
97 	/* 48 */ DBG_LIB_MSI,
98 	/* 49 */ DBG_LIB_MSG,
99 	/* 50 */ DBG_RSV4,
100 	/* 51 */ DBG_RSV5,
101 
102 	/* 52 */ DBG_TOOLS,
103 	/* 53 */ DBG_PHYS_ACC,
104 	/* 54 */ DBG_HP,
105 	/* 55 */ DBG_MPS
106 
107 } px_debug_bit_t;
108 
109 #define	DBG_BITS	6
110 #define	DBG_CONT	(1 << DBG_BITS)
111 #define	DBG_MASK	(DBG_CONT - 1)
112 #define	DBG_MSG_SIZE	320
113 
114 /* Used only during High PIL printing */
115 typedef struct px_dbg_msg {
116 	boolean_t	active;
117 	px_debug_bit_t  bit;
118 	dev_info_t	*dip;
119 	char		msg[DBG_MSG_SIZE];
120 } px_dbg_msg_t;
121 
122 extern void px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
123 extern void px_dbg_detach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
124 
125 #if defined(DEBUG)
126 
127 #define	DBG px_dbg
128 extern void px_dbg(px_debug_bit_t bit, dev_info_t *dip, char *fmt, ...);
129 
130 #else	/* DEBUG */
131 
132 #define	DBG 0 &&
133 
134 #endif	/* DEBUG */
135 
136 #ifdef	__cplusplus
137 }
138 #endif
139 
140 #endif	/* _SYS_PX_DEBUG_H */
141