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