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
36 * Debugging odds and odds
43 * SUBR Subroutine entry
44 * BOOTPARAM Startup CM dump
45 * STARTJOIN State transitions for start/join
48 * MBUF MBUFs dumped - needs one of TX, RX, MGT, or CTL
49 * RX packet types reported
50 * CM common memory re-mapping
51 * COM new command sleep/wakeup
52 * STOP driver detaching
56 * DCOM dump comq entries
58 #define RAY_DBG_AUTH 0x0001
59 #define RAY_DBG_SUBR 0x0002
60 #define RAY_DBG_BOOTPARAM 0x0004
61 #define RAY_DBG_STARTJOIN 0x0008
62 #define RAY_DBG_CCS 0x0010
63 #define RAY_DBG_IOCTL 0x0020
64 #define RAY_DBG_MBUF 0x0080
65 #define RAY_DBG_RX 0x0100
66 #define RAY_DBG_CM 0x0200
67 #define RAY_DBG_COM 0x0400
68 #define RAY_DBG_STOP 0x0800
69 #define RAY_DBG_CTL 0x1000
70 #define RAY_DBG_MGT 0x2000
71 #define RAY_DBG_TX 0x4000
72 #define RAY_DBG_DCOM 0x8000
73 /* Cut and paste this into a kernel configuration file */
76 /* RAY_DBG_SUBR | */ \
77 /* RAY_DBG_BOOTPARAM | */ \
78 /* RAY_DBG_STARTJOIN | */ \
80 /* RAY_DBG_IOCTL | */ \
81 /* RAY_DBG_MBUF | */ \
85 /* RAY_DBG_STOP | */ \
89 /* RAY_DBG_DCOM | */ \
96 #define RAY_DPRINTF(sc, mask, fmt, args...) do {if (RAY_DEBUG & (mask)) {\
97 device_printf((sc)->dev, "%s(%d) " fmt "\n", \
98 __func__ , __LINE__ , ##args); \
101 /* This macro assumes that common memory is mapped into kernel space */
102 #define RAY_DHEX8(sc, mask, off, len, s) do { if (RAY_DEBUG & (mask)) { \
104 device_printf((sc)->dev, "%s(%d) %s\n", \
105 __func__ , __LINE__ , (s)); \
106 for (i = (off); i < (off)+(len); i += 8) { \
107 printf(". 0x%04x ", i); \
108 for (j = 0; j < 8; j++) \
109 printf("%02x ", SRAM_READ_1((sc), i+j)); \
114 #define RAY_DCOM(sc, mask, com, s) do { if (RAY_DEBUG & (mask)) { \
115 device_printf((sc)->dev, "%s(%d) %s com entry 0x%p\n", \
116 __func__ , __LINE__ , (s) , (com)); \
117 printf(". c_mesg %s\n", (com)->c_mesg); \
118 printf(". c_flags 0x%b\n", (com)->c_flags, RAY_COM_FLAGS_PRINTFB); \
119 printf(". c_retval 0x%x\n", (com)->c_retval); \
120 printf(". c_ccs 0x%0x index 0x%02x\n", \
121 (com)->c_ccs, RAY_CCS_INDEX((com)->c_ccs)); \
125 #define RAY_DPRINTF(sc, mask, fmt, args...)
126 #define RAY_DHEX8(sc, mask, off, len, s)
127 #define RAY_DCOM(sc, mask, com, s)
128 #endif /* RAY_DEBUG > 0 */
131 * These override macros defined in if_ray.c to turn them into
135 #define RAY_RECERR(sc, fmt, args...) do { \
136 device_printf((sc)->dev, "%s(%d) " fmt "\n", \
137 __func__ , __LINE__ , ##args); \
139 #endif /* RAY_DEBUG */
141 #if RAY_DEBUG & RAY_DBG_COM
142 #define RAY_COM_CHECK(sc, com) do { if (RAY_DEBUG & RAY_DBG_COM) { \
143 ray_com_ecf_check((sc), (com), __func__ ); \
145 #endif /* RAY_DEBUG & RAY_DBG_COM */
147 #if RAY_DEBUG & RAY_DBG_MBUF
148 #define RAY_MBUF_DUMP(sc, mask, m, s) do { if (RAY_DEBUG & (mask)) { \
149 ray_dump_mbuf((sc), (m), (s)); \
151 #endif /* RAY_DEBUG & RAY_DBG_MBUF */