Lines Matching +full:pme +full:- +full:active +full:- +full:high

1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
18 * 4. Neither the name of the author nor the names of any co-contributors
92 { DL_VENDORID, DL_DEVICEID_DL10050, "D-Link DL10050 10/100BaseTX" },
142 * MII bit-bang glue
201 * Read the MII serial port for the MII bit-bang module.
219 * Write the MII serial port for the MII bit-bang module.
259 mii = device_get_softc(sc->ste_miibus); in ste_miibus_statchg()
260 ifp = sc->ste_ifp; in ste_miibus_statchg()
265 sc->ste_flags &= ~STE_FLAG_LINK; in ste_miibus_statchg()
266 if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == in ste_miibus_statchg()
268 switch (IFM_SUBTYPE(mii->mii_media_active)) { in ste_miibus_statchg()
273 sc->ste_flags |= STE_FLAG_LINK; in ste_miibus_statchg()
279 /* Program MACs with resolved speed/duplex/flow-control. */ in ste_miibus_statchg()
280 if ((sc->ste_flags & STE_FLAG_LINK) != 0) { in ste_miibus_statchg()
283 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { in ste_miibus_statchg()
287 * receive flow-control frames but the register has no in ste_miibus_statchg()
291 * layer is not trivial, so don't enable flow-control in ste_miibus_statchg()
310 mii = device_get_softc(sc->ste_miibus); in ste_ifmedia_upd()
311 LIST_FOREACH(miisc, &mii->mii_phys, mii_list) in ste_ifmedia_upd()
326 mii = device_get_softc(sc->ste_miibus); in ste_ifmedia_sts()
334 ifmr->ifm_active = mii->mii_media_active; in ste_ifmedia_sts()
335 ifmr->ifm_status = mii->mii_media_status; in ste_ifmedia_sts()
351 device_printf(sc->ste_dev, "command never completed!\n"); in ste_wait()
373 device_printf(sc->ste_dev, "eeprom failed to come ready\n"); in ste_eeprom_wait()
414 hashes[1] |= (1 << (h - 32)); in ste_hash_maddr()
428 ifp = sc->ste_ifp; in ste_rxfilter()
512 ifp = sc->ste_ifp; in ste_intr()
531 if (sc->ste_int_rx_act > 0) { in ste_intr()
537 ste_rxeof(sc, -1); in ste_intr()
547 * interrupts under high network load. in ste_intr()
550 (sc->ste_int_rx_mod != 0)) { in ste_intr()
553 STE_TIMER_USECS(sc->ste_int_rx_mod)); in ste_intr()
555 sc->ste_int_rx_act = 1; in ste_intr()
558 sc->ste_int_rx_act = 0; in ste_intr()
578 /* Re-enable interrupts */ in ste_intr()
597 ifp = sc->ste_ifp; in ste_rxeof()
599 bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag, in ste_rxeof()
600 sc->ste_cdata.ste_rx_list_map, in ste_rxeof()
603 cur_rx = sc->ste_cdata.ste_rx_head; in ste_rxeof()
605 cur_rx = cur_rx->ste_next) { in ste_rxeof()
606 rxstat = le32toh(cur_rx->ste_ptr->ste_status); in ste_rxeof()
613 count--; in ste_rxeof()
621 * it should simply get re-used next time this descriptor in ste_rxeof()
626 cur_rx->ste_ptr->ste_status = 0; in ste_rxeof()
631 m = cur_rx->ste_mbuf; in ste_rxeof()
643 cur_rx->ste_ptr->ste_status = 0; in ste_rxeof()
647 m->m_pkthdr.rcvif = ifp; in ste_rxeof()
648 m->m_pkthdr.len = m->m_len = total_len; in ste_rxeof()
657 sc->ste_cdata.ste_rx_head = cur_rx; in ste_rxeof()
658 bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag, in ste_rxeof()
659 sc->ste_cdata.ste_rx_list_map, in ste_rxeof()
674 ifp = sc->ste_ifp; in ste_txeoc()
683 * should re-wake the Tx MAC. This is the most severe in ste_txeoc()
695 device_printf(sc->ste_dev, "TX error : 0x%b\n", in ste_txeoc()
699 sc->ste_tx_thresh < STE_PACKET_SIZE) { in ste_txeoc()
700 sc->ste_tx_thresh += STE_MIN_FRAMELEN; in ste_txeoc()
701 if (sc->ste_tx_thresh > STE_PACKET_SIZE) in ste_txeoc()
702 sc->ste_tx_thresh = STE_PACKET_SIZE; in ste_txeoc()
703 device_printf(sc->ste_dev, in ste_txeoc()
706 sc->ste_tx_thresh); in ste_txeoc()
707 /* Make sure to disable active DMA cycles. */ in ste_txeoc()
741 mii = device_get_softc(sc->ste_miibus); in ste_tick()
748 if ((sc->ste_flags & STE_FLAG_LINK) == 0) in ste_tick()
749 ste_miibus_statchg(sc->ste_dev); in ste_tick()
759 callout_reset(&sc->ste_callout, hz, ste_tick, sc); in ste_tick()
772 ifp = sc->ste_ifp; in ste_txeof()
773 idx = sc->ste_cdata.ste_tx_cons; in ste_txeof()
774 if (idx == sc->ste_cdata.ste_tx_prod) in ste_txeof()
777 bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag, in ste_txeof()
778 sc->ste_cdata.ste_tx_list_map, in ste_txeof()
781 while (idx != sc->ste_cdata.ste_tx_prod) { in ste_txeof()
782 cur_tx = &sc->ste_cdata.ste_tx_chain[idx]; in ste_txeof()
783 txstat = le32toh(cur_tx->ste_ptr->ste_ctl); in ste_txeof()
786 bus_dmamap_sync(sc->ste_cdata.ste_tx_tag, cur_tx->ste_map, in ste_txeof()
788 bus_dmamap_unload(sc->ste_cdata.ste_tx_tag, cur_tx->ste_map); in ste_txeof()
789 KASSERT(cur_tx->ste_mbuf != NULL, in ste_txeof()
791 m_freem(cur_tx->ste_mbuf); in ste_txeof()
792 cur_tx->ste_mbuf = NULL; in ste_txeof()
795 sc->ste_cdata.ste_tx_cnt--; in ste_txeof()
799 sc->ste_cdata.ste_tx_cons = idx; in ste_txeof()
800 if (sc->ste_cdata.ste_tx_cnt == 0) in ste_txeof()
801 sc->ste_timer = 0; in ste_txeof()
841 ifp = sc->ste_ifp; in ste_stats_update()
842 stats = &sc->ste_stats; in ste_stats_update()
847 stats->rx_bytes += val; in ste_stats_update()
848 stats->rx_frames += CSR_READ_2(sc, STE_STAT_RX_FRAMES); in ste_stats_update()
849 stats->rx_bcast_frames += CSR_READ_1(sc, STE_STAT_RX_BCAST); in ste_stats_update()
850 stats->rx_mcast_frames += CSR_READ_1(sc, STE_STAT_RX_MCAST); in ste_stats_update()
851 stats->rx_lost_frames += CSR_READ_1(sc, STE_STAT_RX_LOST); in ste_stats_update()
856 stats->tx_bytes += val; in ste_stats_update()
857 stats->tx_frames += CSR_READ_2(sc, STE_STAT_TX_FRAMES); in ste_stats_update()
858 stats->tx_bcast_frames += CSR_READ_1(sc, STE_STAT_TX_BCAST); in ste_stats_update()
859 stats->tx_mcast_frames += CSR_READ_1(sc, STE_STAT_TX_MCAST); in ste_stats_update()
860 stats->tx_carrsense_errs += CSR_READ_1(sc, STE_STAT_CARRIER_ERR); in ste_stats_update()
862 stats->tx_single_colls += val; in ste_stats_update()
865 stats->tx_multi_colls += val; in ste_stats_update()
868 stats->tx_late_colls += val; in ste_stats_update()
870 stats->tx_frames_defered += CSR_READ_1(sc, STE_STAT_TX_DEFER); in ste_stats_update()
871 stats->tx_excess_defers += CSR_READ_1(sc, STE_STAT_TX_EXDEFER); in ste_stats_update()
872 stats->tx_abort += CSR_READ_1(sc, STE_STAT_TX_ABORT); in ste_stats_update()
886 while (t->ste_name != NULL) { in ste_probe()
887 if ((pci_get_vendor(dev) == t->ste_vid) && in ste_probe()
888 (pci_get_device(dev) == t->ste_did)) { in ste_probe()
889 device_set_desc(dev, t->ste_name); in ste_probe()
911 sc->ste_dev = dev; in ste_attach()
915 * Note on the DFE-550 the PHY is at 1 on the DFE-580 in ste_attach()
921 sc->ste_flags |= STE_FLAG_ONE_PHY; in ste_attach()
923 mtx_init(&sc->ste_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, in ste_attach()
939 resource_int_value(device_get_name(sc->ste_dev), in ste_attach()
940 device_get_unit(sc->ste_dev), "prefer_iomap", in ste_attach()
943 sc->ste_res_id = PCIR_BAR(1); in ste_attach()
944 sc->ste_res_type = SYS_RES_MEMORY; in ste_attach()
945 sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, in ste_attach()
946 &sc->ste_res_id, RF_ACTIVE); in ste_attach()
948 if (prefer_iomap || sc->ste_res == NULL) { in ste_attach()
949 sc->ste_res_id = PCIR_BAR(0); in ste_attach()
950 sc->ste_res_type = SYS_RES_IOPORT; in ste_attach()
951 sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, in ste_attach()
952 &sc->ste_res_id, RF_ACTIVE); in ste_attach()
954 if (sc->ste_res == NULL) { in ste_attach()
962 sc->ste_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in ste_attach()
965 if (sc->ste_irq == NULL) { in ste_attach()
971 callout_init_mtx(&sc->ste_callout, &sc->ste_mtx, 0); in ste_attach()
989 ifp = sc->ste_ifp = if_alloc(IFT_ETHER); in ste_attach()
993 if ((sc->ste_flags & STE_FLAG_ONE_PHY) != 0) in ste_attach()
995 error = mii_attach(dev, &sc->ste_miibus, ifp, ste_ifmedia_upd, in ste_attach()
1008 if_setsendqlen(ifp, STE_TX_LIST_CNT - 1); in ste_attach()
1011 sc->ste_tx_thresh = STE_TXSTART_THRESH; in ste_attach()
1031 error = bus_setup_intr(dev, sc->ste_irq, INTR_TYPE_NET | INTR_MPSAFE, in ste_attach()
1032 NULL, ste_intr, sc, &sc->ste_intrhand); in ste_attach()
1061 KASSERT(mtx_initialized(&sc->ste_mtx), ("ste mutex not initialized")); in ste_detach()
1062 ifp = sc->ste_ifp; in ste_detach()
1069 /* These should only be active if attach succeeded */ in ste_detach()
1075 callout_drain(&sc->ste_callout); in ste_detach()
1079 if (sc->ste_intrhand) in ste_detach()
1080 bus_teardown_intr(dev, sc->ste_irq, sc->ste_intrhand); in ste_detach()
1081 if (sc->ste_irq) in ste_detach()
1082 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ste_irq); in ste_detach()
1083 if (sc->ste_res) in ste_detach()
1084 bus_release_resource(dev, sc->ste_res_type, sc->ste_res_id, in ste_detach()
1085 sc->ste_res); in ste_detach()
1091 mtx_destroy(&sc->ste_mtx); in ste_detach()
1111 ctx->ste_busaddr = segs[0].ds_addr; in ste_dmamap_cb()
1124 bus_get_dma_tag(sc->ste_dev), /* parent */ in ste_dma_alloc()
1134 &sc->ste_cdata.ste_parent_tag); in ste_dma_alloc()
1136 device_printf(sc->ste_dev, in ste_dma_alloc()
1143 sc->ste_cdata.ste_parent_tag, /* parent */ in ste_dma_alloc()
1153 &sc->ste_cdata.ste_tx_list_tag); in ste_dma_alloc()
1155 device_printf(sc->ste_dev, in ste_dma_alloc()
1162 sc->ste_cdata.ste_parent_tag, /* parent */ in ste_dma_alloc()
1172 &sc->ste_cdata.ste_rx_list_tag); in ste_dma_alloc()
1174 device_printf(sc->ste_dev, in ste_dma_alloc()
1181 sc->ste_cdata.ste_parent_tag, /* parent */ in ste_dma_alloc()
1191 &sc->ste_cdata.ste_tx_tag); in ste_dma_alloc()
1193 device_printf(sc->ste_dev, "could not create Tx DMA tag.\n"); in ste_dma_alloc()
1199 sc->ste_cdata.ste_parent_tag, /* parent */ in ste_dma_alloc()
1209 &sc->ste_cdata.ste_rx_tag); in ste_dma_alloc()
1211 device_printf(sc->ste_dev, "could not create Rx DMA tag.\n"); in ste_dma_alloc()
1216 error = bus_dmamem_alloc(sc->ste_cdata.ste_tx_list_tag, in ste_dma_alloc()
1217 (void **)&sc->ste_ldata.ste_tx_list, in ste_dma_alloc()
1219 &sc->ste_cdata.ste_tx_list_map); in ste_dma_alloc()
1221 device_printf(sc->ste_dev, in ste_dma_alloc()
1226 error = bus_dmamap_load(sc->ste_cdata.ste_tx_list_tag, in ste_dma_alloc()
1227 sc->ste_cdata.ste_tx_list_map, sc->ste_ldata.ste_tx_list, in ste_dma_alloc()
1230 device_printf(sc->ste_dev, in ste_dma_alloc()
1234 sc->ste_ldata.ste_tx_list_paddr = ctx.ste_busaddr; in ste_dma_alloc()
1237 error = bus_dmamem_alloc(sc->ste_cdata.ste_rx_list_tag, in ste_dma_alloc()
1238 (void **)&sc->ste_ldata.ste_rx_list, in ste_dma_alloc()
1240 &sc->ste_cdata.ste_rx_list_map); in ste_dma_alloc()
1242 device_printf(sc->ste_dev, in ste_dma_alloc()
1247 error = bus_dmamap_load(sc->ste_cdata.ste_rx_list_tag, in ste_dma_alloc()
1248 sc->ste_cdata.ste_rx_list_map, sc->ste_ldata.ste_rx_list, in ste_dma_alloc()
1251 device_printf(sc->ste_dev, in ste_dma_alloc()
1255 sc->ste_ldata.ste_rx_list_paddr = ctx.ste_busaddr; in ste_dma_alloc()
1259 txc = &sc->ste_cdata.ste_tx_chain[i]; in ste_dma_alloc()
1260 txc->ste_ptr = NULL; in ste_dma_alloc()
1261 txc->ste_mbuf = NULL; in ste_dma_alloc()
1262 txc->ste_next = NULL; in ste_dma_alloc()
1263 txc->ste_phys = 0; in ste_dma_alloc()
1264 txc->ste_map = NULL; in ste_dma_alloc()
1265 error = bus_dmamap_create(sc->ste_cdata.ste_tx_tag, 0, in ste_dma_alloc()
1266 &txc->ste_map); in ste_dma_alloc()
1268 device_printf(sc->ste_dev, in ste_dma_alloc()
1274 if ((error = bus_dmamap_create(sc->ste_cdata.ste_rx_tag, 0, in ste_dma_alloc()
1275 &sc->ste_cdata.ste_rx_sparemap)) != 0) { in ste_dma_alloc()
1276 device_printf(sc->ste_dev, in ste_dma_alloc()
1281 rxc = &sc->ste_cdata.ste_rx_chain[i]; in ste_dma_alloc()
1282 rxc->ste_ptr = NULL; in ste_dma_alloc()
1283 rxc->ste_mbuf = NULL; in ste_dma_alloc()
1284 rxc->ste_next = NULL; in ste_dma_alloc()
1285 rxc->ste_map = NULL; in ste_dma_alloc()
1286 error = bus_dmamap_create(sc->ste_cdata.ste_rx_tag, 0, in ste_dma_alloc()
1287 &rxc->ste_map); in ste_dma_alloc()
1289 device_printf(sc->ste_dev, in ste_dma_alloc()
1307 if (sc->ste_cdata.ste_tx_tag != NULL) { in ste_dma_free()
1309 txc = &sc->ste_cdata.ste_tx_chain[i]; in ste_dma_free()
1310 if (txc->ste_map != NULL) { in ste_dma_free()
1311 bus_dmamap_destroy(sc->ste_cdata.ste_tx_tag, in ste_dma_free()
1312 txc->ste_map); in ste_dma_free()
1313 txc->ste_map = NULL; in ste_dma_free()
1316 bus_dma_tag_destroy(sc->ste_cdata.ste_tx_tag); in ste_dma_free()
1317 sc->ste_cdata.ste_tx_tag = NULL; in ste_dma_free()
1320 if (sc->ste_cdata.ste_rx_tag != NULL) { in ste_dma_free()
1322 rxc = &sc->ste_cdata.ste_rx_chain[i]; in ste_dma_free()
1323 if (rxc->ste_map != NULL) { in ste_dma_free()
1324 bus_dmamap_destroy(sc->ste_cdata.ste_rx_tag, in ste_dma_free()
1325 rxc->ste_map); in ste_dma_free()
1326 rxc->ste_map = NULL; in ste_dma_free()
1329 if (sc->ste_cdata.ste_rx_sparemap != NULL) { in ste_dma_free()
1330 bus_dmamap_destroy(sc->ste_cdata.ste_rx_tag, in ste_dma_free()
1331 sc->ste_cdata.ste_rx_sparemap); in ste_dma_free()
1332 sc->ste_cdata.ste_rx_sparemap = NULL; in ste_dma_free()
1334 bus_dma_tag_destroy(sc->ste_cdata.ste_rx_tag); in ste_dma_free()
1335 sc->ste_cdata.ste_rx_tag = NULL; in ste_dma_free()
1338 if (sc->ste_cdata.ste_tx_list_tag != NULL) { in ste_dma_free()
1339 if (sc->ste_ldata.ste_tx_list_paddr != 0) in ste_dma_free()
1340 bus_dmamap_unload(sc->ste_cdata.ste_tx_list_tag, in ste_dma_free()
1341 sc->ste_cdata.ste_tx_list_map); in ste_dma_free()
1342 if (sc->ste_ldata.ste_tx_list != NULL) in ste_dma_free()
1343 bus_dmamem_free(sc->ste_cdata.ste_tx_list_tag, in ste_dma_free()
1344 sc->ste_ldata.ste_tx_list, in ste_dma_free()
1345 sc->ste_cdata.ste_tx_list_map); in ste_dma_free()
1346 sc->ste_ldata.ste_tx_list = NULL; in ste_dma_free()
1347 sc->ste_ldata.ste_tx_list_paddr = 0; in ste_dma_free()
1348 bus_dma_tag_destroy(sc->ste_cdata.ste_tx_list_tag); in ste_dma_free()
1349 sc->ste_cdata.ste_tx_list_tag = NULL; in ste_dma_free()
1352 if (sc->ste_cdata.ste_rx_list_tag != NULL) { in ste_dma_free()
1353 if (sc->ste_ldata.ste_rx_list_paddr != 0) in ste_dma_free()
1354 bus_dmamap_unload(sc->ste_cdata.ste_rx_list_tag, in ste_dma_free()
1355 sc->ste_cdata.ste_rx_list_map); in ste_dma_free()
1356 if (sc->ste_ldata.ste_rx_list != NULL) in ste_dma_free()
1357 bus_dmamem_free(sc->ste_cdata.ste_rx_list_tag, in ste_dma_free()
1358 sc->ste_ldata.ste_rx_list, in ste_dma_free()
1359 sc->ste_cdata.ste_rx_list_map); in ste_dma_free()
1360 sc->ste_ldata.ste_rx_list = NULL; in ste_dma_free()
1361 sc->ste_ldata.ste_rx_list_paddr = 0; in ste_dma_free()
1362 bus_dma_tag_destroy(sc->ste_cdata.ste_rx_list_tag); in ste_dma_free()
1363 sc->ste_cdata.ste_rx_list_tag = NULL; in ste_dma_free()
1365 if (sc->ste_cdata.ste_parent_tag != NULL) { in ste_dma_free()
1366 bus_dma_tag_destroy(sc->ste_cdata.ste_parent_tag); in ste_dma_free()
1367 sc->ste_cdata.ste_parent_tag = NULL; in ste_dma_free()
1382 m->m_len = m->m_pkthdr.len = MCLBYTES; in ste_newbuf()
1385 if ((error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_rx_tag, in ste_newbuf()
1386 sc->ste_cdata.ste_rx_sparemap, m, segs, &nsegs, 0)) != 0) { in ste_newbuf()
1392 if (rxc->ste_mbuf != NULL) { in ste_newbuf()
1393 bus_dmamap_sync(sc->ste_cdata.ste_rx_tag, rxc->ste_map, in ste_newbuf()
1395 bus_dmamap_unload(sc->ste_cdata.ste_rx_tag, rxc->ste_map); in ste_newbuf()
1397 map = rxc->ste_map; in ste_newbuf()
1398 rxc->ste_map = sc->ste_cdata.ste_rx_sparemap; in ste_newbuf()
1399 sc->ste_cdata.ste_rx_sparemap = map; in ste_newbuf()
1400 bus_dmamap_sync(sc->ste_cdata.ste_rx_tag, rxc->ste_map, in ste_newbuf()
1402 rxc->ste_mbuf = m; in ste_newbuf()
1403 rxc->ste_ptr->ste_status = 0; in ste_newbuf()
1404 rxc->ste_ptr->ste_frag.ste_addr = htole32(segs[0].ds_addr); in ste_newbuf()
1405 rxc->ste_ptr->ste_frag.ste_len = htole32(segs[0].ds_len | in ste_newbuf()
1417 sc->ste_int_rx_act = 0; in ste_init_rx_list()
1418 cd = &sc->ste_cdata; in ste_init_rx_list()
1419 ld = &sc->ste_ldata; in ste_init_rx_list()
1420 bzero(ld->ste_rx_list, STE_RX_LIST_SZ); in ste_init_rx_list()
1422 cd->ste_rx_chain[i].ste_ptr = &ld->ste_rx_list[i]; in ste_init_rx_list()
1423 error = ste_newbuf(sc, &cd->ste_rx_chain[i]); in ste_init_rx_list()
1426 if (i == (STE_RX_LIST_CNT - 1)) { in ste_init_rx_list()
1427 cd->ste_rx_chain[i].ste_next = &cd->ste_rx_chain[0]; in ste_init_rx_list()
1428 ld->ste_rx_list[i].ste_next = in ste_init_rx_list()
1429 htole32(ld->ste_rx_list_paddr + in ste_init_rx_list()
1432 cd->ste_rx_chain[i].ste_next = &cd->ste_rx_chain[i + 1]; in ste_init_rx_list()
1433 ld->ste_rx_list[i].ste_next = in ste_init_rx_list()
1434 htole32(ld->ste_rx_list_paddr + in ste_init_rx_list()
1439 cd->ste_rx_head = &cd->ste_rx_chain[0]; in ste_init_rx_list()
1440 bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag, in ste_init_rx_list()
1441 sc->ste_cdata.ste_rx_list_map, in ste_init_rx_list()
1454 cd = &sc->ste_cdata; in ste_init_tx_list()
1455 ld = &sc->ste_ldata; in ste_init_tx_list()
1456 bzero(ld->ste_tx_list, STE_TX_LIST_SZ); in ste_init_tx_list()
1458 cd->ste_tx_chain[i].ste_ptr = &ld->ste_tx_list[i]; in ste_init_tx_list()
1459 cd->ste_tx_chain[i].ste_mbuf = NULL; in ste_init_tx_list()
1460 if (i == (STE_TX_LIST_CNT - 1)) { in ste_init_tx_list()
1461 cd->ste_tx_chain[i].ste_next = &cd->ste_tx_chain[0]; in ste_init_tx_list()
1462 cd->ste_tx_chain[i].ste_phys = htole32(STE_ADDR_LO( in ste_init_tx_list()
1463 ld->ste_tx_list_paddr + in ste_init_tx_list()
1466 cd->ste_tx_chain[i].ste_next = &cd->ste_tx_chain[i + 1]; in ste_init_tx_list()
1467 cd->ste_tx_chain[i].ste_phys = htole32(STE_ADDR_LO( in ste_init_tx_list()
1468 ld->ste_tx_list_paddr + in ste_init_tx_list()
1473 cd->ste_last_tx = NULL; in ste_init_tx_list()
1474 cd->ste_tx_prod = 0; in ste_init_tx_list()
1475 cd->ste_tx_cons = 0; in ste_init_tx_list()
1476 cd->ste_tx_cnt = 0; in ste_init_tx_list()
1478 bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag, in ste_init_tx_list()
1479 sc->ste_cdata.ste_tx_list_map, in ste_init_tx_list()
1503 ifp = sc->ste_ifp; in ste_init_locked()
1504 mii = device_get_softc(sc->ste_miibus); in ste_init_locked()
1516 ((if_getlladdr(sc->ste_ifp)[i] & 0xff) | in ste_init_locked()
1517 if_getlladdr(sc->ste_ifp)[i + 1] << 8)); in ste_init_locked()
1522 device_printf(sc->ste_dev, in ste_init_locked()
1544 CSR_WRITE_2(sc, STE_TX_STARTTHRESH, sc->ste_tx_thresh); in ste_init_locked()
1559 STE_ADDR_LO(sc->ste_ldata.ste_rx_list_paddr)); in ste_init_locked()
1599 sc->ste_flags &= ~STE_FLAG_LINK; in ste_init_locked()
1606 callout_reset(&sc->ste_callout, hz, ste_tick, sc); in ste_init_locked()
1619 ifp = sc->ste_ifp; in ste_stop()
1621 callout_stop(&sc->ste_callout); in ste_stop()
1622 sc->ste_timer = 0; in ste_stop()
1632 /* Disable auto-polling. */ in ste_stop()
1650 device_printf(sc->ste_dev, "Stopping MAC timed out\n"); in ste_stop()
1656 cur_rx = &sc->ste_cdata.ste_rx_chain[i]; in ste_stop()
1657 if (cur_rx->ste_mbuf != NULL) { in ste_stop()
1658 bus_dmamap_sync(sc->ste_cdata.ste_rx_tag, in ste_stop()
1659 cur_rx->ste_map, BUS_DMASYNC_POSTREAD); in ste_stop()
1660 bus_dmamap_unload(sc->ste_cdata.ste_rx_tag, in ste_stop()
1661 cur_rx->ste_map); in ste_stop()
1662 m_freem(cur_rx->ste_mbuf); in ste_stop()
1663 cur_rx->ste_mbuf = NULL; in ste_stop()
1668 cur_tx = &sc->ste_cdata.ste_tx_chain[i]; in ste_stop()
1669 if (cur_tx->ste_mbuf != NULL) { in ste_stop()
1670 bus_dmamap_sync(sc->ste_cdata.ste_tx_tag, in ste_stop()
1671 cur_tx->ste_map, BUS_DMASYNC_POSTWRITE); in ste_stop()
1672 bus_dmamap_unload(sc->ste_cdata.ste_tx_tag, in ste_stop()
1673 cur_tx->ste_map); in ste_stop()
1674 m_freem(cur_tx->ste_mbuf); in ste_stop()
1675 cur_tx->ste_mbuf = NULL; in ste_stop()
1707 device_printf(sc->ste_dev, "global reset never completed\n"); in ste_reset()
1727 device_printf(sc->ste_dev, "starting Tx failed"); in ste_restart_tx()
1746 ((if_getflags(ifp) ^ sc->ste_if_flags) & in ste_ioctl()
1753 sc->ste_if_flags = if_getflags(ifp); in ste_ioctl()
1765 mii = device_get_softc(sc->ste_miibus); in ste_ioctl()
1766 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); in ste_ioctl()
1770 mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); in ste_ioctl()
1815 error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_tx_tag, in ste_encap()
1816 txc->ste_map, *m_head, txsegs, &nsegs, 0); in ste_encap()
1825 error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_tx_tag, in ste_encap()
1826 txc->ste_map, *m_head, txsegs, &nsegs, 0); in ste_encap()
1839 bus_dmamap_sync(sc->ste_cdata.ste_tx_tag, txc->ste_map, in ste_encap()
1842 desc = txc->ste_ptr; in ste_encap()
1844 frag = &desc->ste_frags[i]; in ste_encap()
1845 frag->ste_addr = htole32(STE_ADDR_LO(txsegs[i].ds_addr)); in ste_encap()
1846 frag->ste_len = htole32(txsegs[i].ds_len); in ste_encap()
1848 desc->ste_frags[i - 1].ste_len |= htole32(STE_FRAG_LAST); in ste_encap()
1853 desc->ste_next = 0; in ste_encap()
1854 if ((sc->ste_cdata.ste_tx_prod % STE_TX_INTR_FRAMES) == 0) in ste_encap()
1855 desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS | in ste_encap()
1858 desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS); in ste_encap()
1859 txc->ste_mbuf = *m_head; in ste_encap()
1860 STE_INC(sc->ste_cdata.ste_tx_prod, STE_TX_LIST_CNT); in ste_encap()
1861 sc->ste_cdata.ste_tx_cnt++; in ste_encap()
1889 IFF_DRV_RUNNING || (sc->ste_flags & STE_FLAG_LINK) == 0) in ste_start_locked()
1893 if (sc->ste_cdata.ste_tx_cnt == STE_TX_LIST_CNT - 1) { in ste_start_locked()
1905 cur_tx = &sc->ste_cdata.ste_tx_chain[sc->ste_cdata.ste_tx_prod]; in ste_start_locked()
1912 if (sc->ste_cdata.ste_last_tx == NULL) { in ste_start_locked()
1913 bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag, in ste_start_locked()
1914 sc->ste_cdata.ste_tx_list_map, in ste_start_locked()
1919 STE_ADDR_LO(sc->ste_ldata.ste_tx_list_paddr)); in ste_start_locked()
1924 sc->ste_cdata.ste_last_tx->ste_ptr->ste_next = in ste_start_locked()
1925 sc->ste_cdata.ste_last_tx->ste_phys; in ste_start_locked()
1926 bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag, in ste_start_locked()
1927 sc->ste_cdata.ste_tx_list_map, in ste_start_locked()
1930 sc->ste_cdata.ste_last_tx = cur_tx; in ste_start_locked()
1941 sc->ste_timer = STE_TX_TIMEOUT; in ste_start_locked()
1949 ifp = sc->ste_ifp; in ste_watchdog()
1952 if (sc->ste_timer == 0 || --sc->ste_timer) in ste_watchdog()
1960 ste_rxeof(sc, -1); in ste_watchdog()
2000 if (pci_find_cap(sc->ste_dev, PCIY_PMG, &pmc) == 0) { in ste_resume()
2001 /* Disable PME and clear PME status. */ in ste_resume()
2002 pmstat = pci_read_config(sc->ste_dev, in ste_resume()
2006 pci_write_config(sc->ste_dev, in ste_resume()
2010 ifp = sc->ste_ifp; in ste_resume()
2033 stats = &sc->ste_stats; in ste_sysctl_node()
2034 ctx = device_get_sysctl_ctx(sc->ste_dev); in ste_sysctl_node()
2035 child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ste_dev)); in ste_sysctl_node()
2038 CTLFLAG_RW, &sc->ste_int_rx_mod, 0, "ste RX interrupt moderation"); in ste_sysctl_node()
2040 sc->ste_int_rx_mod = STE_IM_RX_TIMER_DEFAULT; in ste_sysctl_node()
2041 resource_int_value(device_get_name(sc->ste_dev), in ste_sysctl_node()
2042 device_get_unit(sc->ste_dev), "int_rx_mod", &sc->ste_int_rx_mod); in ste_sysctl_node()
2053 &stats->rx_bytes, "Good octets"); in ste_sysctl_node()
2055 &stats->rx_frames, "Good frames"); in ste_sysctl_node()
2057 &stats->rx_bcast_frames, "Good broadcast frames"); in ste_sysctl_node()
2059 &stats->rx_mcast_frames, "Good multicast frames"); in ste_sysctl_node()
2061 &stats->rx_lost_frames, "Lost frames"); in ste_sysctl_node()
2068 &stats->tx_bytes, "Good octets"); in ste_sysctl_node()
2070 &stats->tx_frames, "Good frames"); in ste_sysctl_node()
2072 &stats->tx_bcast_frames, "Good broadcast frames"); in ste_sysctl_node()
2074 &stats->tx_mcast_frames, "Good multicast frames"); in ste_sysctl_node()
2076 &stats->tx_carrsense_errs, "Carrier sense errors"); in ste_sysctl_node()
2078 &stats->tx_single_colls, "Single collisions"); in ste_sysctl_node()
2080 &stats->tx_multi_colls, "Multiple collisions"); in ste_sysctl_node()
2082 &stats->tx_late_colls, "Late collisions"); in ste_sysctl_node()
2084 &stats->tx_frames_defered, "Frames with deferrals"); in ste_sysctl_node()
2086 &stats->tx_excess_defers, "Frames with excessive derferrals"); in ste_sysctl_node()
2088 &stats->tx_abort, "Aborted frames due to Excessive collisions"); in ste_sysctl_node()
2104 if (pci_find_cap(sc->ste_dev, PCIY_PMG, &pmc) != 0) { in ste_setwol()
2111 ifp = sc->ste_ifp; in ste_setwol()
2118 /* Request PME. */ in ste_setwol()
2119 pmstat = pci_read_config(sc->ste_dev, pmc + PCIR_POWER_STATUS, 2); in ste_setwol()
2123 pci_write_config(sc->ste_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); in ste_setwol()