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