xref: /illumos-gate/usr/src/uts/sun4u/sys/pci/pci_debug.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_PCI_DEBUG_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_PCI_DEBUG_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate typedef struct pci_debug_flag_to_string {
37*7c478bd9Sstevel@tonic-gate 	uint64_t flag;
38*7c478bd9Sstevel@tonic-gate 	char *string;
39*7c478bd9Sstevel@tonic-gate } pci_debug_flag_to_string_t;
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #if defined(DEBUG)
42*7c478bd9Sstevel@tonic-gate #define	DBG_ATTACH		0x1ull
43*7c478bd9Sstevel@tonic-gate #define	DBG_DETACH		0x2ull
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #define	DBG_MAP			0x4ull
46*7c478bd9Sstevel@tonic-gate #define	DBG_RSV1		0x10ull
47*7c478bd9Sstevel@tonic-gate #define	DBG_A_INTX		0x20ull
48*7c478bd9Sstevel@tonic-gate #define	DBG_R_INTX		0x40ull
49*7c478bd9Sstevel@tonic-gate #define	DBG_INIT_CLD		0x80ull
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate #define	DBG_CTLOPS		0x100ull
52*7c478bd9Sstevel@tonic-gate #define	DBG_INTR		0x200ull
53*7c478bd9Sstevel@tonic-gate #define	DBG_ERR_INTR		0x400ull
54*7c478bd9Sstevel@tonic-gate #define	DBG_BUS_FAULT		0x800ull
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_ALLOCH		0x10000ull
57*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_FREEH		0x20000ull
58*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_BINDH		0x40000ull
59*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_UNBINDH		0x80000ull
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_MAP		0x100000ull
62*7c478bd9Sstevel@tonic-gate #define	DBG_CHK_MOD		0x200000ull
63*7c478bd9Sstevel@tonic-gate #define	DBG_BYPASS		0x400000ull
64*7c478bd9Sstevel@tonic-gate #define	DBG_IOMMU		0x800000ull
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_WIN		0x1000000ull
67*7c478bd9Sstevel@tonic-gate #define	DBG_MAP_WIN		0x2000000ull
68*7c478bd9Sstevel@tonic-gate #define	DBG_UNMAP_WIN		0x4000000ull
69*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_CTL		0x8000000ull
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_SYNC		0x10000000ull
72*7c478bd9Sstevel@tonic-gate #define	DBG_DMA_SYNC_PBM	0x20000000ull
73*7c478bd9Sstevel@tonic-gate #define	DBG_FAST_DVMA		0x40000000ull
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #define	DBG_SC			(0x10ull << 32)
76*7c478bd9Sstevel@tonic-gate #define	DBG_IB			(0x20ull << 32)
77*7c478bd9Sstevel@tonic-gate #define	DBG_CB			(0x40ull << 32)
78*7c478bd9Sstevel@tonic-gate #define	DBG_PBM			(0x80ull << 32)
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #define	DBG_CONT		(0x100ull << 32)
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate #define	DBG_OPEN		(0x1000ull << 32)
83*7c478bd9Sstevel@tonic-gate #define	DBG_CLOSE		(0x2000ull << 32)
84*7c478bd9Sstevel@tonic-gate #define	DBG_IOCTL		(0x4000ull << 32)
85*7c478bd9Sstevel@tonic-gate #define	DBG_PWR			(0x8000ull << 32)
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate #define	DBG_RELOC		(0x10000ull << 32)
88*7c478bd9Sstevel@tonic-gate #define	DBG_TOOLS		(0x40000ull << 32)
89*7c478bd9Sstevel@tonic-gate #define	DBG_PHYS_ACC		(0x80000ull << 32)
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate #define	DEBUG0(flag, dip, fmt)	\
94*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, 0, 0, 0, 0, 0);
95*7c478bd9Sstevel@tonic-gate #define	DEBUG1(flag, dip, fmt, a1)	\
96*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, (uintptr_t)(a1), 0, 0, 0, 0);
97*7c478bd9Sstevel@tonic-gate #define	DEBUG2(flag, dip, fmt, a1, a2)	\
98*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0);
99*7c478bd9Sstevel@tonic-gate #define	DEBUG3(flag, dip, fmt, a1, a2, a3)	\
100*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, (uintptr_t)(a1),	\
101*7c478bd9Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), 0, 0);
102*7c478bd9Sstevel@tonic-gate #define	DEBUG4(flag, dip, fmt, a1, a2, a3, a4)	\
103*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, (uintptr_t)(a1),	\
104*7c478bd9Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), \
105*7c478bd9Sstevel@tonic-gate 		(uintptr_t)(a4), 0);
106*7c478bd9Sstevel@tonic-gate #define	DEBUG5(flag, dip, fmt, a1, a2, a3, a4, a5)	\
107*7c478bd9Sstevel@tonic-gate 	pci_debug(flag, dip, fmt, (uintptr_t)(a1),	\
108*7c478bd9Sstevel@tonic-gate 		(uintptr_t)(a2), (uintptr_t)(a3), \
109*7c478bd9Sstevel@tonic-gate 		(uintptr_t)(a4), (uintptr_t)(a5));
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate extern void pci_debug(uint64_t, dev_info_t *, char *,
112*7c478bd9Sstevel@tonic-gate 			uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
113*7c478bd9Sstevel@tonic-gate #else
114*7c478bd9Sstevel@tonic-gate #define	DEBUG0(flag, dip, fmt)
115*7c478bd9Sstevel@tonic-gate #define	DEBUG1(flag, dip, fmt, a1)
116*7c478bd9Sstevel@tonic-gate #define	DEBUG2(flag, dip, fmt, a1, a2)
117*7c478bd9Sstevel@tonic-gate #define	DEBUG3(flag, dip, fmt, a1, a2, a3)
118*7c478bd9Sstevel@tonic-gate #define	DEBUG4(flag, dip, fmt, a1, a2, a3, a4)
119*7c478bd9Sstevel@tonic-gate #define	DEBUG5(flag, dip, fmt, a1, a2, a3, a4, a5)
120*7c478bd9Sstevel@tonic-gate #endif
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
123*7c478bd9Sstevel@tonic-gate }
124*7c478bd9Sstevel@tonic-gate #endif
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_PCI_DEBUG_H */
127