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