3 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the author nor the names of any co-contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * $FreeBSD: src/sys/dev/ray/if_raydbg.h,v 1.10.2.2 2001/08/14 22:54:07 dmlb Exp $
32 * $DragonFly: src/sys/dev/netif/ray/Attic/if_raydbg.h,v 1.3 2005/02/17 13:59:36 joerg Exp $
37 * Debugging odds and odds
44 * SUBR Subroutine entry
45 * BOOTPARAM Startup CM dump
46 * STARTJOIN State transitions for start/join
49 * MBUF MBUFs dumped - needs one of TX, RX, MGT, or CTL
50 * RX packet types reported
51 * CM common memory re-mapping
52 * COM new command sleep/wakeup
53 * STOP driver detaching
57 * DCOM dump comq entries
59 #define RAY_DBG_AUTH 0x0001
60 #define RAY_DBG_SUBR 0x0002
61 #define RAY_DBG_BOOTPARAM 0x0004
62 #define RAY_DBG_STARTJOIN 0x0008
63 #define RAY_DBG_CCS 0x0010
64 #define RAY_DBG_IOCTL 0x0020
65 #define RAY_DBG_MBUF 0x0080
66 #define RAY_DBG_RX 0x0100
67 #define RAY_DBG_CM 0x0200
68 #define RAY_DBG_COM 0x0400
69 #define RAY_DBG_STOP 0x0800
70 #define RAY_DBG_CTL 0x1000
71 #define RAY_DBG_MGT 0x2000
72 #define RAY_DBG_TX 0x4000
73 #define RAY_DBG_DCOM 0x8000
74 /* Cut and paste this into a kernel configuration file */
77 /* RAY_DBG_SUBR | */ \
78 /* RAY_DBG_BOOTPARAM | */ \
79 /* RAY_DBG_STARTJOIN | */ \
81 /* RAY_DBG_IOCTL | */ \
82 /* RAY_DBG_MBUF | */ \
86 /* RAY_DBG_STOP | */ \
90 /* RAY_DBG_DCOM | */ \
97 #define RAY_DPRINTF(sc, mask, fmt, args...) do {if (RAY_DEBUG & (mask)) {\
98 device_printf((sc)->dev, "%s(%d) " fmt "\n", \
99 __func__ , __LINE__ , ##args); \
102 /* This macro assumes that common memory is mapped into kernel space */
103 #define RAY_DHEX8(sc, mask, off, len, s) do { if (RAY_DEBUG & (mask)) { \
105 device_printf((sc)->dev, "%s(%d) %s\n", \
106 __func__ , __LINE__ , (s)); \
107 for (i = (off); i < (off)+(len); i += 8) { \
108 printf(". 0x%04x ", i); \
109 for (j = 0; j < 8; j++) \
110 printf("%02x ", SRAM_READ_1((sc), i+j)); \
115 #define RAY_DCOM(sc, mask, com, s) do { if (RAY_DEBUG & (mask)) { \
116 device_printf((sc)->dev, "%s(%d) %s com entry 0x%p\n", \
117 __func__ , __LINE__ , (s) , (com)); \
118 printf(". c_mesg %s\n", (com)->c_mesg); \
119 printf(". c_flags 0x%b\n", (com)->c_flags, RAY_COM_FLAGS_PRINTFB); \
120 printf(". c_retval 0x%x\n", (com)->c_retval); \
121 printf(". c_ccs 0x%0x index 0x%02x\n", \
122 (com)->c_ccs, RAY_CCS_INDEX((com)->c_ccs)); \
126 #define RAY_DPRINTF(sc, mask, fmt, args...)
127 #define RAY_DHEX8(sc, mask, off, len, s)
128 #define RAY_DCOM(sc, mask, com, s)
129 #endif /* RAY_DEBUG > 0 */
132 * These override macros defined in if_ray.c to turn them into
136 #define RAY_RECERR(sc, fmt, args...) do { \
137 device_printf((sc)->dev, "%s(%d) " fmt "\n", \
138 __func__ , __LINE__ , ##args); \
140 #endif /* RAY_DEBUG */
142 #if RAY_DEBUG & RAY_DBG_COM
143 #define RAY_COM_CHECK(sc, com) do { if (RAY_DEBUG & RAY_DBG_COM) { \
144 ray_com_ecf_check((sc), (com), __func__ ); \
146 #endif /* RAY_DEBUG & RAY_DBG_COM */
148 #if RAY_DEBUG & RAY_DBG_MBUF
149 #define RAY_MBUF_DUMP(sc, mask, m, s) do { if (RAY_DEBUG & (mask)) { \
150 ray_dump_mbuf((sc), (m), (s)); \
152 #endif /* RAY_DEBUG & RAY_DBG_MBUF */