am79900.c revision 1.21.4.1 1 /* $NetBSD: am79900.c,v 1.21.4.1 2010/05/30 05:17:20 rmind Exp $ */
2
3 /*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*-
33 * Copyright (c) 1992, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * This code is derived from software contributed to Berkeley by
37 * Ralph Campbell and Rick Macklem.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. Neither the name of the University nor the names of its contributors
48 * may be used to endorse or promote products derived from this software
49 * without specific prior written permission.
50 *
51 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
52 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 * SUCH DAMAGE.
62 *
63 * @(#)if_le.c 8.2 (Berkeley) 11/16/93
64 */
65
66 /*-
67 * Copyright (c) 1998
68 * Matthias Drochner. All rights reserved.
69 * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
70 *
71 * This code is derived from software contributed to Berkeley by
72 * Ralph Campbell and Rick Macklem.
73 *
74 * Redistribution and use in source and binary forms, with or without
75 * modification, are permitted provided that the following conditions
76 * are met:
77 * 1. Redistributions of source code must retain the above copyright
78 * notice, this list of conditions and the following disclaimer.
79 * 2. Redistributions in binary form must reproduce the above copyright
80 * notice, this list of conditions and the following disclaimer in the
81 * documentation and/or other materials provided with the distribution.
82 * 3. All advertising materials mentioning features or use of this software
83 * must display the following acknowledgement:
84 * This product includes software developed by the University of
85 * California, Berkeley and its contributors.
86 * 4. Neither the name of the University nor the names of its contributors
87 * may be used to endorse or promote products derived from this software
88 * without specific prior written permission.
89 *
90 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
94 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
96 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
100 * SUCH DAMAGE.
101 *
102 * @(#)if_le.c 8.2 (Berkeley) 11/16/93
103 */
104
105 #include <sys/cdefs.h>
106 __KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.21.4.1 2010/05/30 05:17:20 rmind Exp $");
107
108 #include "rnd.h"
109
110 #include <sys/param.h>
111 #include <sys/systm.h>
112 #include <sys/mbuf.h>
113 #include <sys/syslog.h>
114 #include <sys/socket.h>
115 #include <sys/device.h>
116 #include <sys/malloc.h>
117 #include <sys/ioctl.h>
118 #include <sys/errno.h>
119 #if NRND > 0
120 #include <sys/rnd.h>
121 #endif
122
123 #include <net/if.h>
124 #include <net/if_dl.h>
125 #include <net/if_ether.h>
126 #include <net/if_media.h>
127
128 #include <net/bpf.h>
129 #include <net/bpfdesc.h>
130
131 #include <dev/ic/lancereg.h>
132 #include <dev/ic/lancevar.h>
133 #include <dev/ic/am79900reg.h>
134 #include <dev/ic/am79900var.h>
135
136 static void am79900_meminit(struct lance_softc *);
137 static void am79900_start(struct ifnet *);
138
139 #if defined(_KERNEL_OPT)
140 #include "opt_ddb.h"
141 #endif
142
143 #ifdef LEDEBUG
144 static void am79900_recv_print(struct lance_softc *, int);
145 static void am79900_xmit_print(struct lance_softc *, int);
146 #endif
147
148 #define ifp (&sc->sc_ethercom.ec_if)
149
150 void
151 am79900_config(struct am79900_softc *sc)
152 {
153 int mem, i;
154
155 sc->lsc.sc_meminit = am79900_meminit;
156 sc->lsc.sc_start = am79900_start;
157
158 lance_config(&sc->lsc);
159
160 mem = 0;
161 sc->lsc.sc_initaddr = mem;
162 mem += sizeof(struct leinit);
163 sc->lsc.sc_rmdaddr = mem;
164 mem += sizeof(struct lermd) * sc->lsc.sc_nrbuf;
165 sc->lsc.sc_tmdaddr = mem;
166 mem += sizeof(struct letmd) * sc->lsc.sc_ntbuf;
167 for (i = 0; i < sc->lsc.sc_nrbuf; i++, mem += LEBLEN)
168 sc->lsc.sc_rbufaddr[i] = mem;
169 for (i = 0; i < sc->lsc.sc_ntbuf; i++, mem += LEBLEN)
170 sc->lsc.sc_tbufaddr[i] = mem;
171
172 if (mem > sc->lsc.sc_memsize)
173 panic("%s: memsize", device_xname(sc->lsc.sc_dev));
174 }
175
176 /*
177 * Set up the initialization block and the descriptor rings.
178 */
179 static void
180 am79900_meminit(struct lance_softc *sc)
181 {
182 u_long a;
183 int bix;
184 struct leinit init;
185 struct lermd rmd;
186 struct letmd tmd;
187 uint8_t *myaddr;
188
189 if (ifp->if_flags & IFF_PROMISC)
190 init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
191 else
192 init.init_mode = LE_MODE_NORMAL;
193 if (sc->sc_initmodemedia == 1)
194 init.init_mode |= LE_MODE_PSEL0;
195
196 init.init_mode |= ((ffs(sc->sc_ntbuf) - 1) << 28)
197 | ((ffs(sc->sc_nrbuf) - 1) << 20);
198
199 /*
200 * Update our private copy of the Ethernet address.
201 * We NEED the copy so we can ensure its alignment!
202 */
203 memcpy(sc->sc_enaddr, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN);
204 myaddr = sc->sc_enaddr;
205
206 init.init_padr[0] = myaddr[0] | (myaddr[1] << 8)
207 | (myaddr[2] << 16) | (myaddr[3] << 24);
208 init.init_padr[1] = myaddr[4] | (myaddr[5] << 8);
209 lance_setladrf(&sc->sc_ethercom, init.init_ladrf);
210
211 sc->sc_last_rd = 0;
212 sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0;
213
214 a = sc->sc_addr + LE_RMDADDR(sc, 0);
215 init.init_rdra = a;
216
217 a = sc->sc_addr + LE_TMDADDR(sc, 0);
218 init.init_tdra = a;
219
220 (*sc->sc_copytodesc)(sc, &init, LE_INITADDR(sc), sizeof(init));
221
222 /*
223 * Set up receive ring descriptors.
224 */
225 for (bix = 0; bix < sc->sc_nrbuf; bix++) {
226 a = sc->sc_addr + LE_RBUFADDR(sc, bix);
227 rmd.rmd0 = a;
228 rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff);
229 rmd.rmd2 = 0;
230 rmd.rmd3 = 0;
231 (*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix),
232 sizeof(rmd));
233 }
234
235 /*
236 * Set up transmit ring descriptors.
237 */
238 for (bix = 0; bix < sc->sc_ntbuf; bix++) {
239 a = sc->sc_addr + LE_TBUFADDR(sc, bix);
240 tmd.tmd0 = a;
241 tmd.tmd1 = LE_T1_ONES;
242 tmd.tmd2 = 0;
243 tmd.tmd3 = 0;
244 (*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix),
245 sizeof(tmd));
246 }
247 }
248
249 static inline void
250 am79900_rint(struct lance_softc *sc)
251 {
252 int bix;
253 int rp;
254 struct lermd rmd;
255
256 bix = sc->sc_last_rd;
257
258 /* Process all buffers with valid data. */
259 for (;;) {
260 rp = LE_RMDADDR(sc, bix);
261 (*sc->sc_copyfromdesc)(sc, &rmd, rp, sizeof(rmd));
262
263 if (rmd.rmd1 & LE_R1_OWN)
264 break;
265
266 if (rmd.rmd1 & LE_R1_ERR) {
267 if (rmd.rmd1 & LE_R1_ENP) {
268 #ifdef LEDEBUG
269 if ((rmd.rmd1 & LE_R1_OFLO) == 0) {
270 if (rmd.rmd1 & LE_R1_FRAM)
271 printf("%s: framing error\n",
272 device_xname(sc->sc_dev));
273 if (rmd.rmd1 & LE_R1_CRC)
274 printf("%s: crc mismatch\n",
275 device_xname(sc->sc_dev));
276 }
277 #endif
278 } else {
279 if (rmd.rmd1 & LE_R1_OFLO)
280 printf("%s: overflow\n",
281 device_xname(sc->sc_dev));
282 }
283 if (rmd.rmd1 & LE_R1_BUFF)
284 printf("%s: receive buffer error\n",
285 device_xname(sc->sc_dev));
286 ifp->if_ierrors++;
287 } else if ((rmd.rmd1 & (LE_R1_STP | LE_R1_ENP)) !=
288 (LE_R1_STP | LE_R1_ENP)) {
289 printf("%s: dropping chained buffer\n",
290 device_xname(sc->sc_dev));
291 ifp->if_ierrors++;
292 } else {
293 #ifdef LEDEBUG
294 if (sc->sc_debug)
295 am79900_recv_print(sc, sc->sc_last_rd);
296 #endif
297 lance_read(sc, LE_RBUFADDR(sc, bix),
298 (rmd.rmd2 & 0xfff) - 4);
299 }
300
301 rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff);
302 rmd.rmd2 = 0;
303 rmd.rmd3 = 0;
304 (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
305
306 #ifdef LEDEBUG
307 if (sc->sc_debug)
308 printf("sc->sc_last_rd = %x, rmd: "
309 "adr %08x, flags/blen %08x\n",
310 sc->sc_last_rd,
311 rmd.rmd0, rmd.rmd1);
312 #endif
313
314 if (++bix == sc->sc_nrbuf)
315 bix = 0;
316 }
317
318 sc->sc_last_rd = bix;
319 }
320
321 static inline void
322 am79900_tint(struct lance_softc *sc)
323 {
324 int bix;
325 struct letmd tmd;
326
327 bix = sc->sc_first_td;
328
329 for (;;) {
330 if (sc->sc_no_td <= 0)
331 break;
332
333 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, bix),
334 sizeof(tmd));
335
336 #ifdef LEDEBUG
337 if (sc->sc_debug)
338 printf("trans tmd: "
339 "adr %08x, flags/blen %08x\n",
340 tmd.tmd0, tmd.tmd1);
341 #endif
342
343 if (tmd.tmd1 & LE_T1_OWN)
344 break;
345
346 ifp->if_flags &= ~IFF_OACTIVE;
347
348 if (tmd.tmd1 & LE_T1_ERR) {
349 if (tmd.tmd2 & LE_T2_BUFF)
350 printf("%s: transmit buffer error\n",
351 device_xname(sc->sc_dev));
352 else if (tmd.tmd2 & LE_T2_UFLO)
353 printf("%s: underflow\n",
354 device_xname(sc->sc_dev));
355 if (tmd.tmd2 & (LE_T2_BUFF | LE_T2_UFLO)) {
356 lance_reset(sc);
357 return;
358 }
359 if (tmd.tmd2 & LE_T2_LCAR) {
360 sc->sc_havecarrier = 0;
361 if (sc->sc_nocarrier)
362 (*sc->sc_nocarrier)(sc);
363 else
364 printf("%s: lost carrier\n",
365 device_xname(sc->sc_dev));
366 }
367 if (tmd.tmd2 & LE_T2_LCOL)
368 ifp->if_collisions++;
369 if (tmd.tmd2 & LE_T2_RTRY) {
370 #ifdef LEDEBUG
371 printf("%s: excessive collisions\n",
372 device_xname(sc->sc_dev));
373 #endif
374 ifp->if_collisions += 16;
375 }
376 ifp->if_oerrors++;
377 } else {
378 if (tmd.tmd1 & LE_T1_ONE)
379 ifp->if_collisions++;
380 else if (tmd.tmd1 & LE_T1_MORE)
381 /* Real number is unknown. */
382 ifp->if_collisions += 2;
383 ifp->if_opackets++;
384 }
385
386 if (++bix == sc->sc_ntbuf)
387 bix = 0;
388
389 --sc->sc_no_td;
390 }
391
392 sc->sc_first_td = bix;
393
394 am79900_start(ifp);
395
396 if (sc->sc_no_td == 0)
397 ifp->if_timer = 0;
398 }
399
400 /*
401 * Controller interrupt.
402 */
403 int
404 am79900_intr(void *arg)
405 {
406 struct lance_softc *sc = arg;
407 uint16_t isr;
408
409 isr = (*sc->sc_rdcsr)(sc, LE_CSR0) | sc->sc_saved_csr0;
410 sc->sc_saved_csr0 = 0;
411 #if defined(LEDEBUG) && LEDEBUG > 1
412 if (sc->sc_debug)
413 printf("%s: am79900_intr entering with isr=%04x\n",
414 device_xname(sc->sc_dev), isr);
415 #endif
416 if ((isr & LE_C0_INTR) == 0)
417 return (0);
418
419 (*sc->sc_wrcsr)(sc, LE_CSR0,
420 isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | LE_C0_MERR |
421 LE_C0_RINT | LE_C0_TINT | LE_C0_IDON));
422 if (isr & LE_C0_ERR) {
423 if (isr & LE_C0_BABL) {
424 #ifdef LEDEBUG
425 printf("%s: babble\n", device_xname(sc->sc_dev));
426 #endif
427 ifp->if_oerrors++;
428 }
429 #if 0
430 if (isr & LE_C0_CERR) {
431 printf("%s: collision error\n",
432 device_xname(sc->sc_dev));
433 ifp->if_collisions++;
434 }
435 #endif
436 if (isr & LE_C0_MISS) {
437 #ifdef LEDEBUG
438 printf("%s: missed packet\n", device_xname(sc->sc_dev));
439 #endif
440 ifp->if_ierrors++;
441 }
442 if (isr & LE_C0_MERR) {
443 printf("%s: memory error\n", device_xname(sc->sc_dev));
444 lance_reset(sc);
445 return (1);
446 }
447 }
448
449 if ((isr & LE_C0_RXON) == 0) {
450 printf("%s: receiver disabled\n", device_xname(sc->sc_dev));
451 ifp->if_ierrors++;
452 lance_reset(sc);
453 return (1);
454 }
455 if ((isr & LE_C0_TXON) == 0) {
456 printf("%s: transmitter disabled\n", device_xname(sc->sc_dev));
457 ifp->if_oerrors++;
458 lance_reset(sc);
459 return (1);
460 }
461
462 /*
463 * Pretend we have carrier; if we don't this will be cleared
464 * shortly.
465 */
466 sc->sc_havecarrier = 1;
467
468 if (isr & LE_C0_RINT)
469 am79900_rint(sc);
470 if (isr & LE_C0_TINT)
471 am79900_tint(sc);
472
473 #if NRND > 0
474 rnd_add_uint32(&sc->rnd_source, isr);
475 #endif
476
477 return (1);
478 }
479
480 #undef ifp
481
482 /*
483 * Setup output on interface.
484 * Get another datagram to send off of the interface queue, and map it to the
485 * interface before starting the output.
486 * Called only at splnet or interrupt level.
487 */
488 static void
489 am79900_start(struct ifnet *ifp)
490 {
491 struct lance_softc *sc = ifp->if_softc;
492 int bix;
493 struct mbuf *m;
494 struct letmd tmd;
495 int rp;
496 int len;
497
498 if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
499 return;
500
501 bix = sc->sc_last_td;
502
503 for (;;) {
504 rp = LE_TMDADDR(sc, bix);
505 (*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
506
507 if (tmd.tmd1 & LE_T1_OWN) {
508 ifp->if_flags |= IFF_OACTIVE;
509 printf("missing buffer, no_td = %d, last_td = %d\n",
510 sc->sc_no_td, sc->sc_last_td);
511 }
512
513 IFQ_DEQUEUE(&ifp->if_snd, m);
514 if (m == 0)
515 break;
516
517 /*
518 * If BPF is listening on this interface, let it see the packet
519 * before we commit it to the wire.
520 */
521 bpf_mtap(ifp, m);
522
523 /*
524 * Copy the mbuf chain into the transmit buffer.
525 */
526 len = lance_put(sc, LE_TBUFADDR(sc, bix), m);
527
528 #ifdef LEDEBUG
529 if (len > ETHERMTU + sizeof(struct ether_header))
530 printf("packet length %d\n", len);
531 #endif
532
533 ifp->if_timer = 5;
534
535 /*
536 * Init transmit registers, and set transmit start flag.
537 */
538 tmd.tmd1 = LE_T1_OWN | LE_T1_STP | LE_T1_ENP | LE_T1_ONES | (-len & 0xfff);
539 tmd.tmd2 = 0;
540 tmd.tmd3 = 0;
541
542 (*sc->sc_copytodesc)(sc, &tmd, rp, sizeof(tmd));
543
544 #ifdef LEDEBUG
545 if (sc->sc_debug)
546 am79900_xmit_print(sc, sc->sc_last_td);
547 #endif
548
549 (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_TDMD);
550
551 if (++bix == sc->sc_ntbuf)
552 bix = 0;
553
554 if (++sc->sc_no_td == sc->sc_ntbuf) {
555 ifp->if_flags |= IFF_OACTIVE;
556 break;
557 }
558
559 }
560
561 sc->sc_last_td = bix;
562 }
563
564 #ifdef LEDEBUG
565 static void
566 am79900_recv_print(struct lance_softc *sc, int no)
567 {
568 struct lermd rmd;
569 uint16_t len;
570 struct ether_header eh;
571
572 (*sc->sc_copyfromdesc)(sc, &rmd, LE_RMDADDR(sc, no), sizeof(rmd));
573 len = (rmd.rmd2 & 0xfff) - 4;
574 printf("%s: receive buffer %d, len = %d\n",
575 device_xname(sc->sc_dev), no, len);
576 printf("%s: status %04x\n", device_xname(sc->sc_dev),
577 (*sc->sc_rdcsr)(sc, LE_CSR0));
578 printf("%s: adr %08x, flags/blen %08x\n",
579 device_xname(sc->sc_dev), rmd.rmd0, rmd.rmd1);
580 if (len >= sizeof(eh)) {
581 (*sc->sc_copyfrombuf)(sc, &eh, LE_RBUFADDR(sc, no), sizeof(eh));
582 printf("%s: dst %s", device_xname(sc->sc_dev),
583 ether_sprintf(eh.ether_dhost));
584 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
585 ntohs(eh.ether_type));
586 }
587 }
588
589 static void
590 am79900_xmit_print(struct lance_softc *sc, int no)
591 {
592 struct letmd tmd;
593 uint16_t len;
594 struct ether_header eh;
595
596 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, no), sizeof(tmd));
597 len = -(tmd.tmd1 & 0xfff);
598 printf("%s: transmit buffer %d, len = %d\n",
599 device_xname(sc->sc_dev), no, len);
600 printf("%s: status %04x\n", device_xname(sc->sc_dev),
601 (*sc->sc_rdcsr)(sc, LE_CSR0));
602 printf("%s: adr %08x, flags/blen %08x\n",
603 device_xname(sc->sc_dev), tmd.tmd0, tmd.tmd1);
604 if (len >= sizeof(eh)) {
605 (*sc->sc_copyfrombuf)(sc, &eh, LE_TBUFADDR(sc, no), sizeof(eh));
606 printf("%s: dst %s", device_xname(sc->sc_dev),
607 ether_sprintf(eh.ether_dhost));
608 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
609 ntohs(eh.ether_type));
610 }
611 }
612 #endif /* LEDEBUG */
613