1 /* $OpenBSD: if_dc_pci.c,v 1.55 2006/07/20 02:49:18 brad Exp $ */ 2 3 /* 4 * Copyright (c) 1997, 1998, 1999 5 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Bill Paul. 18 * 4. Neither the name of the author nor the names of any co-contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 * THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 * $FreeBSD: src/sys/pci/if_dc.c,v 1.5 2000/01/12 22:24:05 wpaul Exp $ 35 */ 36 37 #include "bpfilter.h" 38 39 #include <sys/param.h> 40 #include <sys/systm.h> 41 #include <sys/mbuf.h> 42 #include <sys/protosw.h> 43 #include <sys/socket.h> 44 #include <sys/ioctl.h> 45 #include <sys/errno.h> 46 #include <sys/timeout.h> 47 #include <sys/malloc.h> 48 #include <sys/kernel.h> 49 #include <sys/device.h> 50 51 #include <net/if.h> 52 #include <net/if_dl.h> 53 #include <net/if_types.h> 54 55 #ifdef INET 56 #include <netinet/in.h> 57 #include <netinet/in_systm.h> 58 #include <netinet/in_var.h> 59 #include <netinet/ip.h> 60 #include <netinet/if_ether.h> 61 #endif 62 63 #include <net/if_media.h> 64 65 #if NBPFILTER > 0 66 #include <net/bpf.h> 67 #endif 68 69 #include <dev/mii/mii.h> 70 #include <dev/mii/miivar.h> 71 72 #include <dev/pci/pcireg.h> 73 #include <dev/pci/pcivar.h> 74 #include <dev/pci/pcidevs.h> 75 76 #ifdef __sparc64__ 77 #include <dev/ofw/openfirm.h> 78 #endif 79 80 #ifndef __hppa__ 81 #define DC_USEIOSPACE 82 #endif 83 84 #include <dev/ic/dcreg.h> 85 86 /* 87 * Various supported device vendors/types and their names. 88 */ 89 struct dc_type dc_devs[] = { 90 { PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21140 }, 91 { PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21142 }, 92 { PCI_VENDOR_DAVICOM, PCI_PRODUCT_DAVICOM_DM9009 }, 93 { PCI_VENDOR_DAVICOM, PCI_PRODUCT_DAVICOM_DM9100 }, 94 { PCI_VENDOR_DAVICOM, PCI_PRODUCT_DAVICOM_DM9102 }, 95 { PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM9511 }, 96 { PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM9513 }, 97 { PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AL981 }, 98 { PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AN983 }, 99 { PCI_VENDOR_ASIX, PCI_PRODUCT_ASIX_AX88140A }, 100 { PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX98713 }, 101 { PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX98715 }, 102 { PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX98727 }, 103 { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_98713 }, 104 { PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_PNIC }, 105 { PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_PNICII }, 106 { PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_EN1217 }, 107 { PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_EN2242 }, 108 { PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_RS7112 }, 109 { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_21145 }, 110 { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CSHO100BTX }, 111 { PCI_VENDOR_MICROSOFT, PCI_PRODUCT_MICROSOFT_MN130 }, 112 { 0, 0 } 113 }; 114 115 int dc_pci_match(struct device *, void *, void *); 116 void dc_pci_attach(struct device *, struct device *, void *); 117 void dc_pci_acpi(struct device *, void *); 118 119 /* 120 * Probe for a 21143 or clone chip. Check the PCI vendor and device 121 * IDs against our list and return a device name if we find a match. 122 */ 123 int 124 dc_pci_match(parent, match, aux) 125 struct device *parent; 126 void *match, *aux; 127 { 128 struct pci_attach_args *pa = (struct pci_attach_args *)aux; 129 struct dc_type *t; 130 131 /* 132 * Support for the 21140 chip is experimental. If it works for you, 133 * that's great. By default, this chip will use de. 134 */ 135 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DEC && 136 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_21140) 137 return (1); 138 139 /* 140 * The following chip revision doesn't seem to work so well with dc, 141 * so let's have de handle it. (de will return a match of 2) 142 */ 143 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DEC && 144 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_21142 && 145 PCI_REVISION(pa->pa_class) == 0x21) 146 return (1); 147 148 /* 149 * Since dc doesn't fit on the alpha floppy, we want de to win by 150 * default on alpha so that RAMDISK* and GENERIC will use the same 151 * driver. 152 */ 153 for (t = dc_devs; t->dc_vid != 0; t++) { 154 if ((PCI_VENDOR(pa->pa_id) == t->dc_vid) && 155 (PCI_PRODUCT(pa->pa_id) == t->dc_did)) { 156 #ifdef __alpha__ 157 return (1); 158 #else 159 return (3); 160 #endif 161 } 162 } 163 164 return (0); 165 } 166 167 void dc_pci_acpi(self, aux) 168 struct device *self; 169 void *aux; 170 { 171 struct dc_softc *sc = (struct dc_softc *)self; 172 struct pci_attach_args *pa = (struct pci_attach_args *)aux; 173 pci_chipset_tag_t pc = pa->pa_pc; 174 u_int32_t r, cptr; 175 176 /* Find the location of the capabilities block */ 177 cptr = pci_conf_read(pc, pa->pa_tag, DC_PCI_CCAP) & 0xFF; 178 179 r = pci_conf_read(pc, pa->pa_tag, cptr) & 0xFF; 180 if (r == 0x01) { 181 182 r = pci_conf_read(pc, pa->pa_tag, cptr + PCI_PMCSR); 183 if (r & DC_PSTATE_D3) { 184 u_int32_t iobase, membase, irq; 185 186 /* Save important PCI config data. */ 187 iobase = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFBIO); 188 membase = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFBMA); 189 irq = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFIT); 190 191 /* Reset the power state. */ 192 printf("%s: chip is in D%d power mode " 193 "-- setting to D0\n", sc->sc_dev.dv_xname, 194 r & DC_PSTATE_D3); 195 r &= 0xFFFFFFFC; 196 pci_conf_write(pc, pa->pa_tag, cptr + PCI_PMCSR, r); 197 198 /* Restore PCI config data. */ 199 pci_conf_write(pc, pa->pa_tag, DC_PCI_CFBIO, iobase); 200 pci_conf_write(pc, pa->pa_tag, DC_PCI_CFBMA, membase); 201 pci_conf_write(pc, pa->pa_tag, DC_PCI_CFIT, irq); 202 } 203 } 204 return; 205 } 206 207 /* 208 * Attach the interface. Allocate softc structures, do ifmedia 209 * setup and ethernet/BPF attach. 210 */ 211 void dc_pci_attach(parent, self, aux) 212 struct device *parent, *self; 213 void *aux; 214 { 215 const char *intrstr = NULL; 216 pcireg_t command; 217 struct dc_softc *sc = (struct dc_softc *)self; 218 struct pci_attach_args *pa = aux; 219 pci_chipset_tag_t pc = pa->pa_pc; 220 pci_intr_handle_t ih; 221 bus_size_t size; 222 u_int32_t revision; 223 int found = 0; 224 225 sc->sc_dmat = pa->pa_dmat; 226 227 /* 228 * Handle power management nonsense. 229 */ 230 dc_pci_acpi(self, aux); 231 232 sc->dc_csid = pci_conf_read(pc, pa->pa_tag, PCI_SUBSYS_ID_REG); 233 234 /* 235 * Map control/status registers. 236 */ 237 #ifdef DC_USEIOSPACE 238 if (pci_mapreg_map(pa, DC_PCI_CFBIO, 239 PCI_MAPREG_TYPE_IO, 0, 240 &sc->dc_btag, &sc->dc_bhandle, NULL, &size, 0)) { 241 printf(": can't map i/o space\n"); 242 return; 243 } 244 #else 245 if (pci_mapreg_map(pa, DC_PCI_CFBMA, 246 PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, 247 &sc->dc_btag, &sc->dc_bhandle, NULL, &size, 0)) { 248 printf(": can't map mem space\n"); 249 return; 250 } 251 #endif 252 253 /* Allocate interrupt */ 254 if (pci_intr_map(pa, &ih)) { 255 printf(": couldn't map interrupt\n"); 256 goto fail_1; 257 } 258 intrstr = pci_intr_string(pc, ih); 259 sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, dc_intr, sc, 260 self->dv_xname); 261 if (sc->sc_ih == NULL) { 262 printf(": couldn't establish interrupt"); 263 if (intrstr != NULL) 264 printf(" at %s", intrstr); 265 printf("\n"); 266 goto fail_1; 267 } 268 printf(": %s,", intrstr); 269 270 /* Need this info to decide on a chip type. */ 271 sc->dc_revision = revision = PCI_REVISION(pa->pa_class); 272 273 /* Get the eeprom width, but PNIC has no eeprom */ 274 if (!(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_LITEON && 275 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_LITEON_PNIC)) 276 dc_eeprom_width(sc); 277 278 switch (PCI_VENDOR(pa->pa_id)) { 279 case PCI_VENDOR_DEC: 280 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_21140 || 281 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_21142) { 282 found = 1; 283 sc->dc_type = DC_TYPE_21143; 284 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 285 sc->dc_flags |= DC_REDUCED_MII_POLL; 286 dc_read_srom(sc, sc->dc_romwidth); 287 } 288 break; 289 case PCI_VENDOR_INTEL: 290 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_21145) { 291 found = 1; 292 sc->dc_type = DC_TYPE_21145; 293 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 294 sc->dc_flags |= DC_REDUCED_MII_POLL; 295 dc_read_srom(sc, sc->dc_romwidth); 296 } 297 case PCI_VENDOR_DAVICOM: 298 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DAVICOM_DM9100 || 299 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DAVICOM_DM9102 || 300 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DAVICOM_DM9009) { 301 found = 1; 302 sc->dc_type = DC_TYPE_DM9102; 303 sc->dc_flags |= DC_TX_COALESCE|DC_TX_INTR_ALWAYS; 304 sc->dc_flags |= DC_REDUCED_MII_POLL|DC_TX_STORENFWD; 305 sc->dc_flags |= DC_TX_ALIGN; 306 sc->dc_pmode = DC_PMODE_MII; 307 308 /* Increase the latency timer value. */ 309 command = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFLT); 310 command &= 0xFFFF00FF; 311 command |= 0x00008000; 312 pci_conf_write(pc, pa->pa_tag, DC_PCI_CFLT, command); 313 } 314 break; 315 case PCI_VENDOR_ADMTEK: 316 case PCI_VENDOR_3COM: 317 case PCI_VENDOR_MICROSOFT: 318 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADMTEK_AL981) { 319 found = 1; 320 sc->dc_type = DC_TYPE_AL981; 321 sc->dc_flags |= DC_TX_USE_TX_INTR; 322 sc->dc_flags |= DC_TX_ADMTEK_WAR; 323 sc->dc_pmode = DC_PMODE_MII; 324 dc_read_srom(sc, sc->dc_romwidth); 325 } 326 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADMTEK_ADM9511 || 327 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADMTEK_ADM9513 || 328 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADMTEK_AN983 || 329 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_3COM_3CSHO100BTX || 330 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MICROSOFT_MN130) { 331 found = 1; 332 sc->dc_type = DC_TYPE_AN983; 333 sc->dc_flags |= DC_TX_USE_TX_INTR; 334 sc->dc_flags |= DC_TX_ADMTEK_WAR; 335 sc->dc_flags |= DC_64BIT_HASH; 336 sc->dc_pmode = DC_PMODE_MII; 337 /* Don't read SROM for - auto-loaded on reset */ 338 } 339 break; 340 case PCI_VENDOR_MACRONIX: 341 case PCI_VENDOR_ACCTON: 342 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ACCTON_EN2242) { 343 found = 1; 344 sc->dc_type = DC_TYPE_AN983; 345 sc->dc_flags |= DC_TX_USE_TX_INTR; 346 sc->dc_flags |= DC_TX_ADMTEK_WAR; 347 sc->dc_flags |= DC_64BIT_HASH; 348 sc->dc_pmode = DC_PMODE_MII; 349 /* Don't read SROM for - auto-loaded on reset */ 350 } 351 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MACRONIX_MX98713) { 352 found = 1; 353 if (revision < DC_REVISION_98713A) { 354 sc->dc_type = DC_TYPE_98713; 355 } 356 if (revision >= DC_REVISION_98713A) { 357 sc->dc_type = DC_TYPE_98713A; 358 sc->dc_flags |= DC_21143_NWAY; 359 } 360 sc->dc_flags |= DC_REDUCED_MII_POLL; 361 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 362 } 363 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MACRONIX_MX98715 || 364 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ACCTON_EN1217) { 365 found = 1; 366 if (revision >= DC_REVISION_98715AEC_C && 367 revision < DC_REVISION_98725) 368 sc->dc_flags |= DC_128BIT_HASH; 369 sc->dc_type = DC_TYPE_987x5; 370 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 371 sc->dc_flags |= DC_REDUCED_MII_POLL|DC_21143_NWAY; 372 } 373 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MACRONIX_MX98727) { 374 found = 1; 375 sc->dc_type = DC_TYPE_987x5; 376 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 377 sc->dc_flags |= DC_REDUCED_MII_POLL|DC_21143_NWAY; 378 } 379 break; 380 case PCI_VENDOR_COMPEX: 381 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_COMPEX_98713) { 382 found = 1; 383 if (revision < DC_REVISION_98713A) { 384 sc->dc_type = DC_TYPE_98713; 385 sc->dc_flags |= DC_REDUCED_MII_POLL; 386 } 387 if (revision >= DC_REVISION_98713A) 388 sc->dc_type = DC_TYPE_98713A; 389 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 390 } 391 break; 392 case PCI_VENDOR_LITEON: 393 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_LITEON_PNICII) { 394 found = 1; 395 sc->dc_type = DC_TYPE_PNICII; 396 sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 397 sc->dc_flags |= DC_REDUCED_MII_POLL|DC_21143_NWAY; 398 sc->dc_flags |= DC_128BIT_HASH; 399 } 400 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_LITEON_PNIC) { 401 found = 1; 402 sc->dc_type = DC_TYPE_PNIC; 403 sc->dc_flags |= DC_TX_STORENFWD|DC_TX_INTR_ALWAYS; 404 sc->dc_flags |= DC_PNIC_RX_BUG_WAR; 405 sc->dc_pnic_rx_buf = malloc(ETHER_MAX_DIX_LEN * 5, M_DEVBUF, 406 M_NOWAIT); 407 if (sc->dc_pnic_rx_buf == NULL) 408 panic("dc_pci_attach"); 409 if (revision < DC_REVISION_82C169) 410 sc->dc_pmode = DC_PMODE_SYM; 411 } 412 break; 413 case PCI_VENDOR_ASIX: 414 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ASIX_AX88140A) { 415 found = 1; 416 sc->dc_type = DC_TYPE_ASIX; 417 sc->dc_flags |= DC_TX_USE_TX_INTR|DC_TX_INTR_FIRSTFRAG; 418 sc->dc_flags |= DC_REDUCED_MII_POLL; 419 sc->dc_pmode = DC_PMODE_MII; 420 } 421 break; 422 case PCI_VENDOR_CONEXANT: 423 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CONEXANT_RS7112) { 424 found = 1; 425 sc->dc_type = DC_TYPE_CONEXANT; 426 sc->dc_flags |= DC_TX_INTR_ALWAYS; 427 sc->dc_flags |= DC_REDUCED_MII_POLL; 428 sc->dc_pmode = DC_PMODE_MII; 429 dc_read_srom(sc, sc->dc_romwidth); 430 } 431 break; 432 } 433 if (found == 0) { 434 /* This shouldn't happen if probe has done it's job... */ 435 printf(": unknown device: %x:%x\n", 436 PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id)); 437 goto fail_2; 438 } 439 440 /* Save the cache line size. */ 441 if (DC_IS_DAVICOM(sc)) 442 sc->dc_cachesize = 0; 443 else 444 sc->dc_cachesize = pci_conf_read(pc, pa->pa_tag, 445 DC_PCI_CFLT) & 0xFF; 446 447 /* Reset the adapter. */ 448 dc_reset(sc); 449 450 /* Take 21143 out of snooze mode */ 451 if (DC_IS_INTEL(sc)) { 452 command = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFDD); 453 command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); 454 pci_conf_write(pc, pa->pa_tag, DC_PCI_CFDD, command); 455 } 456 457 /* 458 * If we discover later (in dc_attach) that we have an 459 * MII with no PHY, we need to have the 21143 drive the LEDs. 460 * Except there are some systems like the NEC VersaPro NoteBook PC 461 * which have no LEDs, and twiddling these bits has adverse effects 462 * on them. (I.e. you suddenly can't get a link.) 463 * 464 * If mii_attach() returns an error, we leave the DC_TULIP_LEDS 465 * bit set, else we clear it. Since our dc(4) driver is split into 466 * bus-dependent and bus-independent parts, we must do set this bit 467 * here while we are able to do PCI configuration reads. 468 */ 469 if (DC_IS_INTEL(sc)) { 470 if (pci_conf_read(pc, pa->pa_tag, DC_PCI_CSID) != 0x80281033) 471 sc->dc_flags |= DC_TULIP_LEDS; 472 } 473 474 /* 475 * Try to learn something about the supported media. 476 * We know that ASIX and ADMtek and Davicom devices 477 * will *always* be using MII media, so that's a no-brainer. 478 * The tricky ones are the Macronix/PNIC II and the 479 * Intel 21143. 480 */ 481 if (DC_IS_INTEL(sc)) 482 dc_parse_21143_srom(sc); 483 else if (DC_IS_MACRONIX(sc) || DC_IS_PNICII(sc)) { 484 if (sc->dc_type == DC_TYPE_98713) 485 sc->dc_pmode = DC_PMODE_MII; 486 else 487 sc->dc_pmode = DC_PMODE_SYM; 488 } else if (!sc->dc_pmode) 489 sc->dc_pmode = DC_PMODE_MII; 490 491 #ifdef __sparc64__ 492 { 493 extern void myetheraddr(u_char *); 494 495 if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address", 496 sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN) <= 0) 497 myetheraddr(sc->sc_arpcom.ac_enaddr); 498 if (sc->sc_arpcom.ac_enaddr[0] == 0x00 && 499 sc->sc_arpcom.ac_enaddr[1] == 0x03 && 500 sc->sc_arpcom.ac_enaddr[2] == 0xcc) 501 sc->dc_flags |= DC_MOMENCO_BOTCH; 502 sc->sc_hasmac = 1; 503 } 504 #endif 505 506 #ifdef SRM_MEDIA 507 sc->dc_srm_media = 0; 508 509 /* Remember the SRM console media setting */ 510 if (DC_IS_INTEL(sc)) { 511 command = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFDD); 512 command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); 513 switch ((command >> 8) & 0xff) { 514 case 3: 515 sc->dc_srm_media = IFM_10_T; 516 break; 517 case 4: 518 sc->dc_srm_media = IFM_10_T | IFM_FDX; 519 break; 520 case 5: 521 sc->dc_srm_media = IFM_100_TX; 522 break; 523 case 6: 524 sc->dc_srm_media = IFM_100_TX | IFM_FDX; 525 break; 526 } 527 if (sc->dc_srm_media) 528 sc->dc_srm_media |= IFM_ACTIVE | IFM_ETHER; 529 } 530 #endif 531 dc_attach(sc); 532 533 return; 534 535 fail_2: 536 pci_intr_disestablish(pc, sc->sc_ih); 537 538 fail_1: 539 bus_space_unmap(sc->dc_btag, sc->dc_bhandle, size); 540 } 541 542 struct cfattach dc_pci_ca = { 543 sizeof(struct dc_softc), dc_pci_match, dc_pci_attach 544 }; 545