Date: Mon, 10 Nov 2008 20:54:31 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r184824 - in head/sys/dev/usb2: controller core serial storage Message-ID: <200811102054.mAAKsVAQ082218@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thompsa Date: Mon Nov 10 20:54:31 2008 New Revision: 184824 URL: http://svn.freebsd.org/changeset/base/184824 Log: Convert the two main locking areas into macros to make it clear on what we are grabbing and why. These are now: USB_BUS_LOCK/USB_BUS_UNLOCK USB_XFER_LOCK/USB_XFER_UNLOCK Reviewed by: alfred Modified: head/sys/dev/usb2/controller/at91dci.c head/sys/dev/usb2/controller/at91dci_atmelarm.c head/sys/dev/usb2/controller/ehci2.c head/sys/dev/usb2/controller/ehci2_pci.c head/sys/dev/usb2/controller/musb2_otg.c head/sys/dev/usb2/controller/musb2_otg_atmelarm.c head/sys/dev/usb2/controller/ohci2.c head/sys/dev/usb2/controller/ohci2_atmelarm.c head/sys/dev/usb2/controller/ohci2_pci.c head/sys/dev/usb2/controller/uhci2.c head/sys/dev/usb2/controller/uhci2_pci.c head/sys/dev/usb2/controller/usb2_bus.h head/sys/dev/usb2/controller/usb2_controller.c head/sys/dev/usb2/controller/uss820dci.c head/sys/dev/usb2/controller/uss820dci_atmelarm.c head/sys/dev/usb2/controller/uss820dci_pccard.c head/sys/dev/usb2/core/usb2_busdma.c head/sys/dev/usb2/core/usb2_core.h head/sys/dev/usb2/core/usb2_device.c head/sys/dev/usb2/core/usb2_handle_request.c head/sys/dev/usb2/core/usb2_hub.c head/sys/dev/usb2/core/usb2_request.c head/sys/dev/usb2/core/usb2_sw_transfer.c head/sys/dev/usb2/core/usb2_transfer.c head/sys/dev/usb2/core/usb2_transfer.h head/sys/dev/usb2/serial/uvscom2.c head/sys/dev/usb2/storage/ata-usb2.c Modified: head/sys/dev/usb2/controller/at91dci.c ============================================================================== --- head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 20:54:31 2008 (r184824) @@ -291,7 +291,7 @@ at91dci_rem_wakeup_set(struct usb2_devic DPRINTFN(5, "is_on=%u\n", is_on); - mtx_assert(&udev->bus->mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); sc = AT9100_DCI_BUS2SC(udev->bus); @@ -766,7 +766,7 @@ at91dci_vbus_interrupt(struct usb2_bus * DPRINTFN(5, "vbus = %u\n", is_on); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); if (is_on) { if (!sc->sc_flags.status_vbus) { sc->sc_flags.status_vbus = 1; @@ -791,7 +791,7 @@ at91dci_vbus_interrupt(struct usb2_bus * } } - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -801,13 +801,13 @@ at91dci_interrupt(struct at91dci_softc * { uint32_t status; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); status = AT91_UDP_READ_4(sc, AT91_UDP_ISR); status &= AT91_UDP_INT_DEFAULT; if (!status) { - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } /* acknowledge interrupts */ @@ -879,7 +879,7 @@ at91dci_interrupt(struct at91dci_softc * at91dci_interrupt_poll(sc); } - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1065,12 +1065,12 @@ at91dci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* transfer is transferred */ at91dci_device_done(xfer, USB_ERR_TIMEOUT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1115,7 +1115,7 @@ at91dci_root_intr_done(struct usb2_xfer DPRINTFN(9, "\n"); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_PRE_DATA) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -1255,7 +1255,7 @@ at91dci_device_done(struct usb2_xfer *xf struct at91dci_softc *sc = xfer->usb2_sc; uint8_t ep_no; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", xfer, xfer->pipe, error); @@ -1281,7 +1281,7 @@ at91dci_set_stall(struct usb2_device *ud uint32_t csr_val; uint8_t csr_reg; - mtx_assert(&udev->bus->mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); DPRINTFN(5, "pipe=%p\n", pipe); @@ -1405,7 +1405,7 @@ at91dci_clear_stall(struct usb2_device * DPRINTFN(5, "pipe=%p\n", pipe); - mtx_assert(&udev->bus->mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); /* check mode */ if (udev->flags.usb2_mode != USB_MODE_DEVICE) { @@ -1438,7 +1438,7 @@ at91dci_init(struct at91dci_softc *sc) sc->sc_bus.usbrev = USB_REV_1_1; sc->sc_bus.methods = &at91dci_bus_methods; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); /* turn on clocks */ @@ -1446,7 +1446,7 @@ at91dci_init(struct at91dci_softc *sc) (sc->sc_clocks_on) (sc->sc_clocks_arg); } /* wait a little for things to stabilise */ - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); /* disable and clear all interrupts */ @@ -1483,7 +1483,7 @@ at91dci_init(struct at91dci_softc *sc) at91dci_clocks_off(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ @@ -1495,7 +1495,7 @@ at91dci_init(struct at91dci_softc *sc) void at91dci_uninit(struct at91dci_softc *sc) { - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); /* disable and clear all interrupts */ AT91_UDP_WRITE_4(sc, AT91_UDP_IDR, 0xFFFFFFFF); @@ -1510,7 +1510,7 @@ at91dci_uninit(struct at91dci_softc *sc) at91dci_pull_down(sc); at91dci_clocks_off(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1532,10 +1532,10 @@ at91dci_do_poll(struct usb2_bus *bus) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); at91dci_interrupt_poll(sc); at91dci_root_ctrl_poll(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1897,7 +1897,7 @@ at91dci_root_ctrl_done(struct usb2_xfer uint16_t index; uint8_t use_polling; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_SETUP) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -1913,7 +1913,7 @@ at91dci_root_ctrl_done(struct usb2_xfer value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; /* demultiplex the control request */ Modified: head/sys/dev/usb2/controller/at91dci_atmelarm.c ============================================================================== --- head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) @@ -210,7 +210,7 @@ at91_udp_attach(device_t dev) device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); err = usb2_config_td_setup(&sc->sc_dci.sc_config_td, sc, - &sc->sc_dci.sc_bus.mtx, NULL, 0, 4); + &sc->sc_dci.sc_bus.bus_mtx, NULL, 0, 4); if (err) { device_printf(dev, "could not setup config thread!\n"); goto error; Modified: head/sys/dev/usb2/controller/ehci2.c ============================================================================== --- head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 20:54:31 2008 (r184824) @@ -164,7 +164,7 @@ ehci_hc_reset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ for (n = 0; n != 100; n++) { - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); hcr = EOREAD4(sc, EHCI_USBSTS); if (hcr & EHCI_STS_HCH) { hcr = 0; @@ -180,7 +180,7 @@ ehci_hc_reset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); for (n = 0; n != 100; n++) { - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); hcr = EOREAD4(sc, EHCI_USBCMD); if (!(hcr & EHCI_CMD_HCRESET)) { hcr = 0; @@ -208,11 +208,11 @@ ehci_init(ehci_softc_t *sc) uint16_t bit; usb2_error_t err = 0; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); DPRINTF("start\n"); - usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.mtx, + usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, CALLOUT_RETURNUNLOCKED); #if USB_DEBUG @@ -465,7 +465,7 @@ ehci_init(ehci_softc_t *sc) EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); for (i = 0; i < 100; i++) { - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; if (!hcr) { break; @@ -477,7 +477,7 @@ ehci_init(ehci_softc_t *sc) goto done; } done: - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); if (!err) { /* catch any lost interrupts */ @@ -492,7 +492,7 @@ done: void ehci_detach(struct ehci_softc *sc) { - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); usb2_callout_stop(&sc->sc_tmo_pcd); @@ -502,9 +502,9 @@ ehci_detach(struct ehci_softc *sc) DPRINTF("reset failed!\n"); } /* XXX let stray task complete */ - usb2_pause_mtx(&sc->sc_bus.mtx, 50); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); usb2_callout_drain(&sc->sc_tmo_pcd); @@ -518,7 +518,7 @@ ehci_suspend(struct ehci_softc *sc) uint32_t hcr; uint8_t i; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); for (i = 1; i <= sc->sc_noport; i++) { cmd = EOREAD4(sc, EHCI_PORTSC(i)); @@ -541,7 +541,7 @@ ehci_suspend(struct ehci_softc *sc) if (hcr == 0) { break; } - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); } if (hcr != 0) { @@ -555,14 +555,14 @@ ehci_suspend(struct ehci_softc *sc) if (hcr == EHCI_STS_HCH) { break; } - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); } if (hcr != EHCI_STS_HCH) { device_printf(sc->sc_bus.bdev, "config timeout\n"); } - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -574,7 +574,7 @@ ehci_resume(struct ehci_softc *sc) uint32_t hcr; uint8_t i; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); /* restore things in case the bios doesn't */ EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); @@ -599,7 +599,7 @@ ehci_resume(struct ehci_softc *sc) } if (hcr) { - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_WAIT); for (i = 1; i <= sc->sc_noport; i++) { @@ -618,15 +618,15 @@ ehci_resume(struct ehci_softc *sc) if (hcr != EHCI_STS_HCH) { break; } - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); } if (hcr == EHCI_STS_HCH) { device_printf(sc->sc_bus.bdev, "config timeout\n"); } - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_WAIT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ ehci_do_poll(&sc->sc_bus); @@ -639,12 +639,12 @@ ehci_shutdown(ehci_softc_t *sc) { DPRINTF("stopping the HC\n"); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); if (ehci_hc_reset(sc)) { DPRINTF("reset failed!\n"); } - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); } #if USB_DEBUG @@ -1415,7 +1415,7 @@ transferred: static void ehci_pcd_enable(ehci_softc_t *sc) { - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); sc->sc_eintrs |= EHCI_STS_PCD; EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); @@ -1426,7 +1426,7 @@ ehci_pcd_enable(ehci_softc_t *sc) usb2_sw_transfer(&sc->sc_root_intr, &ehci_root_intr_done); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1460,7 +1460,7 @@ ehci_interrupt(ehci_softc_t *sc) { uint32_t status; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); DPRINTFN(16, "real interrupt\n"); @@ -1517,7 +1517,7 @@ ehci_interrupt(ehci_softc_t *sc) ehci_interrupt_poll(sc); done: - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1532,12 +1532,12 @@ ehci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* transfer is transferred */ ehci_device_done(xfer, USB_ERR_TIMEOUT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1547,10 +1547,10 @@ ehci_do_poll(struct usb2_bus *bus) { struct ehci_softc *sc = EHCI_BUS2SC(bus); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); ehci_interrupt_poll(sc); ehci_root_ctrl_poll(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1965,7 +1965,7 @@ ehci_root_intr_done(struct usb2_xfer *xf uint16_t i; uint16_t m; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_PRE_DATA) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -2124,7 +2124,7 @@ ehci_device_done(struct usb2_xfer *xfer, struct usb2_pipe_methods *methods = xfer->pipe->methods; ehci_softc_t *sc = xfer->usb2_sc; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", xfer, xfer->pipe, error); @@ -3076,7 +3076,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf uint8_t l; uint8_t use_polling; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_SETUP) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -3092,7 +3092,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " "wValue=0x%04x wIndex=0x%04x\n", @@ -3373,7 +3373,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); } else { /* Wait for reset to complete. */ - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_PORT_ROOT_RESET_DELAY); } @@ -3385,7 +3385,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf DELAY(EHCI_PORT_RESET_COMPLETE * 1000); } else { /* Wait for HC to complete reset. */ - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, EHCI_PORT_RESET_COMPLETE); } Modified: head/sys/dev/usb2/controller/ehci2_pci.c ============================================================================== --- head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) @@ -337,7 +337,7 @@ ehci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); } - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, NULL, 0, 4); if (err) { device_printf(self, "could not setup config thread!\n"); Modified: head/sys/dev/usb2/controller/musb2_otg.c ============================================================================== --- head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 20:54:31 2008 (r184824) @@ -221,7 +221,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf if (!(sc->sc_flags.status_suspend)) { return; } - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); temp |= MUSB2_MASK_RESUME; @@ -233,7 +233,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf DELAY(8000); } else { /* Wait for reset to complete. */ - usb2_pause_mtx(&sc->sc_bus.mtx, 8); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 8); } temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); @@ -982,7 +982,7 @@ musbotg_vbus_interrupt(struct usb2_bus * DPRINTFN(4, "vbus = %u\n", is_on); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); if (is_on) { if (!sc->sc_flags.status_vbus) { sc->sc_flags.status_vbus = 1; @@ -1007,7 +1007,7 @@ musbotg_vbus_interrupt(struct usb2_bus * } } - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1021,7 +1021,7 @@ musbotg_interrupt(struct musbotg_softc * uint8_t temp; uint8_t to = 2; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); repeat: @@ -1116,7 +1116,7 @@ repeat: if (--to) goto repeat; - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1273,12 +1273,12 @@ musbotg_timeout(void *arg) DPRINTFN(1, "xfer=%p\n", xfer); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* transfer is transferred */ musbotg_device_done(xfer, USB_ERR_TIMEOUT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1356,7 +1356,7 @@ musbotg_root_intr_done(struct usb2_xfer DPRINTFN(8, "\n"); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_PRE_DATA) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -1516,7 +1516,7 @@ musbotg_set_stall(struct usb2_device *ud struct musbotg_softc *sc; uint8_t ep_no; - mtx_assert(&udev->bus->mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); DPRINTFN(4, "pipe=%p\n", pipe); @@ -1702,7 +1702,7 @@ musbotg_clear_stall(struct usb2_device * DPRINTFN(4, "pipe=%p\n", pipe); - mtx_assert(&udev->bus->mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); /* check mode */ if (udev->flags.usb2_mode != USB_MODE_DEVICE) { @@ -1741,7 +1741,7 @@ musbotg_init(struct musbotg_softc *sc) sc->sc_bus.usbrev = USB_REV_2_0; sc->sc_bus.methods = &musbotg_bus_methods; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); /* turn on clocks */ @@ -1749,7 +1749,7 @@ musbotg_init(struct musbotg_softc *sc) (sc->sc_clocks_on) (sc->sc_clocks_arg); } /* wait a little for things to stabilise */ - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); /* disable all interrupts */ @@ -1762,7 +1762,7 @@ musbotg_init(struct musbotg_softc *sc) musbotg_pull_common(sc, 0); /* wait a little bit (10ms) */ - usb2_pause_mtx(&sc->sc_bus.mtx, 10); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 10); /* disable double packet buffering */ MUSB2_WRITE_2(sc, MUSB2_REG_RXDBDIS, 0xFFFF); @@ -1871,7 +1871,7 @@ musbotg_init(struct musbotg_softc *sc) musbotg_clocks_off(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ @@ -1883,7 +1883,7 @@ musbotg_init(struct musbotg_softc *sc) void musbotg_uninit(struct musbotg_softc *sc) { - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); /* disable all interrupts */ MUSB2_WRITE_1(sc, MUSB2_REG_INTUSBE, 0); @@ -1899,7 +1899,7 @@ musbotg_uninit(struct musbotg_softc *sc) musbotg_pull_down(sc); musbotg_clocks_off(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1921,10 +1921,10 @@ musbotg_do_poll(struct usb2_bus *bus) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); musbotg_interrupt_poll(sc); musbotg_root_ctrl_poll(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -2293,7 +2293,7 @@ musbotg_root_ctrl_done(struct usb2_xfer uint16_t index; uint8_t use_polling; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_SETUP) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -2309,7 +2309,7 @@ musbotg_root_ctrl_done(struct usb2_xfer value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; /* demultiplex the control request */ Modified: head/sys/dev/usb2/controller/musb2_otg_atmelarm.c ============================================================================== --- head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) @@ -138,7 +138,7 @@ musbotg_attach(device_t dev) device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); err = usb2_config_td_setup(&sc->sc_otg.sc_config_td, sc, - &sc->sc_otg.sc_bus.mtx, NULL, 0, 4); + &sc->sc_otg.sc_bus.bus_mtx, NULL, 0, 4); if (err) { device_printf(dev, "could not setup config thread!\n"); goto error; Modified: head/sys/dev/usb2/controller/ohci2.c ============================================================================== --- head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 20:54:31 2008 (r184824) @@ -173,7 +173,7 @@ ohci_controller_init(ohci_softc_t *sc) DPRINTF("SMM active, request owner change\n"); OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR); for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { - usb2_pause_mtx(&sc->sc_bus.mtx, 1); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); ctl = OREAD4(sc, OHCI_CONTROL); } if (ctl & OHCI_IR) { @@ -186,7 +186,7 @@ ohci_controller_init(ohci_softc_t *sc) DPRINTF("cold started\n"); reset: /* controller was cold started */ - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_BUS_RESET_DELAY); } @@ -197,7 +197,7 @@ reset: DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)); OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_BUS_RESET_DELAY); /* we now own the host controller and the bus has been reset */ @@ -260,7 +260,7 @@ reset: desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A); OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP); OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */ - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, OHCI_ENABLE_POWER_DELAY); OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca); @@ -270,7 +270,7 @@ reset: */ sc->sc_noport = 0; for (i = 0; (i < 10) && (sc->sc_noport == 0); i++) { - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, OHCI_READ_DESC_DELAY); sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A)); } @@ -309,7 +309,7 @@ ohci_init(ohci_softc_t *sc) uint16_t x; uint16_t y; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); DPRINTF("start\n"); @@ -391,7 +391,7 @@ ohci_init(ohci_softc_t *sc) /* set up the bus struct */ sc->sc_bus.methods = &ohci_bus_methods; - usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.mtx, + usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, CALLOUT_RETURNUNLOCKED); #if USB_DEBUG @@ -408,10 +408,10 @@ ohci_init(ohci_softc_t *sc) sc->sc_bus.usbrev = USB_REV_1_0; if (ohci_controller_init(sc)) { - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return (USB_ERR_INVAL); } else { - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ ohci_do_poll(&sc->sc_bus); return (USB_ERR_NORMAL_COMPLETION); @@ -424,7 +424,7 @@ ohci_init(ohci_softc_t *sc) void ohci_detach(struct ohci_softc *sc) { - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); usb2_callout_stop(&sc->sc_tmo_rhsc); @@ -432,9 +432,9 @@ ohci_detach(struct ohci_softc *sc) OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); /* XXX let stray task complete */ - usb2_pause_mtx(&sc->sc_bus.mtx, 50); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); usb2_callout_drain(&sc->sc_tmo_rhsc); @@ -449,7 +449,7 @@ ohci_suspend(ohci_softc_t *sc) { uint32_t ctl; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); #if USB_DEBUG DPRINTF("\n"); @@ -470,10 +470,10 @@ ohci_suspend(ohci_softc_t *sc) ctl |= OHCI_HCFS_SUSPEND; OWRITE4(sc, OHCI_CONTROL, ctl); - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_WAIT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -482,7 +482,7 @@ ohci_resume(ohci_softc_t *sc) { uint32_t ctl; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); #if USB_DEBUG DPRINTF("\n"); @@ -503,13 +503,13 @@ ohci_resume(ohci_softc_t *sc) ctl = OREAD4(sc, OHCI_CONTROL); ctl |= OHCI_HCFS_RESUME; OWRITE4(sc, OHCI_CONTROL, ctl); - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_DELAY); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_DELAY); ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL; OWRITE4(sc, OHCI_CONTROL, ctl); - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_RECOVERY); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_RECOVERY); sc->sc_control = sc->sc_intre = 0; - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ ohci_do_poll(&sc->sc_bus); @@ -699,7 +699,7 @@ _ohci_append_qh(ohci_ed_t *sed, uint32_t { DPRINTFN(11, "%p to %p\n", sed, last); - /* (sc->sc_bus.mtx) must be locked */ + /* (sc->sc_bus.bus_mtx) must be locked */ sed->next = last->next; sed->ed_next = last->ed_next; @@ -728,7 +728,7 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_ { DPRINTFN(11, "%p from %p\n", sed, last); - /* (sc->sc_bus.mtx) must be locked */ + /* (sc->sc_bus.bus_mtx) must be locked */ /* only remove if not removed from a queue */ if (sed->prev) { @@ -1099,7 +1099,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) { DPRINTFN(5, "\n"); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); sc->sc_eintrs |= OHCI_RHSC; OWRITE4(sc, OHCI_INTERRUPT_ENABLE, OHCI_RHSC); @@ -1110,7 +1110,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) usb2_sw_transfer(&sc->sc_root_intr, &ohci_root_intr_done); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1146,7 +1146,7 @@ ohci_interrupt(ohci_softc_t *sc) uint32_t status; uint32_t done; - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); hcca = ohci_get_hcca(sc); @@ -1246,7 +1246,7 @@ ohci_interrupt(ohci_softc_t *sc) ohci_interrupt_poll(sc); done: - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1261,12 +1261,12 @@ ohci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* transfer is transferred */ ohci_device_done(xfer, USB_ERR_TIMEOUT); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1276,10 +1276,10 @@ ohci_do_poll(struct usb2_bus *bus) { struct ohci_softc *sc = OHCI_BUS2SC(bus); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); ohci_interrupt_poll(sc); ohci_root_ctrl_poll(sc); - mtx_unlock(&sc->sc_bus.mtx); + USB_BUS_UNLOCK(&sc->sc_bus); return; } @@ -1617,7 +1617,7 @@ ohci_root_intr_done(struct usb2_xfer *xf uint16_t i; uint16_t m; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_PRE_DATA) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -1663,7 +1663,7 @@ ohci_device_done(struct usb2_xfer *xfer, ohci_softc_t *sc = xfer->usb2_sc; ohci_ed_t *ed; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", @@ -2198,7 +2198,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf uint8_t l; uint8_t use_polling; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); if (std->state != USB_SW_TR_SETUP) { if (std->state == USB_SW_TR_PRE_CALLBACK) { @@ -2214,7 +2214,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " "wValue=0x%04x wIndex=0x%04x\n", @@ -2375,7 +2375,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf /* enable RHSC interrupt if condition is cleared. */ if ((OREAD4(sc, port) >> 16) == 0) { ohci_rhsc_enable(sc); - mtx_lock(&sc->sc_bus.mtx); + USB_BUS_LOCK(&sc->sc_bus); } break; default: @@ -2456,7 +2456,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf /* polling */ DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); } else { - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_PORT_ROOT_RESET_DELAY); } Modified: head/sys/dev/usb2/controller/ohci2_atmelarm.c ============================================================================== --- head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) @@ -111,7 +111,7 @@ ohci_atmelarm_attach(device_t dev) strlcpy(sc->sc_ohci.sc_vendor, "Atmel", sizeof(sc->sc_ohci.sc_vendor)); err = usb2_config_td_setup(&sc->sc_ohci.sc_config_td, sc, - &sc->sc_ohci.sc_bus.mtx, NULL, 0, 4); + &sc->sc_ohci.sc_bus.bus_mtx, NULL, 0, 4); if (err) { device_printf(dev, "could not setup config thread!\n"); goto error; Modified: head/sys/dev/usb2/controller/ohci2_pci.c ============================================================================== --- head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) @@ -280,7 +280,7 @@ ohci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); } - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, NULL, 0, 4); if (err) { device_printf(self, "could not setup config thread!\n"); Modified: head/sys/dev/usb2/controller/uhci2.c ============================================================================== --- head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 18:24:11 2008 (r184823) +++ head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 20:54:31 2008 (r184824) @@ -265,7 +265,7 @@ uhci_reset(uhci_softc_t *sc) struct usb2_page_search buf_res; uint16_t n; - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTF("resetting the HC\n"); @@ -279,7 +279,7 @@ uhci_reset(uhci_softc_t *sc) /* wait */ - usb2_pause_mtx(&sc->sc_bus.mtx, + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_BUS_RESET_DELAY); /* terminate all transfers */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811102054.mAAKsVAQ082218>