Lines Matching refs:sc

346 ex_alloc_ring(elxl_t *sc, int count, ex_ring_t *r, uint_t dir)  in ex_alloc_ring()  argument
348 dev_info_t *dip = sc->ex_dip; in ex_alloc_ring()
361 elxl_error(sc, "unable to allocate descriptor dma handle"); in ex_alloc_ring()
369 elxl_error(sc, "unable to allocate descriptor memory"); in ex_alloc_ring()
378 elxl_error(sc, "unable to map descriptor memory"); in ex_alloc_ring()
398 elxl_error(sc, "can't allocate buf dma handle"); in ex_alloc_ring()
405 elxl_error(sc, "unable to allocate buf memory"); in ex_alloc_ring()
414 elxl_error(sc, "unable to map buf memory"); in ex_alloc_ring()
426 elxl_add_intr(elxl_t *sc) in elxl_add_intr() argument
434 dip = sc->ex_dip; in elxl_add_intr()
436 rv = ddi_intr_alloc(dip, &sc->ex_intrh, DDI_INTR_TYPE_FIXED, in elxl_add_intr()
439 elxl_error(sc, "Unable to allocate interrupt, %d, count %d", in elxl_add_intr()
444 if (ddi_intr_get_pri(sc->ex_intrh, &ipri) != DDI_SUCCESS) { in elxl_add_intr()
445 elxl_error(sc, "Unable to get interrupt priority"); in elxl_add_intr()
449 if (ddi_intr_add_handler(sc->ex_intrh, elxl_intr, sc, NULL) != in elxl_add_intr()
451 elxl_error(sc, "Can't add interrupt handler"); in elxl_add_intr()
452 (void) ddi_intr_free(sc->ex_intrh); in elxl_add_intr()
453 sc->ex_intrh = NULL; in elxl_add_intr()
456 mutex_init(&sc->ex_intrlock, NULL, MUTEX_DRIVER, DDI_INTR_PRI(ipri)); in elxl_add_intr()
457 mutex_init(&sc->ex_txlock, NULL, MUTEX_DRIVER, DDI_INTR_PRI(ipri)); in elxl_add_intr()
465 elxl_t *sc; in elxl_attach() local
472 sc = kmem_zalloc(sizeof (*sc), KM_SLEEP); in elxl_attach()
473 ddi_set_driver_private(dip, sc); in elxl_attach()
474 sc->ex_dip = dip; in elxl_attach()
476 if (pci_config_setup(dip, &sc->ex_pcih) != DDI_SUCCESS) { in elxl_attach()
477 elxl_error(sc, "unable to setup PCI config handle"); in elxl_attach()
480 venid = pci_config_get16(sc->ex_pcih, PCI_CONF_VENID); in elxl_attach()
481 devid = pci_config_get16(sc->ex_pcih, PCI_CONF_DEVID); in elxl_attach()
485 elxl_error(sc, "Unsupported vendor id (0x%x)", venid); in elxl_attach()
494 sc->ex_conf = ex_products[i].epp_flags; in elxl_attach()
500 elxl_error(sc, "Unsupported device id (0x%x)", devid); in elxl_attach()
501 elxl_error(sc, "Driver may or may not function."); in elxl_attach()
504 pci_config_put16(sc->ex_pcih, PCI_CONF_COMM, in elxl_attach()
505 pci_config_get16(sc->ex_pcih, PCI_CONF_COMM) | in elxl_attach()
508 if (ddi_regs_map_setup(dip, 1, &sc->ex_regsva, 0, 0, &ex_dev_acc_attr, in elxl_attach()
509 &sc->ex_regsh) != DDI_SUCCESS) { in elxl_attach()
510 elxl_error(sc, "Unable to map device registers"); in elxl_attach()
514 if (!elxl_add_intr(sc)) { in elxl_attach()
518 elxl_reset(sc); in elxl_attach()
520 val = elxl_read_eeprom(sc, EE_OEM_ADDR_0); in elxl_attach()
521 sc->ex_factaddr[0] = val >> 8; in elxl_attach()
522 sc->ex_factaddr[1] = val & 0xff; in elxl_attach()
523 val = elxl_read_eeprom(sc, EE_OEM_ADDR_1); in elxl_attach()
524 sc->ex_factaddr[2] = val >> 8; in elxl_attach()
525 sc->ex_factaddr[3] = val & 0xff; in elxl_attach()
526 val = elxl_read_eeprom(sc, EE_OEM_ADDR_2); in elxl_attach()
527 sc->ex_factaddr[4] = val >> 8; in elxl_attach()
528 sc->ex_factaddr[5] = val & 0xff; in elxl_attach()
529 bcopy(sc->ex_factaddr, sc->ex_curraddr, 6); in elxl_attach()
531 sc->ex_capab = elxl_read_eeprom(sc, EE_CAPABILITIES); in elxl_attach()
538 if ((sc->ex_capab & (1 << 2)) || !(sc->ex_capab & (1 << 9))) { in elxl_attach()
539 sc->ex_conf &= ~CONF_90XB; in elxl_attach()
541 sc->ex_conf |= CONF_90XB; in elxl_attach()
544 if (!ex_alloc_ring(sc, EX_NRX, &sc->ex_rxring, DDI_DMA_READ)) { in elxl_attach()
548 if (!ex_alloc_ring(sc, EX_NTX, &sc->ex_txring, DDI_DMA_WRITE)) { in elxl_attach()
552 elxl_probe_media(sc); in elxl_attach()
557 if (sc->ex_mediaopt & (MEDIAOPT_MII | MEDIAOPT_100TX)) { in elxl_attach()
558 sc->ex_miih = mii_alloc(sc, sc->ex_dip, &ex_mii_ops); in elxl_attach()
559 if (sc->ex_miih == NULL) { in elxl_attach()
569 mii_set_pauseable(sc->ex_miih, B_FALSE, B_FALSE); in elxl_attach()
572 elxl_error(sc, "MAC register allocation failed"); in elxl_attach()
576 macp->m_driver = sc; in elxl_attach()
578 macp->m_src_addr = sc->ex_curraddr; in elxl_attach()
585 (void) ddi_intr_enable(sc->ex_intrh); in elxl_attach()
587 if (mac_register(macp, &sc->ex_mach) == DDI_SUCCESS) { in elxl_attach()
593 if (sc->ex_mediaopt & in elxl_attach()
597 sc->ex_linkcheck = in elxl_attach()
598 ddi_periodic_add(elxl_linkcheck, sc, 10000000, 0); in elxl_attach()
608 elxl_detach(sc); in elxl_attach()
616 elxl_probe_media(elxl_t *sc) in elxl_probe_media() argument
637 if (sc->ex_conf & CONF_90XB) { in elxl_probe_media()
665 sc->ex_conf |= CONF_INTPHY; in elxl_probe_media()
680 sc->ex_mediaopt = media_options; in elxl_probe_media()
688 APPEND_MEDIA(sc->ex_medias, (MEDIAOPT_MII|MEDIAOPT_100TX), "mii"); in elxl_probe_media()
689 APPEND_MEDIA(sc->ex_medias, MEDIAOPT_10T, "tp-hdx,tp-fdx"); in elxl_probe_media()
690 APPEND_MEDIA(sc->ex_medias, MEDIAOPT_100FX, "fx-hdx,fx-fdx"); in elxl_probe_media()
691 APPEND_MEDIA(sc->ex_medias, MEDIAOPT_BNC, "bnc"); in elxl_probe_media()
692 APPEND_MEDIA(sc->ex_medias, MEDIAOPT_AUI, "aui"); in elxl_probe_media()
693 APPEND_MEDIA(sc->ex_medias, MEDIAOPT_10FL, "fl-hdx,fl-fdx"); in elxl_probe_media()
705 elxl_error(sc, in elxl_probe_media()
711 sc->ex_xcvr = default_media; in elxl_probe_media()
718 sc->ex_xcvr = default_media; in elxl_probe_media()
722 sc->ex_xcvr = exm->exm_xcvr; in elxl_probe_media()
732 elxl_setup_tx(elxl_t *sc) in elxl_setup_tx() argument
738 if (sc->ex_conf & CONF_90XB) in elxl_setup_tx()
754 elxl_init(elxl_t *sc) in elxl_init() argument
756 if (sc->ex_suspended) in elxl_init()
759 WAIT_CMD(sc); in elxl_init()
760 elxl_stop(sc); in elxl_init()
763 WAIT_CMD(sc); in elxl_init()
765 WAIT_CMD(sc); in elxl_init()
768 elxl_setup_tx(sc); in elxl_init()
777 elxl_set_media(sc); in elxl_init()
778 elxl_set_rxfilter(sc); in elxl_init()
782 if (sc->ex_conf & CONF_90XB) { in elxl_init()
793 PUT32(REG_UPLISTPTR, sc->ex_rxring.r_paddr); in elxl_init()
812 elxl_set_rxfilter(elxl_t *sc) in elxl_set_rxfilter() argument
816 if (sc->ex_suspended) in elxl_set_rxfilter()
825 PUT8(W2_STATION_ADDRESS + i, sc->ex_curraddr[i]); in elxl_set_rxfilter()
829 if (sc->ex_mccount) { in elxl_set_rxfilter()
832 if (sc->ex_promisc) { in elxl_set_rxfilter()
839 elxl_set_media(elxl_t *sc) in elxl_set_media() argument
851 switch (sc->ex_xcvr) { in elxl_set_media()
853 sc->ex_mii_active = B_FALSE; in elxl_set_media()
860 sc->ex_mii_active = B_FALSE; in elxl_set_media()
866 sc->ex_mii_active = B_FALSE; /* Is this really true? */ in elxl_set_media()
872 sc->ex_mii_active = B_FALSE; in elxl_set_media()
886 if (sc->ex_miih) { in elxl_set_media()
887 sc->ex_mii_active = B_TRUE; in elxl_set_media()
889 sc->ex_mii_active = B_FALSE; in elxl_set_media()
894 sc->ex_mii_active = B_FALSE; in elxl_set_media()
895 elxl_error(sc, "Impossible media setting!"); in elxl_set_media()
903 configreg |= (sc->ex_xcvr); in elxl_set_media()
912 if (!sc->ex_mii_active) { in elxl_set_media()
915 if (sc->ex_fdx) { in elxl_set_media()
931 elxl_t *sc = arg; in elxl_linkcheck() local
935 mutex_enter(&sc->ex_txlock); in elxl_linkcheck()
936 if (sc->ex_mii_active) { in elxl_linkcheck()
937 mutex_exit(&sc->ex_txlock); in elxl_linkcheck()
940 if (sc->ex_running && !sc->ex_suspended) { in elxl_linkcheck()
941 switch (sc->ex_xcvr) { in elxl_linkcheck()
947 sc->ex_link = LINK_STATE_UP; in elxl_linkcheck()
948 sc->ex_speed = 100000000; in elxl_linkcheck()
950 sc->ex_link = LINK_STATE_DOWN; in elxl_linkcheck()
951 sc->ex_speed = 0; in elxl_linkcheck()
960 sc->ex_link = LINK_STATE_UP; in elxl_linkcheck()
961 sc->ex_speed = 10000000; in elxl_linkcheck()
963 sc->ex_link = LINK_STATE_DOWN; in elxl_linkcheck()
964 sc->ex_speed = 0; in elxl_linkcheck()
979 sc->ex_speed = 10000000; in elxl_linkcheck()
980 sc->ex_link = LINK_STATE_UP; in elxl_linkcheck()
984 sc->ex_duplex = GET16(W3_MAC_CONTROL) & MAC_CONTROL_FDX ? in elxl_linkcheck()
987 sc->ex_speed = 0; in elxl_linkcheck()
988 sc->ex_duplex = LINK_DUPLEX_UNKNOWN; in elxl_linkcheck()
989 sc->ex_link = LINK_STATE_UNKNOWN; in elxl_linkcheck()
991 link = sc->ex_link; in elxl_linkcheck()
992 mutex_exit(&sc->ex_txlock); in elxl_linkcheck()
994 mac_link_update(sc->ex_mach, link); in elxl_linkcheck()
1000 elxl_t *sc = arg; in elxl_m_promisc() local
1002 mutex_enter(&sc->ex_intrlock); in elxl_m_promisc()
1003 mutex_enter(&sc->ex_txlock); in elxl_m_promisc()
1004 sc->ex_promisc = on; in elxl_m_promisc()
1005 elxl_set_rxfilter(sc); in elxl_m_promisc()
1006 mutex_exit(&sc->ex_txlock); in elxl_m_promisc()
1007 mutex_exit(&sc->ex_intrlock); in elxl_m_promisc()
1014 elxl_t *sc = arg; in elxl_m_multicst() local
1018 mutex_enter(&sc->ex_intrlock); in elxl_m_multicst()
1019 mutex_enter(&sc->ex_txlock); in elxl_m_multicst()
1021 sc->ex_mccount++; in elxl_m_multicst()
1022 if (sc->ex_mccount == 1) { in elxl_m_multicst()
1023 elxl_set_rxfilter(sc); in elxl_m_multicst()
1026 sc->ex_mccount--; in elxl_m_multicst()
1027 if (sc->ex_mccount == 0) { in elxl_m_multicst()
1028 elxl_set_rxfilter(sc); in elxl_m_multicst()
1031 mutex_exit(&sc->ex_txlock); in elxl_m_multicst()
1032 mutex_exit(&sc->ex_intrlock); in elxl_m_multicst()
1039 elxl_t *sc = arg; in elxl_m_unicst() local
1041 mutex_enter(&sc->ex_intrlock); in elxl_m_unicst()
1042 mutex_enter(&sc->ex_txlock); in elxl_m_unicst()
1043 bcopy(addr, sc->ex_curraddr, ETHERADDRL); in elxl_m_unicst()
1044 elxl_set_rxfilter(sc); in elxl_m_unicst()
1045 mutex_exit(&sc->ex_txlock); in elxl_m_unicst()
1046 mutex_exit(&sc->ex_intrlock); in elxl_m_unicst()
1054 elxl_t *sc = arg; in elxl_m_tx() local
1067 r = &sc->ex_txring; in elxl_m_tx()
1068 mutex_enter(&sc->ex_txlock); in elxl_m_tx()
1069 if (sc->ex_suspended) { in elxl_m_tx()
1071 sc->ex_nocarrier++; in elxl_m_tx()
1076 mutex_exit(&sc->ex_txlock); in elxl_m_tx()
1087 sc->ex_excoll++; in elxl_m_tx()
1092 sc->ex_jabber++; in elxl_m_tx()
1095 sc->ex_txerr++; in elxl_m_tx()
1098 sc->ex_uflo++; in elxl_m_tx()
1107 WAIT_CMD(sc); in elxl_m_tx()
1109 WAIT_CMD(sc); in elxl_m_tx()
1110 elxl_setup_tx(sc); in elxl_m_tx()
1140 WAIT_CMD(sc); in elxl_m_tx()
1158 sc->ex_txerr++; in elxl_m_tx()
1165 if ((sc->ex_conf & CONF_90XB) != 0) { in elxl_m_tx()
1182 sc->ex_opackets++; in elxl_m_tx()
1183 sc->ex_obytes += len; in elxl_m_tx()
1186 sc->ex_multixmt++; in elxl_m_tx()
1188 sc->ex_brdcstxmt++; in elxl_m_tx()
1253 if (sc->ex_txring.r_head) { in elxl_m_tx()
1254 PUT32(REG_DNLISTPTR, sc->ex_txring.r_head->ed_descaddr); in elxl_m_tx()
1258 mutex_exit(&sc->ex_txlock); in elxl_m_tx()
1264 elxl_recv(elxl_t *sc, ex_desc_t *rxd, uint32_t stat) in elxl_recv() argument
1272 sc->ex_runt++; in elxl_recv()
1275 sc->ex_oflo++; in elxl_recv()
1278 sc->ex_fcs++; in elxl_recv()
1281 sc->ex_align++; in elxl_recv()
1284 sc->ex_toolong++; in elxl_recv()
1289 sc->ex_runt++; in elxl_recv()
1294 sc->ex_toolong++; in elxl_recv()
1298 sc->ex_allocbfail++; in elxl_recv()
1307 sc->ex_ipackets++; in elxl_recv()
1308 sc->ex_ibytes += len; in elxl_recv()
1311 sc->ex_multircv++; in elxl_recv()
1313 sc->ex_brdcstrcv++; in elxl_recv()
1320 if (((sc->ex_conf & CONF_90XB) != 0) && in elxl_recv()
1339 elxl_t *sc = arg; in elxl_m_start() local
1341 mutex_enter(&sc->ex_intrlock); in elxl_m_start()
1342 mutex_enter(&sc->ex_txlock); in elxl_m_start()
1344 elxl_init(sc); in elxl_m_start()
1345 sc->ex_running = B_TRUE; in elxl_m_start()
1347 mutex_exit(&sc->ex_txlock); in elxl_m_start()
1348 mutex_exit(&sc->ex_intrlock); in elxl_m_start()
1350 if (sc->ex_miih) { in elxl_m_start()
1351 mii_start(sc->ex_miih); in elxl_m_start()
1359 elxl_t *sc = arg; in elxl_m_stop() local
1361 if (sc->ex_miih) { in elxl_m_stop()
1362 mii_stop(sc->ex_miih); in elxl_m_stop()
1365 mutex_enter(&sc->ex_intrlock); in elxl_m_stop()
1366 mutex_enter(&sc->ex_txlock); in elxl_m_stop()
1368 elxl_stop(sc); in elxl_m_stop()
1369 sc->ex_running = B_FALSE; in elxl_m_stop()
1371 mutex_exit(&sc->ex_txlock); in elxl_m_stop()
1372 mutex_exit(&sc->ex_intrlock); in elxl_m_stop()
1378 elxl_t *sc = arg; in elxl_m_getcapab() local
1382 if (sc->ex_conf & CONF_90XB) { in elxl_m_getcapab()
1397 elxl_t *sc = arg; in elxl_m_getprop() local
1400 if (sc->ex_mii_active) { in elxl_m_getprop()
1401 rv = mii_m_getprop(sc->ex_miih, name, num, sz, val); in elxl_m_getprop()
1408 *(uint8_t *)val = sc->ex_duplex; in elxl_m_getprop()
1411 *(uint8_t *)val = sc->ex_speed; in elxl_m_getprop()
1414 bcopy(&sc->ex_link, val, sizeof (link_state_t)); in elxl_m_getprop()
1421 switch (sc->ex_xcvr) { in elxl_m_getprop()
1427 str = sc->ex_fdx ? "tp-fdx" : "tp-hdx"; in elxl_m_getprop()
1433 if (sc->ex_mediaopt & MEDIAOPT_10FL) { in elxl_m_getprop()
1434 str = sc->ex_fdx ? "fl-fdx" : "fl-hdx"; in elxl_m_getprop()
1440 str = sc->ex_fdx ? "fx-fdx" : "fx-hdx"; in elxl_m_getprop()
1457 (void) snprintf(val, sz, "%s", sc->ex_medias); in elxl_m_getprop()
1469 elxl_t *sc = arg; in elxl_m_setprop() local
1472 if (sc->ex_mii_active) { in elxl_m_setprop()
1473 rv = mii_m_setprop(sc->ex_miih, name, num, sz, val); in elxl_m_setprop()
1482 uint32_t mopt = sc->ex_mediaopt; in elxl_m_setprop()
1486 sc->ex_xcvr = XCVR_SEL_AUTO; in elxl_m_setprop()
1488 sc->ex_xcvr = XCVR_SEL_MII; in elxl_m_setprop()
1495 sc->ex_xcvr = XCVR_SEL_10T; in elxl_m_setprop()
1496 sc->ex_fdx = B_TRUE; in elxl_m_setprop()
1503 sc->ex_xcvr = XCVR_SEL_10T; in elxl_m_setprop()
1504 sc->ex_fdx = B_FALSE; in elxl_m_setprop()
1510 sc->ex_xcvr = XCVR_SEL_100FX; in elxl_m_setprop()
1511 sc->ex_fdx = B_TRUE; in elxl_m_setprop()
1517 sc->ex_xcvr = XCVR_SEL_100FX; in elxl_m_setprop()
1518 sc->ex_fdx = B_FALSE; in elxl_m_setprop()
1524 sc->ex_xcvr = XCVR_SEL_BNC; in elxl_m_setprop()
1525 sc->ex_fdx = B_FALSE; in elxl_m_setprop()
1531 sc->ex_xcvr = XCVR_SEL_AUI; in elxl_m_setprop()
1532 sc->ex_fdx = B_FALSE; in elxl_m_setprop()
1538 sc->ex_xcvr = XCVR_SEL_AUI; in elxl_m_setprop()
1539 sc->ex_fdx = B_TRUE; in elxl_m_setprop()
1545 sc->ex_xcvr = XCVR_SEL_AUI; in elxl_m_setprop()
1546 sc->ex_fdx = B_FALSE; in elxl_m_setprop()
1564 mutex_enter(&sc->ex_intrlock); in elxl_m_setprop()
1565 mutex_enter(&sc->ex_txlock); in elxl_m_setprop()
1566 if (!sc->ex_suspended) { in elxl_m_setprop()
1567 elxl_reset(sc); in elxl_m_setprop()
1568 if (sc->ex_running) { in elxl_m_setprop()
1569 elxl_init(sc); in elxl_m_setprop()
1572 mutex_exit(&sc->ex_txlock); in elxl_m_setprop()
1573 mutex_exit(&sc->ex_intrlock); in elxl_m_setprop()
1581 elxl_t *sc = arg; in elxl_m_propinfo() local
1583 if (sc->ex_mii_active) in elxl_m_propinfo()
1584 mii_m_propinfo(sc->ex_miih, name, num, prh); in elxl_m_propinfo()
1603 elxl_t *sc = arg; in elxl_m_stat() local
1606 elxl_getstats(sc); in elxl_m_stat()
1609 if ((sc->ex_mii_active) && in elxl_m_stat()
1610 (mii_m_getstat(sc->ex_miih, stat, val) == 0)) { in elxl_m_stat()
1616 *val = sc->ex_speed; in elxl_m_stat()
1620 *val = sc->ex_duplex; in elxl_m_stat()
1624 *val = sc->ex_multircv; in elxl_m_stat()
1628 *val = sc->ex_brdcstrcv; in elxl_m_stat()
1632 *val = sc->ex_multixmt; in elxl_m_stat()
1636 *val = sc->ex_brdcstxmt; in elxl_m_stat()
1640 *val = sc->ex_ipackets; in elxl_m_stat()
1644 *val = sc->ex_opackets; in elxl_m_stat()
1648 *val = sc->ex_ibytes; in elxl_m_stat()
1651 *val = sc->ex_obytes; in elxl_m_stat()
1656 *val = sc->ex_singlecol + sc->ex_multcol; in elxl_m_stat()
1660 *val = sc->ex_multcol; in elxl_m_stat()
1664 *val = sc->ex_latecol; in elxl_m_stat()
1668 *val = sc->ex_align; in elxl_m_stat()
1672 *val = sc->ex_fcs; in elxl_m_stat()
1676 *val = sc->ex_sqe; in elxl_m_stat()
1680 *val = sc->ex_defer; in elxl_m_stat()
1684 *val = sc->ex_nocarrier; in elxl_m_stat()
1688 *val = sc->ex_toolong; in elxl_m_stat()
1692 *val = sc->ex_excoll; in elxl_m_stat()
1696 *val = sc->ex_oflo; in elxl_m_stat()
1700 *val = sc->ex_uflo; in elxl_m_stat()
1704 *val = sc->ex_runt; in elxl_m_stat()
1708 *val = sc->ex_jabber; in elxl_m_stat()
1712 *val = sc->ex_allocbfail; in elxl_m_stat()
1716 *val = sc->ex_jabber + sc->ex_latecol + sc->ex_uflo; in elxl_m_stat()
1720 *val = sc->ex_align + sc->ex_fcs + sc->ex_runt + in elxl_m_stat()
1721 sc->ex_toolong + sc->ex_oflo + sc->ex_allocbfail; in elxl_m_stat()
1733 elxl_t *sc = (void *)arg; in elxl_intr() local
1740 mutex_enter(&sc->ex_intrlock); in elxl_intr()
1741 if (sc->ex_suspended) { in elxl_intr()
1742 mutex_exit(&sc->ex_intrlock); in elxl_intr()
1749 mutex_exit(&sc->ex_intrlock); in elxl_intr()
1760 elxl_error(sc, "Adapter failure (%x)", stat); in elxl_intr()
1761 mutex_enter(&sc->ex_txlock); in elxl_intr()
1762 elxl_reset(sc); in elxl_intr()
1763 if (sc->ex_running) in elxl_intr()
1764 elxl_init(sc); in elxl_intr()
1765 mutex_exit(&sc->ex_txlock); in elxl_intr()
1766 mutex_exit(&sc->ex_intrlock); in elxl_intr()
1776 r = &sc->ex_rxring; in elxl_intr()
1794 if ((mp = elxl_recv(sc, rxd, pktstat)) != NULL) { in elxl_intr()
1816 mutex_enter(&sc->ex_txlock); in elxl_intr()
1817 if (sc->ex_running) in elxl_intr()
1818 elxl_init(sc); in elxl_intr()
1819 mutex_exit(&sc->ex_txlock); in elxl_intr()
1824 mutex_exit(&sc->ex_intrlock); in elxl_intr()
1827 mac_rx(sc->ex_mach, NULL, mphead); in elxl_intr()
1830 elxl_getstats(sc); in elxl_intr()
1833 mac_tx_update(sc->ex_mach); in elxl_intr()
1840 elxl_getstats(elxl_t *sc) in elxl_getstats() argument
1842 mutex_enter(&sc->ex_txlock); in elxl_getstats()
1843 if (sc->ex_suspended) { in elxl_getstats()
1844 mutex_exit(&sc->ex_txlock); in elxl_getstats()
1860 sc->ex_defer += GET8(W6_DEFER); in elxl_getstats()
1861 sc->ex_latecol += GET8(W6_TX_LATE_COL); in elxl_getstats()
1862 sc->ex_singlecol += GET8(W6_SINGLE_COL); in elxl_getstats()
1863 sc->ex_multcol += GET8(W6_MULT_COL); in elxl_getstats()
1864 sc->ex_sqe += GET8(W6_SQE_ERRORS); in elxl_getstats()
1865 sc->ex_nocarrier += GET8(W6_NO_CARRIER); in elxl_getstats()
1871 mutex_exit(&sc->ex_txlock); in elxl_getstats()
1875 elxl_reset(elxl_t *sc) in elxl_reset() argument
1886 WAIT_CMD(sc); in elxl_reset()
1890 elxl_stop(elxl_t *sc) in elxl_stop() argument
1892 ASSERT(mutex_owned(&sc->ex_intrlock)); in elxl_stop()
1893 ASSERT(mutex_owned(&sc->ex_txlock)); in elxl_stop()
1895 if (sc->ex_suspended) in elxl_stop()
1902 elxl_reset_ring(&sc->ex_rxring, DDI_DMA_READ); in elxl_stop()
1903 elxl_reset_ring(&sc->ex_txring, DDI_DMA_WRITE); in elxl_stop()
1911 elxl_suspend(elxl_t *sc) in elxl_suspend() argument
1913 if (sc->ex_miih) { in elxl_suspend()
1914 mii_suspend(sc->ex_miih); in elxl_suspend()
1917 mutex_enter(&sc->ex_intrlock); in elxl_suspend()
1918 mutex_enter(&sc->ex_txlock); in elxl_suspend()
1919 elxl_stop(sc); in elxl_suspend()
1920 sc->ex_suspended = B_TRUE; in elxl_suspend()
1921 mutex_exit(&sc->ex_txlock); in elxl_suspend()
1922 mutex_exit(&sc->ex_intrlock); in elxl_suspend()
1928 elxl_t *sc; in elxl_resume() local
1931 sc = ddi_get_driver_private(dip); in elxl_resume()
1932 ASSERT(sc); in elxl_resume()
1934 mutex_enter(&sc->ex_intrlock); in elxl_resume()
1935 mutex_enter(&sc->ex_txlock); in elxl_resume()
1936 sc->ex_suspended = B_FALSE; in elxl_resume()
1937 elxl_reset(sc); in elxl_resume()
1938 if (sc->ex_running) in elxl_resume()
1939 elxl_init(sc); in elxl_resume()
1940 mutex_exit(&sc->ex_txlock); in elxl_resume()
1941 mutex_exit(&sc->ex_intrlock); in elxl_resume()
1943 if (sc->ex_miih) { in elxl_resume()
1944 mii_resume(sc->ex_miih); in elxl_resume()
1949 elxl_detach(elxl_t *sc) in elxl_detach() argument
1951 if (sc->ex_miih) { in elxl_detach()
1953 mii_free(sc->ex_miih); in elxl_detach()
1955 if (sc->ex_linkcheck) { in elxl_detach()
1956 ddi_periodic_delete(sc->ex_linkcheck); in elxl_detach()
1959 if (sc->ex_intrh != NULL) { in elxl_detach()
1960 (void) ddi_intr_disable(sc->ex_intrh); in elxl_detach()
1961 (void) ddi_intr_remove_handler(sc->ex_intrh); in elxl_detach()
1962 (void) ddi_intr_free(sc->ex_intrh); in elxl_detach()
1963 mutex_destroy(&sc->ex_intrlock); in elxl_detach()
1964 mutex_destroy(&sc->ex_txlock); in elxl_detach()
1967 if (sc->ex_pcih) { in elxl_detach()
1968 pci_config_teardown(&sc->ex_pcih); in elxl_detach()
1970 if (sc->ex_regsh) { in elxl_detach()
1971 ddi_regs_map_free(&sc->ex_regsh); in elxl_detach()
1973 ex_free_ring(&sc->ex_txring); in elxl_detach()
1974 ex_free_ring(&sc->ex_rxring); in elxl_detach()
1976 kmem_free(sc, sizeof (*sc)); in elxl_detach()
1984 elxl_read_eeprom(elxl_t *sc, int offset) in elxl_read_eeprom() argument
1989 if (elxl_eeprom_busy(sc)) in elxl_read_eeprom()
1993 if (elxl_eeprom_busy(sc)) in elxl_read_eeprom()
2001 elxl_eeprom_busy(elxl_t *sc) in elxl_eeprom_busy() argument
2010 elxl_error(sc, "Eeprom stays busy."); in elxl_eeprom_busy()
2015 ex_mii_send_bits(struct ex_softc *sc, uint16_t bits, int cnt) in ex_mii_send_bits() argument
2039 ex_mii_sync(struct ex_softc *sc) in ex_mii_sync() argument
2058 elxl_t *sc = arg; in elxl_mii_read() local
2062 if ((sc->ex_conf & CONF_INTPHY) && phy != INTPHY_ID) in elxl_mii_read()
2065 mutex_enter(&sc->ex_txlock); in elxl_mii_read()
2068 ex_mii_sync(sc); in elxl_mii_read()
2070 ex_mii_send_bits(sc, 1, 2); /* start */ in elxl_mii_read()
2071 ex_mii_send_bits(sc, 2, 2); /* read command */ in elxl_mii_read()
2072 ex_mii_send_bits(sc, phy, 5); in elxl_mii_read()
2073 ex_mii_send_bits(sc, reg, 5); in elxl_mii_read()
2102 mutex_exit(&sc->ex_txlock); in elxl_mii_read()
2110 elxl_t *sc = arg; in elxl_mii_write() local
2112 if ((sc->ex_conf & CONF_INTPHY) && phy != INTPHY_ID) in elxl_mii_write()
2115 mutex_enter(&sc->ex_txlock); in elxl_mii_write()
2118 ex_mii_sync(sc); in elxl_mii_write()
2119 ex_mii_send_bits(sc, 1, 2); /* start */ in elxl_mii_write()
2120 ex_mii_send_bits(sc, 1, 2); /* write */ in elxl_mii_write()
2121 ex_mii_send_bits(sc, phy, 5); in elxl_mii_write()
2122 ex_mii_send_bits(sc, reg, 5); in elxl_mii_write()
2123 ex_mii_send_bits(sc, 2, 2); /* ack/turnaround */ in elxl_mii_write()
2124 ex_mii_send_bits(sc, data, 16); in elxl_mii_write()
2130 mutex_exit(&sc->ex_txlock); in elxl_mii_write()
2136 elxl_t *sc = arg; in elxl_mii_notify() local
2140 duplex = mii_get_duplex(sc->ex_miih); in elxl_mii_notify()
2142 mutex_enter(&sc->ex_txlock); in elxl_mii_notify()
2143 if (!sc->ex_mii_active) { in elxl_mii_notify()
2145 mutex_exit(&sc->ex_txlock); in elxl_mii_notify()
2148 if (!sc->ex_suspended) { in elxl_mii_notify()
2157 mutex_exit(&sc->ex_txlock); in elxl_mii_notify()
2159 mac_link_update(sc->ex_mach, link); in elxl_mii_notify()
2181 elxl_t *sc; in elxl_ddi_detach() local
2183 sc = ddi_get_driver_private(dip); in elxl_ddi_detach()
2184 ASSERT(sc); in elxl_ddi_detach()
2188 if (mac_disable(sc->ex_mach) != 0) { in elxl_ddi_detach()
2191 (void) mac_unregister(sc->ex_mach); in elxl_ddi_detach()
2192 elxl_detach(sc); in elxl_ddi_detach()
2196 elxl_suspend(sc); in elxl_ddi_detach()
2207 elxl_t *sc; in elxl_ddi_quiesce() local
2209 sc = ddi_get_driver_private(dip); in elxl_ddi_quiesce()
2210 ASSERT(sc); in elxl_ddi_quiesce()
2212 if (!sc->ex_suspended) in elxl_ddi_quiesce()
2213 elxl_reset(sc); in elxl_ddi_quiesce()
2218 elxl_error(elxl_t *sc, char *fmt, ...) in elxl_error() argument
2228 ddi_driver_name(sc->ex_dip), ddi_get_instance(sc->ex_dip), buf); in elxl_error()