if_de.c revision 4875
1/*- 2 * Copyright (c) 1994 Matt Thomas (thomas@lkg.dec.com) 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. The name of the author may not be used to endorse or promote products 11 * derived from this software withough specific prior written permission 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * 24 * $Id: if_de.c,v 1.8 1994/11/24 14:29:34 davidg Exp $ 25 * 26 */ 27 28/* 29 * DEC DC21040 PCI Ethernet Controller 30 * 31 * Written by Matt Thomas 32 * BPF support code stolen directly from if_ec.c 33 * 34 * This driver supports the DEC DE435 or any other PCI 35 * board which support DC21040. 36 */ 37 38#include "de.h" 39#if NDE > 0 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/mbuf.h> 44#include <sys/protosw.h> 45#include <sys/socket.h> 46#include <sys/ioctl.h> 47#include <sys/errno.h> 48#include <sys/malloc.h> 49 50#include <net/if.h> 51#include <net/if_types.h> 52#include <net/if_dl.h> 53#include <net/route.h> 54 55#include "bpfilter.h" 56#if NBPFILTER > 0 57#include <net/bpf.h> 58#include <net/bpfdesc.h> 59#endif 60 61#ifdef INET 62#include <netinet/in.h> 63#include <netinet/in_systm.h> 64#include <netinet/in_var.h> 65#include <netinet/ip.h> 66#include <netinet/if_ether.h> 67#endif 68 69#ifdef NS 70#include <netns/ns.h> 71#include <netns/ns_if.h> 72#endif 73 74#include <vm/vm.h> 75#include <vm/vm_kern.h> 76#include <vm/vm_param.h> 77 78 79#include <pci.h> 80#if NPCI > 0 81#include <i386/pci/pcireg.h> 82#endif 83#include <i386/isa/icu.h> 84#include <i386/pci/dc21040.h> 85 86/* 87 * This module supports the DEC DC21040 PCI Ethernet Controller. 88 */ 89 90typedef struct { 91 unsigned long addr; 92 unsigned long length; 93} tulip_addrvec_t; 94 95typedef struct { 96 tulip_desc_t *ri_first; 97 tulip_desc_t *ri_last; 98 tulip_desc_t *ri_nextin; 99 tulip_desc_t *ri_nextout; 100 int ri_max; 101 int ri_free; 102} tulip_ringinfo_t; 103 104typedef struct { 105 volatile tulip_uint32_t *csr_busmode; /* CSR0 */ 106 volatile tulip_uint32_t *csr_txpoll; /* CSR1 */ 107 volatile tulip_uint32_t *csr_rxpoll; /* CSR2 */ 108 volatile tulip_uint32_t *csr_rxlist; /* CSR3 */ 109 volatile tulip_uint32_t *csr_txlist; /* CSR4 */ 110 volatile tulip_uint32_t *csr_status; /* CSR5 */ 111 volatile tulip_uint32_t *csr_command; /* CSR6 */ 112 volatile tulip_uint32_t *csr_intr; /* CSR7 */ 113 volatile tulip_uint32_t *csr_missed_frame; /* CSR8 */ 114 volatile tulip_sint32_t *csr_enetrom; /* CSR9 */ 115 volatile tulip_uint32_t *csr_reserved; /* CSR10 */ 116 volatile tulip_uint32_t *csr_full_duplex; /* CSR11 */ 117 volatile tulip_uint32_t *csr_sia_status; /* CSR12 */ 118 volatile tulip_uint32_t *csr_sia_connectivity; /* CSR13 */ 119 volatile tulip_uint32_t *csr_sia_tx_rx; /* CSR14 */ 120 volatile tulip_uint32_t *csr_sia_general; /* CSR15 */ 121} tulip_regfile_t; 122 123/* 124 * The DC21040 has a stupid restriction in that the receive 125 * buffers must be longword aligned. But since Ethernet 126 * headers are not a multiple of longwords in size this forces 127 * the data to non-longword aligned. Since IP requires the 128 * data to be longword aligned, we need to copy it after it has 129 * been DMA'ed in our memory. 130 * 131 * Since we have to copy it anyways, we might as well as allocate 132 * dedicated receive space for the input. This allows to use a 133 * small receive buffer size and more ring entries to be able to 134 * better keep with a flood of tiny Ethernet packets. 135 * 136 * The receive space MUST ALWAYS be a multiple of the page size. 137 * And the number of receive descriptors multiplied by the size 138 * of the receive buffers must equal the recevive space. This 139 * is so that we can manipulate the page tables so that even if a 140 * packet wraps around the end of the receive space, we can 141 * treat it as virtually contiguous. 142 */ 143#define TULIP_RXBUFSIZE 512 144#define TULIP_RXDESCS 128 145#define TULIP_RXSPACE (TULIP_RXBUFSIZE * TULIP_RXDESCS) 146#define TULIP_TXDESCS 128 147 148typedef struct { 149 struct arpcom tulip_ac; 150 tulip_regfile_t tulip_csrs; 151 vm_offset_t tulip_rxspace; 152 unsigned tulip_flags; 153#define TULIP_WANTSETUP 0x01 154#define TULIP_WANTHASH 0x02 155#define TULIP_DOINGSETUP 0x04 156#define TULIP_ALTPHYS 0x08 /* use AUI */ 157 unsigned char tulip_rombuf[32]; 158 tulip_uint32_t tulip_setupbuf[192/sizeof(tulip_uint32_t)]; 159 tulip_uint32_t tulip_setupdata[192/sizeof(tulip_uint32_t)]; 160 tulip_uint32_t tulip_intrmask; 161 tulip_uint32_t tulip_cmdmode; 162 tulip_uint32_t tulip_revinfo; 163#if NBPFILTER > 0 164 caddr_t tulip_bpf; /* BPF context */ 165#endif 166 struct ifqueue tulip_txq; 167 tulip_ringinfo_t tulip_rxinfo; 168 tulip_ringinfo_t tulip_txinfo; 169} tulip_softc_t; 170 171#ifndef IFF_ALTPHYS 172#define IFF_ALTPHYS IFF_LINK0 /* In case it isn't defined */ 173#endif 174typedef enum { TULIP_DC21040, TULIP_DC21140 } tulip_chipid_t; 175const char *tulip_chipdescs[] = { 176 "DC21040 [10Mb/s]", 177 "DC21140 [100Mb/s]", 178}; 179 180tulip_softc_t *tulips[NDE]; 181tulip_chipid_t tulip_chipids[NDE]; 182 183#define tulip_if tulip_ac.ac_if 184#define tulip_unit tulip_ac.ac_if.if_unit 185#define tulip_name tulip_ac.ac_if.if_name 186#define tulip_hwaddr tulip_ac.ac_enaddr 187 188#define TULIP_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little Endian */ 189#define TULIP_CHECK_RXCRC 0 190#define TULIP_MAX_TXSEG 30 191 192#define TULIP_ADDREQUAL(a1, a2) \ 193 (((u_short *)a1)[0] == ((u_short *)a2)[0] \ 194 && ((u_short *)a1)[1] == ((u_short *)a2)[1] \ 195 && ((u_short *)a1)[2] == ((u_short *)a2)[2]) 196#define TULIP_ADDRBRDCST(a1) \ 197 (((u_short *)a1)[0] == 0xFFFFU \ 198 && ((u_short *)a1)[1] == 0xFFFFU \ 199 && ((u_short *)a1)[2] == 0xFFFFU) 200 201static void tulip_start(struct ifnet *ifp); 202static void tulip_addr_filter(tulip_softc_t *sc); 203 204#if __FreeBSD__ > 1 205#define TULIP_IFRESET_ARGS int unit 206#define TULIP_RESET(sc) tulip_reset((sc)->tulip_unit) 207#else 208#define TULIP_IFRESET_ARGS int unit, int uban 209#define TULIP_RESET(sc) tulip_reset((sc)->tulip_unit, 0) 210#endif 211 212static void 213tulip_reset( 214 TULIP_IFRESET_ARGS) 215{ 216 tulip_softc_t *sc = tulips[unit]; 217 tulip_ringinfo_t *ri; 218 tulip_desc_t *di; 219 vm_offset_t vmoff; 220 221 *sc->tulip_csrs.csr_busmode = TULIP_BUSMODE_SWRESET; 222 DELAY(10); /* Wait 10 microsends (actually 50 PCI cycles but at 223 33MHz that comes to two microseconds but wait a 224 bit longer anyways) */ 225 226 /* 227 * Use the 228 */ 229 *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_RESET; 230 if (sc->tulip_if.if_flags & IFF_ALTPHYS) { 231 if ((sc->tulip_flags & TULIP_ALTPHYS) == 0) 232 printf("%s%d: enabling Thinwire/AUI port\n", 233 sc->tulip_if.if_name, sc->tulip_if.if_unit); 234 *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_AUI; 235 sc->tulip_flags |= TULIP_ALTPHYS; 236 } else { 237 if (sc->tulip_flags & TULIP_ALTPHYS) 238 printf("%s%d: enabling 10baseT/UTP port\n", 239 sc->tulip_if.if_name, sc->tulip_if.if_unit); 240 *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_10BASET; 241 sc->tulip_flags &= ~TULIP_ALTPHYS; 242 } 243 *sc->tulip_csrs.csr_txlist = vtophys(&sc->tulip_txinfo.ri_first[0]); 244 *sc->tulip_csrs.csr_rxlist = vtophys(&sc->tulip_rxinfo.ri_first[0]); 245 *sc->tulip_csrs.csr_intr = 0; 246 *sc->tulip_csrs.csr_busmode = 0x4800; 247 248 sc->tulip_txq.ifq_maxlen = TULIP_TXDESCS; 249 /* 250 * Free all the mbufs that were on the transmit ring. 251 */ 252 for (;;) { 253 struct mbuf *m; 254 IF_DEQUEUE(&sc->tulip_txq, m); 255 if (m == NULL) 256 break; 257 m_freem(m); 258 } 259 260 ri = &sc->tulip_txinfo; 261 ri->ri_nextin = ri->ri_nextout = ri->ri_first; 262 ri->ri_free = ri->ri_max; 263 for (di = ri->ri_first; di < ri->ri_last; di++) 264 di->d_status = 0; 265 266 /* 267 * We need to collect all the mbufs were on the 268 * receive ring before we reinit it either to put 269 * them back on or to know if we have to allocate 270 * more. 271 */ 272 ri = &sc->tulip_rxinfo; 273 ri->ri_nextin = ri->ri_nextout = ri->ri_first; 274 ri->ri_free = ri->ri_max; 275 for (vmoff = vtophys(sc->tulip_rxspace), di = ri->ri_first; 276 di < ri->ri_last; di++, vmoff += TULIP_RXBUFSIZE) { 277 di->d_status |= TULIP_DSTS_OWNER; 278 di->d_length1 = TULIP_RXBUFSIZE; di->d_addr1 = vmoff; 279 di->d_length2 = 0; di->d_addr2 = 0; 280 } 281 282 sc->tulip_intrmask = TULIP_STS_NORMALINTR|TULIP_STS_RXINTR|TULIP_STS_TXINTR 283 |TULIP_STS_ABNRMLINTR|TULIP_STS_SYSERROR|TULIP_STS_TXSTOPPED 284 |TULIP_STS_TXBABBLE|TULIP_STS_LINKFAIL|TULIP_STS_RXSTOPPED; 285 sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP); 286 tulip_addr_filter(sc); 287} 288 289static void 290tulip_init( 291 int unit) 292{ 293 tulip_softc_t *sc = tulips[unit]; 294 295 if (sc->tulip_if.if_flags & IFF_UP) { 296 sc->tulip_if.if_flags |= IFF_RUNNING; 297 if (sc->tulip_if.if_flags & IFF_PROMISC) { 298 sc->tulip_cmdmode |= TULIP_CMD_PROMISCUOUS; 299 } else { 300 sc->tulip_cmdmode &= ~TULIP_CMD_PROMISCUOUS; 301 if (sc->tulip_if.if_flags & IFF_ALLMULTI) { 302 sc->tulip_cmdmode |= TULIP_CMD_ALLMULTI; 303 } else { 304 sc->tulip_cmdmode &= ~TULIP_CMD_ALLMULTI; 305 } 306 } 307 sc->tulip_cmdmode |= TULIP_CMD_TXRUN; 308 if ((sc->tulip_flags & TULIP_WANTSETUP) == 0) { 309 sc->tulip_cmdmode |= TULIP_CMD_RXRUN; 310 sc->tulip_intrmask |= TULIP_STS_RXSTOPPED; 311 } else { 312 sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; 313 tulip_start(&sc->tulip_if); 314 } 315 sc->tulip_cmdmode |= TULIP_CMD_THRSHLD160; 316 *sc->tulip_csrs.csr_intr = sc->tulip_intrmask; 317 *sc->tulip_csrs.csr_command = sc->tulip_cmdmode; 318 } else { 319 TULIP_RESET(sc); 320 sc->tulip_if.if_flags &= ~IFF_RUNNING; 321 } 322} 323 324 325#if TULIP_CHECK_RXCRC 326static unsigned 327tulip_crc32( 328 u_char *addr, 329 int len) 330{ 331 unsigned int crc = 0xFFFFFFFF; 332 static unsigned int crctbl[256]; 333 int idx; 334 static int done; 335 /* 336 * initialize the multicast address CRC table 337 */ 338 for (idx = 0; !done && idx < 256; idx++) { 339 unsigned int tmp = idx; 340 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 341 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 342 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 343 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 344 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 345 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 346 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 347 tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */ 348 crctbl[idx] = tmp; 349 } 350 done = 1; 351 352 while (len-- > 0) 353 crc = (crc >> 8) ^ crctbl[*addr++] ^ crctbl[crc & 0xFF]; 354 355 return crc; 356} 357#endif 358 359static void 360tulip_rx_intr( 361 tulip_softc_t *sc) 362{ 363 tulip_ringinfo_t *ri = &sc->tulip_rxinfo; 364 struct ifnet *ifp = &sc->tulip_if; 365 366 for (;;) { 367 tulip_desc_t *eop; 368 int total_len, ndescs; 369 caddr_t bufaddr = (caddr_t) sc->tulip_rxspace; 370 371 for (ndescs = 1, eop = ri->ri_nextin;; ndescs++) { 372 if (((volatile tulip_desc_t *) eop)->d_status & TULIP_DSTS_OWNER) 373 return; 374 375 if (eop->d_status & TULIP_DSTS_RxLASTDESC) 376 break; 377 if (++eop == ri->ri_last) 378 eop = ri->ri_first; 379 } 380 381 bufaddr += TULIP_RXBUFSIZE * (ri->ri_nextin - ri->ri_first); 382 total_len = ((eop->d_status >> 16) & 0x7FF) - 4; 383 384 if ((eop->d_status & TULIP_DSTS_ERRSUM) == 0) { 385 struct ether_header eh; 386 struct mbuf *m; 387 388#if TULIP_CHECK_RXCRC 389 unsigned crc = tulip_crc32(bufaddr, total_len); 390 if (~crc != *((unsigned *) &bufaddr[total_len])) { 391 printf("de0: bad rx crc: %08x [rx] != %08x\n", 392 *((unsigned *) &bufaddr[total_len]), ~crc); 393 goto next; 394 } 395#endif 396 eh = *(struct ether_header *) bufaddr; 397#if NBPFILTER > 0 398 if (sc->tulip_bpf != NULL) { 399 bpf_tap(sc->tulip_bpf, bufaddr, total_len); 400 if ((eh.ether_dhost[0] & 1) == 0 && 401 !TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_ac.ac_enaddr)) 402 goto next; 403 } else if (!TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_ac.ac_enaddr) 404 && !TULIP_ADDRBRDCST(eh.ether_dhost)) { 405 goto next; 406 } 407#endif 408 MGETHDR(m, M_DONTWAIT, MT_DATA); 409 if (m != NULL) { 410 m->m_pkthdr.rcvif = ifp; 411 total_len -= sizeof(eh); 412 if (total_len > MHLEN) { 413 MCLGET(m, M_DONTWAIT); 414 if ((m->m_flags & M_EXT) == 0) { 415 m_freem(m); 416 ifp->if_ierrors++; 417 goto next; 418 } 419 } 420 bcopy(bufaddr + sizeof(eh), mtod(m, caddr_t), total_len); 421 m->m_len = m->m_pkthdr.len = total_len; 422 ether_input(ifp, &eh, m); 423 } else { 424 ifp->if_ierrors++; 425 } 426 } else { 427 ifp->if_ierrors++; 428 } 429next: 430 ifp->if_ipackets++; 431 while (ndescs-- > 0) { 432 ri->ri_nextin->d_status |= TULIP_DSTS_OWNER; 433 if (++ri->ri_nextin == ri->ri_last) 434 ri->ri_nextin = ri->ri_first; 435 } 436 } 437} 438 439static int 440tulip_tx_intr( 441 tulip_softc_t *sc) 442{ 443 tulip_ringinfo_t *ri = &sc->tulip_txinfo; 444 struct mbuf *m; 445 int xmits = 0; 446 447 while (ri->ri_free < ri->ri_max) { 448 if (((volatile tulip_desc_t *) ri->ri_nextin)->d_status & TULIP_DSTS_OWNER) 449 break; 450 451 if (ri->ri_nextin->d_flag & TULIP_DFLAG_TxLASTSEG) { 452 if (ri->ri_nextin->d_flag & TULIP_DFLAG_TxSETUPPKT) { 453 /* 454 * We've just finished processing a setup packet. 455 * Mark that we can finished it. If there's not 456 * another pending, startup the TULIP receiver. 457 * Make sure we ack the RXSTOPPED so we won't get 458 * an abormal interrupt indication. 459 */ 460 sc->tulip_flags &= ~TULIP_DOINGSETUP; 461 if ((sc->tulip_flags & TULIP_WANTSETUP) == 0) { 462 sc->tulip_cmdmode |= TULIP_CMD_RXRUN; 463 sc->tulip_intrmask |= TULIP_STS_RXSTOPPED; 464 *sc->tulip_csrs.csr_status = TULIP_STS_RXSTOPPED; 465 *sc->tulip_csrs.csr_command = sc->tulip_cmdmode; 466 *sc->tulip_csrs.csr_intr = sc->tulip_intrmask; 467 } 468 } else { 469 IF_DEQUEUE(&sc->tulip_txq, m); 470 m_freem(m); 471 sc->tulip_if.if_collisions += 472 (ri->ri_nextin->d_status & TULIP_DSTS_TxCOLLMASK) 473 >> TULIP_DSTS_V_TxCOLLCNT; 474 if (ri->ri_nextin->d_status & TULIP_DSTS_ERRSUM) 475 sc->tulip_if.if_oerrors++; 476 xmits++; 477 } 478 } 479 480 if (++ri->ri_nextin == ri->ri_last) 481 ri->ri_nextin = ri->ri_first; 482 ri->ri_free++; 483 sc->tulip_if.if_flags &= ~IFF_OACTIVE; 484 } 485 sc->tulip_if.if_opackets += xmits; 486 return xmits; 487} 488 489static int 490tulip_txsegment( 491 tulip_softc_t *sc, 492 struct mbuf *m, 493 tulip_addrvec_t *avp, 494 size_t maxseg) 495{ 496 int segcnt; 497 498 for (segcnt = 0; m; m = m->m_next) { 499 int len = m->m_len; 500 caddr_t addr = mtod(m, caddr_t); 501 unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1)); 502 503 while (len > 0) { 504 unsigned slen = min(len, clsize); 505 if (segcnt < maxseg) { 506 avp->addr = vtophys(addr); 507 avp->length = slen; 508 } 509 len -= slen; 510 addr += slen; 511 clsize = CLBYTES; 512 avp++; 513 segcnt++; 514 } 515 } 516 if (segcnt >= maxseg) { 517 printf("%s%d: tulip_txsegment: extremely fragmented packet encountered (%d segments)\n", 518 sc->tulip_name, sc->tulip_unit, segcnt); 519 return -1; 520 } 521 avp->addr = 0; 522 avp->length = 0; 523 return segcnt; 524} 525 526static void 527tulip_start( 528 struct ifnet *ifp) 529{ 530 tulip_softc_t *sc = (tulip_softc_t *) ifp; 531 struct ifqueue *ifq = &ifp->if_snd; 532 tulip_ringinfo_t *ri = &sc->tulip_txinfo; 533 tulip_desc_t *sop, *eop; 534 struct mbuf *m; 535 tulip_addrvec_t addrvec[TULIP_MAX_TXSEG+1], *avp; 536 int segcnt; 537 tulip_uint32_t d_status; 538 539 if ((ifp->if_flags & IFF_RUNNING) == 0) 540 return; 541 542 for (;;) { 543 if (sc->tulip_flags & TULIP_WANTSETUP) { 544 if ((sc->tulip_flags & TULIP_DOINGSETUP) || ri->ri_free == 1) { 545 ifp->if_flags |= IFF_OACTIVE; 546 return; 547 } 548 bcopy(sc->tulip_setupdata, sc->tulip_setupbuf, 549 sizeof(sc->tulip_setupbuf)); 550 sc->tulip_flags &= ~TULIP_WANTSETUP; 551 sc->tulip_flags |= TULIP_DOINGSETUP; 552 ri->ri_free--; 553 ri->ri_nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; 554 ri->ri_nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG 555 |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR; 556 if (sc->tulip_flags & TULIP_WANTHASH) 557 ri->ri_nextout->d_flag |= TULIP_DFLAG_TxHASHFILT; 558 ri->ri_nextout->d_length1 = sizeof(sc->tulip_setupbuf); 559 ri->ri_nextout->d_addr1 = vtophys(sc->tulip_setupbuf); 560 ri->ri_nextout->d_length2 = 0; 561 ri->ri_nextout->d_addr2 = 0; 562 ri->ri_nextout->d_status = TULIP_DSTS_OWNER; 563 *sc->tulip_csrs.csr_txpoll = 1; 564 /* 565 * Advance the ring for the next transmit packet. 566 */ 567 if (++ri->ri_nextout == ri->ri_last) 568 ri->ri_nextout = ri->ri_first; 569 } 570 571 IF_DEQUEUE(ifq, m); 572 if (m == NULL) 573 break; 574 575 /* 576 * First find out how many and which different pages 577 * the mbuf data occupies. Then check to see if we 578 * have enough descriptor space in our transmit ring 579 * to actually send it. 580 */ 581 segcnt = tulip_txsegment(sc, m, addrvec, 582 min(ri->ri_max - 1, TULIP_MAX_TXSEG)); 583 if (segcnt < 0) { 584 struct mbuf *m0; 585 MGETHDR(m0, M_DONTWAIT, MT_DATA); 586 if (m0 != NULL) { 587 if (m->m_pkthdr.len > MHLEN) { 588 MCLGET(m0, M_DONTWAIT); 589 if ((m0->m_flags & M_EXT) == 0) { 590 m_freem(m); 591 continue; 592 } 593 } 594 m_copydata(m, 0, m0->m_pkthdr.len, mtod(m0, caddr_t)); 595 m0->m_pkthdr.len = m0->m_len = m->m_pkthdr.len; 596 m_freem(m); 597 IF_PREPEND(ifq, m0); 598 continue; 599 } else { 600 m_freem(m); 601 continue; 602 } 603 } 604 if (ri->ri_free - 2 <= (segcnt + 1) >> 1) 605 break; 606 607 ri->ri_free -= (segcnt + 1) >> 1; 608 /* 609 * Now we fill in our transmit descriptors. This is 610 * a bit reminiscent of going on the Ark two by two 611 * since each descriptor for the TULIP can describe 612 * two buffers. So we advance through the address 613 * vector two entries at a time to to fill each 614 * descriptor. Clear the first and last segment bits 615 * in each descriptor (actually just clear everything 616 * but the end-of-ring or chain bits) to make sure 617 * we don't get messed up by previously sent packets. 618 */ 619 sop = ri->ri_nextout; 620 d_status = 0; 621 avp = addrvec; 622 do { 623 eop = ri->ri_nextout; 624 eop->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; 625 eop->d_status = d_status; 626 eop->d_addr1 = avp->addr; eop->d_length1 = avp->length; avp++; 627 eop->d_addr2 = avp->addr; eop->d_length2 = avp->length; avp++; 628 d_status = TULIP_DSTS_OWNER; 629 if (++ri->ri_nextout == ri->ri_last) 630 ri->ri_nextout = ri->ri_first; 631 } while ((segcnt -= 2) > 0); 632#if NBPFILTER > 0 633 if (sc->tulip_bpf != NULL) 634 bpf_mtap(sc->tulip_bpf, m); 635#endif 636 /* 637 * The descriptors have been filled in. Mark the first 638 * and last segments, indicate we want a transmit complete 639 * interrupt, give the descriptors to the TULIP, and tell 640 * it to transmit! 641 */ 642 643 IF_ENQUEUE(&sc->tulip_txq, m); 644 eop->d_flag |= TULIP_DFLAG_TxLASTSEG|TULIP_DFLAG_TxWANTINTR; 645 sop->d_flag |= TULIP_DFLAG_TxFIRSTSEG; 646 sop->d_status = TULIP_DSTS_OWNER; 647 648 *sc->tulip_csrs.csr_txpoll = 1; 649 } 650 if (m != NULL) { 651 ifp->if_flags |= IFF_OACTIVE; 652 IF_PREPEND(ifq, m); 653 } 654} 655 656static int 657tulip_intr( 658 tulip_softc_t *sc) 659{ 660 tulip_uint32_t csr; 661 662 while ((csr = *sc->tulip_csrs.csr_status) & (TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR)) { 663 *sc->tulip_csrs.csr_status = csr & sc->tulip_intrmask; 664 665 if (csr & TULIP_STS_SYSERROR) { 666 if ((csr & TULIP_STS_ERRORMASK) == TULIP_STS_ERR_PARITY) { 667 TULIP_RESET(sc); 668 tulip_init(sc->tulip_unit); 669 return 1; 670 } 671 } 672 if (csr & TULIP_STS_ABNRMLINTR) { 673 printf("%s%d: abnormal interrupt: 0x%05x [0x%05x]\n", 674 sc->tulip_name, sc->tulip_unit, csr, csr & sc->tulip_intrmask); 675 *sc->tulip_csrs.csr_command = sc->tulip_cmdmode; 676 } 677 if (csr & TULIP_STS_RXINTR) 678 tulip_rx_intr(sc); 679 if (sc->tulip_txinfo.ri_free < sc->tulip_txinfo.ri_max) { 680 tulip_tx_intr(sc); 681 tulip_start(&sc->tulip_if); 682 } 683 } 684 return 1; 685} 686 687/* 688 * This is the standard method of reading the DEC Address ROMS. 689 */ 690static int 691tulip_read_macaddr( 692 tulip_softc_t *sc) 693{ 694 int cksum, rom_cksum, idx; 695 tulip_sint32_t csr; 696 unsigned char tmpbuf[8]; 697 static u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA }; 698 699 *sc->tulip_csrs.csr_enetrom = 1; 700 for (idx = 0; idx < 32; idx++) { 701 int cnt = 0; 702 while ((csr = *sc->tulip_csrs.csr_enetrom) < 0 && cnt < 10000) 703 cnt++; 704 sc->tulip_rombuf[idx] = csr & 0xFF; 705 } 706 707 if (bcmp(&sc->tulip_rombuf[0], &sc->tulip_rombuf[16], 8) != 0) { 708 /* 709 * Some folks don't use the standard ethernet rom format 710 * but instead just put the address in the first 6 bytes 711 * of the rom and let the rest be all 0xffs. (Can we say 712 * ZNYX???) 713 */ 714 for (idx = 6; idx < 32; idx++) { 715 if (sc->tulip_rombuf[idx] != 0xFF) 716 return -4; 717 } 718 /* 719 * Make sure the address is not multicast or locally assigned 720 * that the OUI is not 00-00-00. 721 */ 722 if ((sc->tulip_rombuf[0] & 3) != 0) 723 return -4; 724 if (sc->tulip_rombuf[0] == 0 && sc->tulip_rombuf[1] == 0 725 && sc->tulip_rombuf[2] == 0) 726 return -4; 727 bcopy(sc->tulip_rombuf, sc->tulip_hwaddr, 6); 728 return 0; 729 } 730 if (bcmp(&sc->tulip_rombuf[24], testpat, 8) != 0) 731 return -3; 732 733 tmpbuf[0] = sc->tulip_rombuf[15]; tmpbuf[1] = sc->tulip_rombuf[14]; 734 tmpbuf[2] = sc->tulip_rombuf[13]; tmpbuf[3] = sc->tulip_rombuf[12]; 735 tmpbuf[4] = sc->tulip_rombuf[11]; tmpbuf[5] = sc->tulip_rombuf[10]; 736 tmpbuf[6] = sc->tulip_rombuf[9]; tmpbuf[7] = sc->tulip_rombuf[8]; 737 if (bcmp(&sc->tulip_rombuf[0], tmpbuf, 8) != 0) 738 return -2; 739 740 bcopy(sc->tulip_rombuf, sc->tulip_hwaddr, 6); 741 742 cksum = *(u_short *) &sc->tulip_hwaddr[0]; 743 cksum *= 2; 744 if (cksum > 65535) cksum -= 65535; 745 cksum += *(u_short *) &sc->tulip_hwaddr[2]; 746 if (cksum > 65535) cksum -= 65535; 747 cksum *= 2; 748 if (cksum > 65535) cksum -= 65535; 749 cksum += *(u_short *) &sc->tulip_hwaddr[4]; 750 if (cksum >= 65535) cksum -= 65535; 751 752 rom_cksum = *(u_short *) &sc->tulip_rombuf[6]; 753 754 if (cksum != rom_cksum) 755 return -1; 756 return 0; 757} 758 759static unsigned 760tulip_mchash( 761 unsigned char *mca) 762{ 763 u_int idx, bit, data, crc = 0xFFFFFFFFUL; 764 765#ifdef __alpha 766 for (data = *(__unaligned u_long *) mca, bit = 0; bit < 48; bit++, data >>= 7671) 768 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0); 769#else 770 for (idx = 0; idx < 6; idx++) 771 for (data = *mca++, bit = 0; bit < 8; bit++, data >>= 1) 772 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0); 773#endif 774 return crc & 0x1FF; 775} 776 777static void 778tulip_addr_filter( 779 tulip_softc_t *sc) 780{ 781 tulip_uint32_t *sp = sc->tulip_setupdata; 782 struct ether_multistep step; 783 struct ether_multi *enm; 784 int i; 785 786 sc->tulip_flags &= ~TULIP_WANTHASH; 787 sc->tulip_flags |= TULIP_WANTSETUP; 788 sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; 789 sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; 790 if (sc->tulip_ac.ac_multicnt > 14) { 791 unsigned hash; 792 /* 793 * If we have more than 14 multicasts, we have 794 * go into hash perfect mode (512 bit multicast 795 * hash and one perfect hardware). 796 */ 797 798 bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); 799 hash = tulip_mchash(etherbroadcastaddr); 800 sp[hash >> 4] |= 1 << (hash & 0xF); 801 ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); 802 while (enm != NULL) { 803 hash = tulip_mchash(enm->enm_addrlo); 804 sp[hash >> 4] |= 1 << (hash & 0xF); 805 ETHER_NEXT_MULTI(step, enm); 806 } 807 sc->tulip_cmdmode |= TULIP_WANTHASH; 808 sp[40] = ((u_short *) sc->tulip_ac.ac_enaddr)[0]; 809 sp[41] = ((u_short *) sc->tulip_ac.ac_enaddr)[1]; 810 sp[42] = ((u_short *) sc->tulip_ac.ac_enaddr)[2]; 811 } else { 812 /* 813 * Else can get perfect filtering for 16 addresses. 814 */ 815 i = 0; 816 ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); 817 for (; enm != NULL; i++) { 818 *sp++ = ((u_short *) enm->enm_addrlo)[0]; 819 *sp++ = ((u_short *) enm->enm_addrlo)[1]; 820 *sp++ = ((u_short *) enm->enm_addrlo)[2]; 821 ETHER_NEXT_MULTI(step, enm); 822 } 823 /* 824 * If an IP address is enabled, turn on broadcast 825 */ 826 if (sc->tulip_ac.ac_ipaddr.s_addr != 0) { 827 i++; 828 *sp++ = 0xFFFF; 829 *sp++ = 0xFFFF; 830 *sp++ = 0xFFFF; 831 } 832 /* 833 * Pad the rest with our hardware address 834 */ 835 for (; i < 16; i++) { 836 *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[0]; 837 *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[1]; 838 *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[2]; 839 } 840 } 841} 842 843static int 844tulip_ioctl( 845 struct ifnet *ifp, 846 int cmd, 847 caddr_t data) 848{ 849 tulip_softc_t *sc = tulips[ifp->if_unit]; 850 struct ifaddr *ifa = (struct ifaddr *)data; 851 struct ifreq *ifr = (struct ifreq *) data; 852 int s, error = 0; 853 854 s = splimp(); 855 856 switch (cmd) { 857 case SIOCSIFADDR: { 858 859 ifp->if_flags |= IFF_UP; 860 switch(ifa->ifa_addr->sa_family) { 861#ifdef INET 862 case AF_INET: { 863 ((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr; 864 tulip_addr_filter(sc); /* reset multicast filtering */ 865 (*ifp->if_init)(ifp->if_unit); 866 arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr); 867 break; 868 } 869#endif /* INET */ 870 871#ifdef NS 872 /* This magic copied from if_is.c; I don't use XNS, 873 * so I have no way of telling if this actually 874 * works or not. 875 */ 876 case AF_NS: { 877 struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); 878 if (ns_nullhost(*ina)) { 879 ina->x_host = *(union ns_host *)(sc->tulip_ac.ac_enaddr); 880 } else { 881 ifp->if_flags &= ~IFF_RUNNING; 882 bcopy((caddr_t)ina->x_host.c_host, 883 (caddr_t)sc->tulip_ac.ac_enaddr, 884 sizeof sc->tulip_ac.ac_enaddr); 885 } 886 887 (*ifp->if_init)(ifp->if_unit); 888 break; 889 } 890#endif /* NS */ 891 892 default: { 893 (*ifp->if_init)(ifp->if_unit); 894 break; 895 } 896 } 897 break; 898 } 899 900 case SIOCSIFFLAGS: { 901 /* 902 * Changing the connection forces a reset. 903 */ 904 if (sc->tulip_flags & TULIP_ALTPHYS) { 905 if ((ifp->if_flags & IFF_ALTPHYS) == 0) 906 TULIP_RESET(sc); 907 } else { 908 if (ifp->if_flags & IFF_ALTPHYS) 909 TULIP_RESET(sc); 910 } 911 (*ifp->if_init)(ifp->if_unit); 912 break; 913 } 914 915 case SIOCADDMULTI: 916 case SIOCDELMULTI: { 917 /* 918 * Update multicast listeners 919 */ 920 if (cmd == SIOCADDMULTI) 921 error = ether_addmulti(ifr, &sc->tulip_ac); 922 else 923 error = ether_delmulti(ifr, &sc->tulip_ac); 924 925 if (error == ENETRESET) { 926 tulip_addr_filter(sc); /* reset multicast filtering */ 927 (*ifp->if_init)(ifp->if_unit); 928 error = 0; 929 } 930 break; 931 } 932 case SIOCSIFMTU: 933 /* 934 * Set the interface MTU. 935 */ 936 if (ifr->ifr_mtu > ETHERMTU) { 937 error = EINVAL; 938 } else { 939 ifp->if_mtu = ifr->ifr_mtu; 940 } 941 break; 942 943 default: { 944 error = EINVAL; 945 break; 946 } 947 } 948 949 splx(s); 950 return error; 951} 952 953static void 954tulip_attach( 955 tulip_softc_t *sc) 956{ 957 struct ifnet *ifp = &sc->tulip_if; 958 int cnt; 959 960 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; 961 962 *sc->tulip_csrs.csr_sia_connectivity = 0; 963 *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_10BASET; 964 for (cnt = 0; cnt < 240000; cnt++) { 965 if ((*sc->tulip_csrs.csr_sia_status & TULIP_SIASTS_LINKFAIL) == 0) 966 break; 967 DELAY(10); 968 } 969 if (*sc->tulip_csrs.csr_sia_status & TULIP_SIASTS_LINKFAIL) { 970 ifp->if_flags |= IFF_ALTPHYS; 971 } else { 972 sc->tulip_flags |= TULIP_ALTPHYS; 973 } 974 TULIP_RESET(sc); 975 976 ifp->if_init = tulip_init; 977 ifp->if_ioctl = tulip_ioctl; 978 ifp->if_output = ether_output; 979 ifp->if_reset = tulip_reset; 980 ifp->if_start = tulip_start; 981 982 printf("%s%d: %s pass %d.%d ethernet address %s\n", 983 sc->tulip_name, sc->tulip_unit, 984 tulip_chipdescs[tulip_chipids[sc->tulip_unit]], 985 (sc->tulip_revinfo & 0xF0) >> 4, 986 sc->tulip_revinfo & 0x0F, 987 ether_sprintf(sc->tulip_hwaddr)); 988 989 if_attach(ifp); 990 991#if NBPFILTER > 0 992 bpfattach(&sc->tulip_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); 993#endif 994} 995 996static void 997tulip_initcsrs( 998 tulip_softc_t *sc, 999 volatile tulip_uint32_t *va_csrs, 1000 size_t csr_size) 1001{ 1002 sc->tulip_csrs.csr_busmode = va_csrs + 0 * csr_size; 1003 sc->tulip_csrs.csr_txpoll = va_csrs + 1 * csr_size; 1004 sc->tulip_csrs.csr_rxpoll = va_csrs + 2 * csr_size; 1005 sc->tulip_csrs.csr_rxlist = va_csrs + 3 * csr_size; 1006 sc->tulip_csrs.csr_txlist = va_csrs + 4 * csr_size; 1007 sc->tulip_csrs.csr_status = va_csrs + 5 * csr_size; 1008 sc->tulip_csrs.csr_command = va_csrs + 6 * csr_size; 1009 sc->tulip_csrs.csr_intr = va_csrs + 7 * csr_size; 1010 sc->tulip_csrs.csr_missed_frame = va_csrs + 8 * csr_size; 1011 sc->tulip_csrs.csr_enetrom = va_csrs + 9 * csr_size; 1012 sc->tulip_csrs.csr_reserved = va_csrs + 10 * csr_size; 1013 sc->tulip_csrs.csr_full_duplex = va_csrs + 11 * csr_size; 1014 sc->tulip_csrs.csr_sia_status = va_csrs + 12 * csr_size; 1015 sc->tulip_csrs.csr_sia_connectivity = va_csrs + 13 * csr_size; 1016 sc->tulip_csrs.csr_sia_tx_rx = va_csrs + 14 * csr_size; 1017 sc->tulip_csrs.csr_sia_general = va_csrs + 15 * csr_size; 1018} 1019 1020static void 1021tulip_initring( 1022 tulip_softc_t *sc, 1023 tulip_ringinfo_t *ri, 1024 tulip_desc_t *descs, 1025 int ndescs) 1026{ 1027 ri->ri_max = ndescs; 1028 ri->ri_first = descs; 1029 ri->ri_last = ri->ri_first + ri->ri_max; 1030 bzero((caddr_t) ri->ri_first, sizeof(ri->ri_first[0]) * ri->ri_max); 1031 ri->ri_last[-1].d_flag = TULIP_DFLAG_ENDRING; 1032} 1033 1034#if NPCI > 0 1035/* 1036 * This is the PCI configuration support. Since the DC21040 is available 1037 * on both EISA and PCI boards, one must be careful in how defines the 1038 * DC21040 in the config file. 1039 */ 1040static char* tulip_pci_probe (pcici_t config_id, pcidi_t device_id); 1041static void tulip_pci_attach(pcici_t config_id, int unit); 1042static u_long tulip_count; 1043 1044struct pci_driver dedevice = { 1045 tulip_pci_probe, 1046 tulip_pci_attach, 1047 &tulip_count, 1048}; 1049 1050#define PCI_CFID 0x00 /* Configuration ID */ 1051#define PCI_CFCS 0x04 /* Configurtion Command/Status */ 1052#define PCI_CFRV 0x08 /* Configuration Revision */ 1053#define PCI_CFLT 0x0c /* Configuration Latency Timer */ 1054#define PCI_CBIO 0x10 /* Configuration Base IO Address */ 1055#define PCI_CBMA 0x14 /* Configuration Base Memory Address */ 1056#define PCI_CFIT 0x3c /* Configuration Interrupt */ 1057#define PCI_CFDA 0x40 /* Configuration Driver Area */ 1058 1059#define TULIP_PCI_CSRSIZE (8 / sizeof(tulip_uint32_t)) 1060static char* 1061tulip_pci_probe( 1062 pcici_t config_id, 1063 pcidi_t device_id) 1064{ 1065 int idx; 1066 for (idx = 0; idx < NDE; idx++) { 1067 if (tulips[idx] == NULL) { 1068 if (device_id == 0x00021011ul) { 1069 tulip_chipids[idx] = TULIP_DC21040; 1070 return "Digital DC21040 Ethernet"; 1071 } 1072 if (device_id == 0x00091011ul) { 1073 tulip_chipids[idx] = TULIP_DC21140; 1074 return "Digital DC21140 Fast Ethernet"; 1075 } 1076 return NULL; 1077 } 1078 } 1079 return NULL; 1080} 1081 1082static void 1083tulip_pci_attach( 1084 pcici_t config_id, 1085 int unit) 1086{ 1087 tulip_softc_t *sc; 1088 int retval, idx; 1089 vm_offset_t va_csrs, pa_csrs; 1090 tulip_desc_t *rxdescs, *txdescs; 1091 1092 sc = (tulip_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); 1093 if (sc == NULL) 1094 return; 1095 1096 rxdescs = (tulip_desc_t *) 1097 malloc(sizeof(tulip_desc_t) * TULIP_RXDESCS, M_DEVBUF, M_NOWAIT); 1098 if (rxdescs == NULL) { 1099 free((caddr_t) sc, M_DEVBUF); 1100 return; 1101 } 1102 1103 txdescs = (tulip_desc_t *) 1104 malloc(sizeof(tulip_desc_t) * TULIP_TXDESCS, M_DEVBUF, M_NOWAIT); 1105 if (txdescs == NULL) { 1106 free((caddr_t) rxdescs, M_DEVBUF); 1107 free((caddr_t) sc, M_DEVBUF); 1108 return; 1109 } 1110 1111 bzero(sc, sizeof(sc)); /* Zero out the softc*/ 1112 sc->tulip_rxspace = kmem_alloc(kernel_map, TULIP_RXSPACE + NBPG); 1113 /* 1114 * We've allocated an extra page of receive space so we can double map 1115 * the first page of the receive space into the page after the last page 1116 * of the receive space. This means that even if a receive wraps around 1117 * the end of the receive space, it will still virtually contiguous and 1118 * that greatly simplifies the recevie logic. 1119 */ 1120 pmap_enter(pmap_kernel(), sc->tulip_rxspace + TULIP_RXSPACE, 1121 vtophys(sc->tulip_rxspace), VM_PROT_READ, TRUE); 1122 1123 sc->tulip_unit = unit; 1124 sc->tulip_name = "de"; 1125 retval = pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs); 1126 if (!retval) { 1127 kmem_free(kernel_map, sc->tulip_rxspace, TULIP_RXSPACE + NBPG); 1128 free((caddr_t) txdescs, M_DEVBUF); 1129 free((caddr_t) rxdescs, M_DEVBUF); 1130 free((caddr_t) sc, M_DEVBUF); 1131 return; 1132 } 1133 tulips[unit] = sc; 1134 tulip_initcsrs(sc, (volatile tulip_uint32_t *) va_csrs, TULIP_PCI_CSRSIZE); 1135 tulip_initring(sc, &sc->tulip_rxinfo, rxdescs, TULIP_RXDESCS); 1136 tulip_initring(sc, &sc->tulip_txinfo, txdescs, TULIP_TXDESCS); 1137 sc->tulip_revinfo = pci_conf_read(config_id, PCI_CFRV); 1138 if ((retval = tulip_read_macaddr(sc)) < 0) { 1139 printf("de%d: can't read ENET ROM (why=%d) (", sc->tulip_unit, retval); 1140 for (idx = 0; idx < 32; idx++) 1141 printf("%02x", sc->tulip_rombuf[idx]); 1142 printf("\n"); 1143 printf("%s%d: %s pass %d.%d ethernet address %s\n", 1144 sc->tulip_name, sc->tulip_unit, 1145 tulip_chipdescs[tulip_chipids[sc->tulip_unit]], 1146 (sc->tulip_revinfo & 0xF0) >> 4, sc->tulip_revinfo & 0x0F, 1147 "unknown"); 1148 } else { 1149 TULIP_RESET(sc); 1150 tulip_attach(sc); 1151 pci_map_int (config_id, tulip_intr, (void*) sc, &net_imask); 1152 } 1153} 1154#endif /* NPCI > 0 */ 1155#endif /* NDE > 0 */ 1156