1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef _NETAT_DEBUG_H_
29#define _NETAT_DEBUG_H_
30#include <sys/appleapiopts.h>
31#ifdef __APPLE_API_OBSOLETE
32#ifdef PRIVATE
33
34#define D_L_FATAL 0x00000001
35#define D_L_ERROR 0x00000002
36#define D_L_WARNING 0x00000004
37#define D_L_INFO 0x00000008
38#define D_L_VERBOSE 0x00000010
39#define D_L_STARTUP 0x00000020
40#define D_L_STARTUP_LOW 0x00000040
41#define D_L_SHUTDN 0x00000080
42#define D_L_SHUTDN_LOW 0x00000100
43#define D_L_INPUT 0x00000200
44#define D_L_OUTPUT 0x00000400
45#define D_L_STATS 0x00000800
46#define D_L_STATE_CHG 0x00001000
47#define D_L_ROUTING 0x00002000
48#define D_L_DNSTREAM 0x00004000
49#define D_L_UPSTREAM 0x00008000
50#define D_L_STARTUP_INFO 0x00010000
51#define D_L_SHUTDN_INFO 0x00020000
52#define D_L_ROUTING_AT 0x00040000
53#define D_L_USR1 0x01000000
54#define D_L_USR2 0x02000000
55#define D_L_USR3 0x04000000
56#define D_L_USR4 0x08000000
57#define D_L_TRACE 0x10000000
58
59
60#define D_M_PAT 0x00000001
61#define D_M_PAT_LOW 0x00000002
62#define D_M_ELAP 0x00000004
63#define D_M_ELAP_LOW 0x00000008
64#define D_M_DDP 0x00000010
65#define D_M_DDP_LOW 0x00000020
66#define D_M_NBP 0x00000040
67#define D_M_NBP_LOW 0x00000080
68#define D_M_ZIP 0x00000100
69#define D_M_ZIP_LOW 0x00000200
70#define D_M_RTMP 0x00000400
71#define D_M_RTMP_LOW 0x00000800
72#define D_M_ATP 0x00001000
73#define D_M_ATP_LOW 0x00002000
74#define D_M_ADSP 0x00004000
75#define D_M_ADSP_LOW 0x00008000
76#define D_M_AEP 0x00010000
77#define D_M_AARP 0x00020000
78#define D_M_ASP 0x00040000
79#define D_M_ASP_LOW 0x00080000
80#define D_M_AURP 0x00100000
81#define D_M_AURP_LOW 0x00200000
82#define D_M_TRACE 0x10000000
83
84
85
86
87
88
89
90
91typedef struct dbgBits {
92 unsigned long dbgMod;
93 unsigned long dbgLev;
94} dbgBits_t;
95
96extern dbgBits_t dbgBits;
97
98
99#ifdef DEBUG
100#define dPrintf(mod, lev, p) \
101 if (((mod) & dbgBits.dbgMod) && ((lev) & dbgBits.dbgLev)) {\
102 kprintf p; \
103 }
104#else
105#define dPrintf(mod, lev, p)
106#endif
107
108
109
110
111#include <sys/kdebug.h>
112#if KDEBUG
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135#define DBG_AT_DDP_INPUT NETDBG_CODE(DBG_NETDDP, 1)
136#define DBG_AT_DDP_OUTPUT NETDBG_CODE(DBG_NETDDP, 2)
137
138#define DBG_ADSP_MISC NETDBG_CODE(DBG_NETADSP, 0)
139#define DBG_ADSP_RCV NETDBG_CODE(DBG_NETADSP, 1)
140#define DBG_ADSP_SND NETDBG_CODE(DBG_NETADSP, 2)
141#define DBG_ADSP_READ NETDBG_CODE(DBG_NETADSP, 3)
142#define DBG_ADSP_WRITE NETDBG_CODE(DBG_NETADSP, 4)
143#define DBG_ADSP_MBUF NETDBG_CODE(DBG_NETADSP, 5)
144#define DBG_ADSP_PNEXT NETDBG_CODE(DBG_NETADSP, 6)
145#define DBG_ADSP_ATRW NETDBG_CODE(DBG_NETADSP, 7)
146#endif
147
148#define trace_mbufs(pri, str, start)\
149{ if (start)\
150{ int i; gbuf_t *tmp;\
151 for (tmp=start, i=0; tmp && i < 10; tmp = gbuf_cont(tmp), i++) {\
152 dPrintf(pri, D_L_TRACE, ("%s=0x%x, len=%d %s\n",\
153 str, tmp, gbuf_len(tmp),\
154 (((struct mbuf *)tmp)->m_flags & M_EXT)?"CL":""));\
155 KERNEL_DEBUG(DBG_ADSP_MBUF, 0, tmp, gbuf_len(tmp), gbuf_next(tmp), \
156 ((struct mbuf *)tmp)->m_flags & M_EXT);\
157}}}
158
159
160
161
162#ifndef LOG_DRIVER
163extern char *log_errp;
164extern char *log_trcp;
165#endif
166
167
168
169
170
171#if !defined(lint) && defined(AT_DEBUG)
172#define ATTRACE(mid,sid,level,log,fmt,arg1,arg2,arg3) \
173 if (log_trcp || (log && log_errp)) { \
174 strlog(mid,sid,level,SL_TRACE | \
175 (log ? SL_ERROR : 0) | \
176 (level <= AT_LV_FATAL ? SL_FATAL : 0), \
177 fmt,arg1,arg2,arg3); \
178 }
179#else
180#define ATTRACE(mid,sid,level,log,fmt,arg1,arg2,arg3) \
181
182
183#endif
184
185
186
187
188#define AT_LV_FATAL 1
189#define AT_LV_ERROR 3
190#define AT_LV_WARNING 5
191#define AT_LV_INFO 7
192#define AT_LV_VERBOSE 9
193
194
195
196
197
198
199#define AT_SID_INPUT 1
200#define AT_SID_OUTPUT 2
201#define AT_SID_TIMERS 3
202#define AT_SID_FLOWCTRL 4
203#define AT_SID_USERREQ 5
204#define AT_SID_RESOURCE 6
205
206
207
208
209
210#define AT_MID(n) (200+n)
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231#ifdef AT_MID_STRINGS
232static char *at_mid_strings[] = {
233 "misc",
234 "LLAP",
235 "ELAP",
236 "DDP",
237 "RTMP",
238 "NBP",
239 "EP",
240 "ATP",
241 "ZIP",
242 "PAP",
243 "ASP",
244 "AFP",
245 "ADSP",
246 "NBPD",
247 "LAP"
248};
249#endif
250
251
252#ifndef SL_FATAL
253
254
255
256
257#define SL_FATAL 01
258#define SL_NOTIFY 02
259#define SL_ERROR 04
260#define SL_TRACE 010
261
262#endif
263
264#endif
265#endif
266#endif
267
268