am79900.c revision 1.28.2.1 1 /* $NetBSD: am79900.c,v 1.28.2.1 2020/04/08 14:08:06 martin 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.28.2.1 2020/04/08 14:08:06 martin Exp $");
107
108 #include <sys/param.h>
109 #include <sys/systm.h>
110 #include <sys/mbuf.h>
111 #include <sys/syslog.h>
112 #include <sys/socket.h>
113 #include <sys/device.h>
114 #include <sys/malloc.h>
115 #include <sys/ioctl.h>
116 #include <sys/errno.h>
117 #include <sys/rndsource.h>
118
119 #include <net/if.h>
120 #include <net/if_dl.h>
121 #include <net/if_ether.h>
122 #include <net/if_media.h>
123 #include <net/bpf.h>
124
125 #include <dev/ic/lancereg.h>
126 #include <dev/ic/lancevar.h>
127 #include <dev/ic/am79900reg.h>
128 #include <dev/ic/am79900var.h>
129
130 static void am79900_meminit(struct lance_softc *);
131 static void am79900_start(struct ifnet *);
132
133 #if defined(_KERNEL_OPT)
134 #include "opt_ddb.h"
135 #endif
136
137 #ifdef LEDEBUG
138 static void am79900_recv_print(struct lance_softc *, int);
139 static void am79900_xmit_print(struct lance_softc *, int);
140 #endif
141
142 #define ifp (&sc->sc_ethercom.ec_if)
143
144 void
145 am79900_config(struct am79900_softc *sc)
146 {
147 int mem, i;
148
149 sc->lsc.sc_meminit = am79900_meminit;
150 sc->lsc.sc_start = am79900_start;
151
152 lance_config(&sc->lsc);
153 if_deferred_start_init(&sc->lsc.sc_ethercom.ec_if, NULL);
154
155 mem = 0;
156 sc->lsc.sc_initaddr = mem;
157 mem += sizeof(struct leinit);
158 sc->lsc.sc_rmdaddr = mem;
159 mem += sizeof(struct lermd) * sc->lsc.sc_nrbuf;
160 sc->lsc.sc_tmdaddr = mem;
161 mem += sizeof(struct letmd) * sc->lsc.sc_ntbuf;
162 for (i = 0; i < sc->lsc.sc_nrbuf; i++, mem += LEBLEN)
163 sc->lsc.sc_rbufaddr[i] = mem;
164 for (i = 0; i < sc->lsc.sc_ntbuf; i++, mem += LEBLEN)
165 sc->lsc.sc_tbufaddr[i] = mem;
166
167 if (mem > sc->lsc.sc_memsize)
168 panic("%s: memsize", device_xname(sc->lsc.sc_dev));
169 }
170
171 /*
172 * Set up the initialization block and the descriptor rings.
173 */
174 static void
175 am79900_meminit(struct lance_softc *sc)
176 {
177 u_long a;
178 int bix;
179 struct leinit init;
180 struct lermd rmd;
181 struct letmd tmd;
182 uint8_t *myaddr;
183
184 if (ifp->if_flags & IFF_PROMISC)
185 init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
186 else
187 init.init_mode = LE_MODE_NORMAL;
188 if (sc->sc_initmodemedia == 1)
189 init.init_mode |= LE_MODE_PSEL0;
190
191 init.init_mode |= ((ffs(sc->sc_ntbuf) - 1) << 28)
192 | ((ffs(sc->sc_nrbuf) - 1) << 20);
193
194 /*
195 * Update our private copy of the Ethernet address.
196 * We NEED the copy so we can ensure its alignment!
197 */
198 memcpy(sc->sc_enaddr, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN);
199 myaddr = sc->sc_enaddr;
200
201 init.init_padr[0] = myaddr[0] | (myaddr[1] << 8)
202 | (myaddr[2] << 16) | (myaddr[3] << 24);
203 init.init_padr[1] = myaddr[4] | (myaddr[5] << 8);
204 lance_setladrf(&sc->sc_ethercom, init.init_ladrf);
205
206 sc->sc_last_rd = 0;
207 sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0;
208
209 a = sc->sc_addr + LE_RMDADDR(sc, 0);
210 init.init_rdra = a;
211
212 a = sc->sc_addr + LE_TMDADDR(sc, 0);
213 init.init_tdra = a;
214
215 (*sc->sc_copytodesc)(sc, &init, LE_INITADDR(sc), sizeof(init));
216
217 /*
218 * Set up receive ring descriptors.
219 */
220 for (bix = 0; bix < sc->sc_nrbuf; bix++) {
221 a = sc->sc_addr + LE_RBUFADDR(sc, bix);
222 rmd.rmd0 = a;
223 rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff);
224 rmd.rmd2 = 0;
225 rmd.rmd3 = 0;
226 (*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix),
227 sizeof(rmd));
228 }
229
230 /*
231 * Set up transmit ring descriptors.
232 */
233 for (bix = 0; bix < sc->sc_ntbuf; bix++) {
234 a = sc->sc_addr + LE_TBUFADDR(sc, bix);
235 tmd.tmd0 = a;
236 tmd.tmd1 = LE_T1_ONES;
237 tmd.tmd2 = 0;
238 tmd.tmd3 = 0;
239 (*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix),
240 sizeof(tmd));
241 }
242 }
243
244 static inline void
245 am79900_rint(struct lance_softc *sc)
246 {
247 int bix;
248 int rp;
249 struct lermd rmd;
250
251 bix = sc->sc_last_rd;
252
253 /* Process all buffers with valid data. */
254 for (;;) {
255 rp = LE_RMDADDR(sc, bix);
256 (*sc->sc_copyfromdesc)(sc, &rmd, rp, sizeof(rmd));
257
258 if (rmd.rmd1 & LE_R1_OWN)
259 break;
260
261 if (rmd.rmd1 & LE_R1_ERR) {
262 if (rmd.rmd1 & LE_R1_ENP) {
263 #ifdef LEDEBUG
264 if ((rmd.rmd1 & LE_R1_OFLO) == 0) {
265 if (rmd.rmd1 & LE_R1_FRAM)
266 printf("%s: framing error\n",
267 device_xname(sc->sc_dev));
268 if (rmd.rmd1 & LE_R1_CRC)
269 printf("%s: crc mismatch\n",
270 device_xname(sc->sc_dev));
271 }
272 #endif
273 } else {
274 if (rmd.rmd1 & LE_R1_OFLO)
275 printf("%s: overflow\n",
276 device_xname(sc->sc_dev));
277 }
278 if (rmd.rmd1 & LE_R1_BUFF)
279 printf("%s: receive buffer error\n",
280 device_xname(sc->sc_dev));
281 if_statinc(ifp, if_ierrors);
282 } else if ((rmd.rmd1 & (LE_R1_STP | LE_R1_ENP)) !=
283 (LE_R1_STP | LE_R1_ENP)) {
284 printf("%s: dropping chained buffer\n",
285 device_xname(sc->sc_dev));
286 if_statinc(ifp, if_ierrors);
287 } else {
288 #ifdef LEDEBUG
289 if (sc->sc_debug)
290 am79900_recv_print(sc, sc->sc_last_rd);
291 #endif
292 lance_read(sc, LE_RBUFADDR(sc, bix),
293 (rmd.rmd2 & 0xfff) - 4);
294 }
295
296 rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff);
297 rmd.rmd2 = 0;
298 rmd.rmd3 = 0;
299 (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
300
301 #ifdef LEDEBUG
302 if (sc->sc_debug)
303 printf("sc->sc_last_rd = %x, rmd: "
304 "adr %08x, flags/blen %08x\n",
305 sc->sc_last_rd,
306 rmd.rmd0, rmd.rmd1);
307 #endif
308
309 if (++bix == sc->sc_nrbuf)
310 bix = 0;
311 }
312
313 sc->sc_last_rd = bix;
314 }
315
316 static inline void
317 am79900_tint(struct lance_softc *sc)
318 {
319 int bix;
320 struct letmd tmd;
321
322 bix = sc->sc_first_td;
323
324 for (;;) {
325 if (sc->sc_no_td <= 0)
326 break;
327
328 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, bix),
329 sizeof(tmd));
330
331 #ifdef LEDEBUG
332 if (sc->sc_debug)
333 printf("trans tmd: "
334 "adr %08x, flags/blen %08x\n",
335 tmd.tmd0, tmd.tmd1);
336 #endif
337
338 if (tmd.tmd1 & LE_T1_OWN)
339 break;
340
341 if (tmd.tmd1 & LE_T1_ERR) {
342 if (tmd.tmd2 & LE_T2_BUFF)
343 printf("%s: transmit buffer error\n",
344 device_xname(sc->sc_dev));
345 else if (tmd.tmd2 & LE_T2_UFLO)
346 printf("%s: underflow\n",
347 device_xname(sc->sc_dev));
348 if (tmd.tmd2 & (LE_T2_BUFF | LE_T2_UFLO)) {
349 lance_reset(sc);
350 return;
351 }
352 if (tmd.tmd2 & LE_T2_LCAR) {
353 sc->sc_havecarrier = 0;
354 if (sc->sc_nocarrier)
355 (*sc->sc_nocarrier)(sc);
356 else
357 printf("%s: lost carrier\n",
358 device_xname(sc->sc_dev));
359 }
360 if (tmd.tmd2 & LE_T2_LCOL)
361 if_statinc(ifp, if_collisions);
362 if (tmd.tmd2 & LE_T2_RTRY) {
363 #ifdef LEDEBUG
364 printf("%s: excessive collisions\n",
365 device_xname(sc->sc_dev));
366 #endif
367 if_statadd(ifp, if_collisions, 16);
368 }
369 if_statinc(ifp, if_oerrors);
370 } else {
371 if (tmd.tmd1 & LE_T1_ONE)
372 if_statinc(ifp, if_collisions);
373 else if (tmd.tmd1 & LE_T1_MORE)
374 /* Real number is unknown. */
375 if_statadd(ifp, if_collisions, 2);
376 if_statinc(ifp, if_opackets);
377 }
378
379 if (++bix == sc->sc_ntbuf)
380 bix = 0;
381
382 --sc->sc_no_td;
383 }
384
385 sc->sc_first_td = bix;
386
387 if_schedule_deferred_start(ifp);
388
389 if (sc->sc_no_td == 0)
390 ifp->if_timer = 0;
391 }
392
393 /*
394 * Controller interrupt.
395 */
396 int
397 am79900_intr(void *arg)
398 {
399 struct lance_softc *sc = arg;
400 uint16_t isr;
401
402 isr = (*sc->sc_rdcsr)(sc, LE_CSR0) | sc->sc_saved_csr0;
403 sc->sc_saved_csr0 = 0;
404 #if defined(LEDEBUG) && LEDEBUG > 1
405 if (sc->sc_debug)
406 printf("%s: am79900_intr entering with isr=%04x\n",
407 device_xname(sc->sc_dev), isr);
408 #endif
409 if ((isr & LE_C0_INTR) == 0)
410 return (0);
411
412 (*sc->sc_wrcsr)(sc, LE_CSR0,
413 isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | LE_C0_MERR |
414 LE_C0_RINT | LE_C0_TINT | LE_C0_IDON));
415 if (isr & LE_C0_ERR) {
416 if (isr & LE_C0_BABL) {
417 #ifdef LEDEBUG
418 printf("%s: babble\n", device_xname(sc->sc_dev));
419 #endif
420 if_statinc(ifp, if_oerrors);
421 }
422 #if 0
423 if (isr & LE_C0_CERR) {
424 printf("%s: collision error\n",
425 device_xname(sc->sc_dev));
426 if_statinc(ifp, if_collisions);
427 }
428 #endif
429 if (isr & LE_C0_MISS) {
430 #ifdef LEDEBUG
431 printf("%s: missed packet\n", device_xname(sc->sc_dev));
432 #endif
433 if_statinc(ifp, if_ierrors);
434 }
435 if (isr & LE_C0_MERR) {
436 printf("%s: memory error\n", device_xname(sc->sc_dev));
437 lance_reset(sc);
438 return (1);
439 }
440 }
441
442 if ((isr & LE_C0_RXON) == 0) {
443 printf("%s: receiver disabled\n", device_xname(sc->sc_dev));
444 if_statinc(ifp, if_ierrors);
445 lance_reset(sc);
446 return (1);
447 }
448 if ((isr & LE_C0_TXON) == 0) {
449 printf("%s: transmitter disabled\n", device_xname(sc->sc_dev));
450 if_statinc(ifp, if_oerrors);
451 lance_reset(sc);
452 return (1);
453 }
454
455 /*
456 * Pretend we have carrier; if we don't this will be cleared
457 * shortly.
458 */
459 sc->sc_havecarrier = 1;
460
461 if (isr & LE_C0_RINT)
462 am79900_rint(sc);
463 if (isr & LE_C0_TINT)
464 am79900_tint(sc);
465
466 rnd_add_uint32(&sc->rnd_source, isr);
467
468 return (1);
469 }
470
471 #undef ifp
472
473 /*
474 * Setup output on interface.
475 * Get another datagram to send off of the interface queue, and map it to the
476 * interface before starting the output.
477 * Called only at splnet or interrupt level.
478 */
479 static void
480 am79900_start(struct ifnet *ifp)
481 {
482 struct lance_softc *sc = ifp->if_softc;
483 int bix;
484 struct mbuf *m;
485 struct letmd tmd;
486 int rp;
487 int len;
488
489 if ((ifp->if_flags & IFF_RUNNING) != IFF_RUNNING)
490 return;
491
492 bix = sc->sc_last_td;
493
494 while (sc->sc_no_td < sc->sc_ntbuf) {
495 rp = LE_TMDADDR(sc, bix);
496 (*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
497
498 if (tmd.tmd1 & LE_T1_OWN) {
499 printf("%s: missing buffer, no_td = %d, last_td = %d\n",
500 device_xname(sc->sc_dev), sc->sc_no_td,
501 sc->sc_last_td);
502 break;
503 }
504
505 IFQ_DEQUEUE(&ifp->if_snd, m);
506 if (m == 0)
507 break;
508
509 /*
510 * If BPF is listening on this interface, let it see the packet
511 * before we commit it to the wire.
512 */
513 bpf_mtap(ifp, m, BPF_D_OUT);
514
515 /*
516 * Copy the mbuf chain into the transmit buffer.
517 */
518 len = lance_put(sc, LE_TBUFADDR(sc, bix), m);
519
520 #ifdef LEDEBUG
521 if (len > ETHERMTU + sizeof(struct ether_header))
522 printf("packet length %d\n", len);
523 #endif
524
525 ifp->if_timer = 5;
526
527 /*
528 * Init transmit registers, and set transmit start flag.
529 */
530 tmd.tmd1 = LE_T1_OWN | LE_T1_STP | LE_T1_ENP | LE_T1_ONES | (-len & 0xfff);
531 tmd.tmd2 = 0;
532 tmd.tmd3 = 0;
533
534 (*sc->sc_copytodesc)(sc, &tmd, rp, sizeof(tmd));
535
536 #ifdef LEDEBUG
537 if (sc->sc_debug)
538 am79900_xmit_print(sc, sc->sc_last_td);
539 #endif
540
541 (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_TDMD);
542
543 if (++bix == sc->sc_ntbuf)
544 bix = 0;
545
546 sc->sc_no_td++;
547 }
548
549 sc->sc_last_td = bix;
550 }
551
552 #ifdef LEDEBUG
553 static void
554 am79900_recv_print(struct lance_softc *sc, int no)
555 {
556 struct lermd rmd;
557 uint16_t len;
558 struct ether_header eh;
559
560 (*sc->sc_copyfromdesc)(sc, &rmd, LE_RMDADDR(sc, no), sizeof(rmd));
561 len = (rmd.rmd2 & 0xfff) - 4;
562 printf("%s: receive buffer %d, len = %d\n",
563 device_xname(sc->sc_dev), no, len);
564 printf("%s: status %04x\n", device_xname(sc->sc_dev),
565 (*sc->sc_rdcsr)(sc, LE_CSR0));
566 printf("%s: adr %08x, flags/blen %08x\n",
567 device_xname(sc->sc_dev), rmd.rmd0, rmd.rmd1);
568 if (len >= sizeof(eh)) {
569 (*sc->sc_copyfrombuf)(sc, &eh, LE_RBUFADDR(sc, no), sizeof(eh));
570 printf("%s: dst %s", device_xname(sc->sc_dev),
571 ether_sprintf(eh.ether_dhost));
572 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
573 ntohs(eh.ether_type));
574 }
575 }
576
577 static void
578 am79900_xmit_print(struct lance_softc *sc, int no)
579 {
580 struct letmd tmd;
581 uint16_t len;
582 struct ether_header eh;
583
584 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, no), sizeof(tmd));
585 len = -(tmd.tmd1 & 0xfff);
586 printf("%s: transmit buffer %d, len = %d\n",
587 device_xname(sc->sc_dev), no, len);
588 printf("%s: status %04x\n", device_xname(sc->sc_dev),
589 (*sc->sc_rdcsr)(sc, LE_CSR0));
590 printf("%s: adr %08x, flags/blen %08x\n",
591 device_xname(sc->sc_dev), tmd.tmd0, tmd.tmd1);
592 if (len >= sizeof(eh)) {
593 (*sc->sc_copyfrombuf)(sc, &eh, LE_TBUFADDR(sc, no), sizeof(eh));
594 printf("%s: dst %s", device_xname(sc->sc_dev),
595 ether_sprintf(eh.ether_dhost));
596 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
597 ntohs(eh.ether_type));
598 }
599 }
600 #endif /* LEDEBUG */
601