xref: /onnv-gate/usr/src/uts/sun4u/sys/pci/db21554_debug.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_DB21554_DEBUG_H
28*0Sstevel@tonic-gate #define	_SYS_DB21554_DEBUG_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #if defined(DEBUG)
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate /* driver modload functions */
39*0Sstevel@tonic-gate #define	DB_INIT			0x10
40*0Sstevel@tonic-gate #define	DB_FINI			0x11
41*0Sstevel@tonic-gate #define	DB_INFO			0x12
42*0Sstevel@tonic-gate #define	DB_GETINFO		0x13
43*0Sstevel@tonic-gate /* driver initialization functions */
44*0Sstevel@tonic-gate #define	DB_INIT_FUNCS		0x100
45*0Sstevel@tonic-gate #define	DB_ATTACH		0x100
46*0Sstevel@tonic-gate #define	DB_DETACH		0x101
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate /* driver child initialization functions */
49*0Sstevel@tonic-gate #define	DB_CTLOPS		0x1000
50*0Sstevel@tonic-gate #define	DB_INITCHILD		0x1001
51*0Sstevel@tonic-gate #define	DB_REMOVECHILD		0x1002
52*0Sstevel@tonic-gate #define	DB_INTR_OPS		0x1003
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate /* child driver services invoked during runtime */
55*0Sstevel@tonic-gate #define	DB_PCI_MAP		0x10000
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate /* CPR functions */
58*0Sstevel@tonic-gate #define	DB_SAVE_CONF_REGS	0x100000
59*0Sstevel@tonic-gate #define	DB_REST_CONF_REGS	0x100001
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate /* interrupt function */
62*0Sstevel@tonic-gate #define	DB_INTR			0x1000000
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate /* application call functions */
65*0Sstevel@tonic-gate #define	DB_OPEN			0x10000000
66*0Sstevel@tonic-gate #define	DB_CLOSE		0x10000001
67*0Sstevel@tonic-gate #define	DB_IOCTL		0x10000002
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate /* DVMA functions */
70*0Sstevel@tonic-gate #define	DB_DVMA			0x100000000
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate /* Function types, to be assigned to db_debug_funcs variable below. */
73*0Sstevel@tonic-gate #define	DB_MODLOAD_FUNCS	0x10
74*0Sstevel@tonic-gate #define	DB_CHILD_FUNCS		0x1000
75*0Sstevel@tonic-gate #define	DB_PCI_MEM_FUNCS	0x10000
76*0Sstevel@tonic-gate #define	DB_CPR_FUNCS		0x100000
77*0Sstevel@tonic-gate #define	DB_INTR_FUNCS		0x1000000
78*0Sstevel@tonic-gate #define	DB_APPL_FUNCS		0x10000000
79*0Sstevel@tonic-gate #define	DB_DVMA_FUNCS		0x100000000
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate  * db_debug_funcs indicates the function types from which the debug messages
83*0Sstevel@tonic-gate  * are to be displayed.
84*0Sstevel@tonic-gate  * For example: Set db_debug_funcs = DB_CHILD_FUNCS | DB_PCI_MEM_FUNCS;
85*0Sstevel@tonic-gate  * to display debug statements in memory map function (DB_PCI_MEM_FUNCS) and
86*0Sstevel@tonic-gate  * child driver initialization function (DB_CHILD_FUNCS).
87*0Sstevel@tonic-gate  *
88*0Sstevel@tonic-gate  * See above for a list of all function types that can be assigned.
89*0Sstevel@tonic-gate  */
90*0Sstevel@tonic-gate static uint64_t	db_debug_funcs = 0;
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate /*
93*0Sstevel@tonic-gate  * the following flag can be used to the first argument of db_debug
94*0Sstevel@tonic-gate  * when dip information need not be displayed along with the actual
95*0Sstevel@tonic-gate  * function debug message. By default it is always displayed.
96*0Sstevel@tonic-gate  */
97*0Sstevel@tonic-gate #define	DB_DONT_DISPLAY_DIP	0x1000000000000000
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate #define	DB_DEBUG0(func_id, dip, fmt)	\
100*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, 0, 0, 0, 0, 0);
101*0Sstevel@tonic-gate #define	DB_DEBUG1(func_id, dip, fmt, a1)	\
102*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, (uintptr_t)(a1), 0, 0, 0, 0);
103*0Sstevel@tonic-gate #define	DB_DEBUG2(func_id, dip, fmt, a1, a2)	\
104*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0);
105*0Sstevel@tonic-gate #define	DB_DEBUG3(func_id, dip, fmt, a1, a2, a3)	\
106*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, (uintptr_t)(a1),	\
107*0Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), 0, 0);
108*0Sstevel@tonic-gate #define	DB_DEBUG4(func_id, dip, fmt, a1, a2, a3, a4)	\
109*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, (uintptr_t)(a1),	\
110*0Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), \
111*0Sstevel@tonic-gate 		(uintptr_t)(a4), 0);
112*0Sstevel@tonic-gate #define	DB_DEBUG5(func_id, dip, fmt, a1, a2, a3, a4, a5)	\
113*0Sstevel@tonic-gate 	db_debug(func_id, dip, fmt, (uintptr_t)(a1),	\
114*0Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), \
115*0Sstevel@tonic-gate 		(uintptr_t)(a4), (uintptr_t)(a5));
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate #else
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate #define	DB_DEBUG0(func_id, dip, fmt)
120*0Sstevel@tonic-gate #define	DB_DEBUG1(func_id, dip, fmt, a1)
121*0Sstevel@tonic-gate #define	DB_DEBUG2(func_id, dip, fmt, a1, a2)
122*0Sstevel@tonic-gate #define	DB_DEBUG3(func_id, dip, fmt, a1, a2, a3)
123*0Sstevel@tonic-gate #define	DB_DEBUG4(func_id, dip, fmt, a1, a2, a3, a4)
124*0Sstevel@tonic-gate #define	DB_DEBUG5(func_id, dip, fmt, a1, a2, a3, a4, a5)
125*0Sstevel@tonic-gate #endif
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate #ifdef	__cplusplus
128*0Sstevel@tonic-gate }
129*0Sstevel@tonic-gate #endif
130*0Sstevel@tonic-gate 
131*0Sstevel@tonic-gate #endif	/* _SYS_DB21554_DEBUG_H */
132