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