Lines Matching +full:software +full:- +full:locked
1 /*-
2 * SPDX-License-Identifier: (BSD-1-Clause AND BSD-4-Clause)
6 * Permission to use, copy, modify, and distribute this software for any
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /*-
22 * Permission to use, copy, modify, and distribute this software for any
26 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
27 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
32 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
35 /*-
38 * Permission to use, copy, modify, and distribute this software for any
42 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
43 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
48 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 /*-
52 * Copyright (c) 1997, 1998, 1999, 2000-2003
63 * 3. All advertising materials mentioning features or use of this software
65 * This product includes software developed by Bill Paul.
66 * 4. Neither the name of the author nor the names of any co-contributors
67 * may be used to endorse or promote products derived from this software
70 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
79 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
279 err = uether_do_request(&sc->sc_ue, &req, &val, 1000); in mos_reg_read_1()
283 return (-1); in mos_reg_read_1()
303 err = uether_do_request(&sc->sc_ue, &req, &val, 1000); in mos_reg_read_2()
307 return (-1); in mos_reg_read_2()
326 err = uether_do_request(&sc->sc_ue, &req, &val, 1000); in mos_reg_write_1()
330 return (-1); in mos_reg_write_1()
350 err = uether_do_request(&sc->sc_ue, &req, &val, 1000); in mos_reg_write_2()
354 return (-1); in mos_reg_write_2()
371 err = uether_do_request(&sc->sc_ue, &req, mac, 1000); in mos_readmac()
374 return (-1); in mos_readmac()
391 err = uether_do_request(&sc->sc_ue, &req, mac, 1000); in mos_writemac()
395 return (-1); in mos_writemac()
412 err = uether_do_request(&sc->sc_ue, &req, hashtbl, 1000); in mos_write_mcast()
416 return (-1); in mos_write_mcast()
425 int i, res, locked; in mos_miibus_readreg() local
427 locked = mtx_owned(&sc->sc_mtx); in mos_miibus_readreg()
428 if (!locked) in mos_miibus_readreg()
446 if (!locked) in mos_miibus_readreg()
455 int i, locked; in mos_miibus_writereg() local
457 locked = mtx_owned(&sc->sc_mtx); in mos_miibus_writereg()
458 if (!locked) in mos_miibus_writereg()
474 if (!locked) in mos_miibus_writereg()
484 int val, err, locked; in mos_miibus_statchg() local
486 locked = mtx_owned(&sc->sc_mtx); in mos_miibus_statchg()
487 if (!locked) in mos_miibus_statchg()
498 if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) in mos_miibus_statchg()
503 switch (IFM_SUBTYPE(mii->mii_media_active)) { in mos_miibus_statchg()
512 /* re-enable TX, RX */ in mos_miibus_statchg()
519 if (!locked) in mos_miibus_statchg()
536 sc->mos_link = 0; in mos_ifmedia_upd()
537 LIST_FOREACH(miisc, &mii->mii_phys, mii_list) in mos_ifmedia_upd()
555 ifmr->ifm_active = mii->mii_media_active; in mos_ifmedia_sts()
556 ifmr->ifm_status = mii->mii_media_status; in mos_ifmedia_sts()
639 usb_pause_mtx(&sc->sc_mtx, hz / 128); in mos_reset()
652 if (mos_reg_read_1(sc, MOS_PAUSE_TRHD) != -1) { in mos_chip_init()
656 sc->mos_phyaddrs[0] = 1; in mos_chip_init()
657 sc->mos_phyaddrs[1] = 0xFF; in mos_chip_init()
669 if (uaa->usb_mode != USB_MODE_HOST) in mos_probe()
671 if (uaa->info.bConfigIndex != MOS_CONFIG_IDX) in mos_probe()
673 if (uaa->info.bIfaceIndex != MOS_IFACE_IDX) in mos_probe()
689 struct usb_ether *ue = &sc->sc_ue; in mos_attach()
693 sc->mos_flags = USB_GET_DRIVER_INFO(uaa); in mos_attach()
696 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); in mos_attach()
699 error = usbd_transfer_setup(uaa->device, &iface_index, in mos_attach()
700 sc->sc_xfer, mos_config, MOS_ENDPT_MAX, in mos_attach()
701 sc, &sc->sc_mtx); in mos_attach()
707 ue->ue_sc = sc; in mos_attach()
708 ue->ue_dev = dev; in mos_attach()
709 ue->ue_udev = uaa->device; in mos_attach()
710 ue->ue_mtx = &sc->sc_mtx; in mos_attach()
711 ue->ue_methods = &mos_ue_methods; in mos_attach()
713 if (sc->mos_flags & MCS7730) { in mos_attach()
715 } else if (sc->mos_flags & MCS7830) { in mos_attach()
717 } else if (sc->mos_flags & MCS7832) { in mos_attach()
739 err = mos_readmac(sc, ue->ue_eaddr); in mos_attach_post()
744 MOS_DPRINTFN("address: %s", ether_sprintf(ue->ue_eaddr)); in mos_attach_post()
753 struct usb_ether *ue = &sc->sc_ue; in mos_detach()
755 usbd_transfer_unsetup(sc->sc_xfer, MOS_ENDPT_MAX); in mos_detach()
757 mtx_destroy(&sc->sc_mtx); in mos_detach()
770 struct usb_ether *ue = &sc->sc_ue; in mos_bulk_read_callback()
789 usbd_copy_out(pc, actlen - sizeof(rxstat), &rxstat, in mos_bulk_read_callback()
808 pktlen = actlen - 1; in mos_bulk_read_callback()
843 if_t ifp = uether_getifp(&sc->sc_ue); in mos_bulk_write_callback()
862 usbd_m_copy_in(pc, 0, m, 0, m->m_pkthdr.len); in mos_bulk_write_callback()
864 usbd_xfer_set_frame_len(xfer, 0, m->m_pkthdr.len); in mos_bulk_write_callback()
898 if (!sc->mos_link && mii->mii_media_status & IFM_ACTIVE && in mos_tick()
899 IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { in mos_tick()
901 sc->mos_link++; in mos_tick()
914 usbd_transfer_start(sc->sc_xfer[MOS_ENDPT_TX]); in mos_start()
915 usbd_transfer_start(sc->sc_xfer[MOS_ENDPT_RX]); in mos_start()
916 usbd_transfer_start(sc->sc_xfer[MOS_ENDPT_INTR]); in mos_start()
935 sc->mos_ipgs[0] = mos_reg_read_1(sc, MOS_IPG0); in mos_init()
936 sc->mos_ipgs[1] = mos_reg_read_1(sc, MOS_IPG1); in mos_init()
937 mos_reg_write_1(sc, MOS_IPG0, sc->mos_ipgs[0]); in mos_init()
938 mos_reg_write_1(sc, MOS_IPG1, sc->mos_ipgs[1]); in mos_init()
964 if_t ifp = uether_getifp(&sc->sc_ue); in mos_intr_callback()
1008 usbd_transfer_stop(sc->sc_xfer[MOS_ENDPT_TX]); in mos_stop()
1009 usbd_transfer_stop(sc->sc_xfer[MOS_ENDPT_RX]); in mos_stop()
1010 usbd_transfer_stop(sc->sc_xfer[MOS_ENDPT_INTR]); in mos_stop()
1012 sc->mos_link = 0; in mos_stop()