From owner-svn-src-all@FreeBSD.ORG Tue Jan 13 19:03:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC75510656DA; Tue, 13 Jan 2009 19:03:12 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87AD28FC27; Tue, 13 Jan 2009 19:03:12 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0DJ3CAM012479; Tue, 13 Jan 2009 19:03:12 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0DJ3CT2012473; Tue, 13 Jan 2009 19:03:12 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901131903.n0DJ3CT2012473@svn.freebsd.org> From: Andrew Thompson Date: Tue, 13 Jan 2009 19:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187173 - in head/sys/dev/usb2: controller core serial storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2009 19:03:17 -0000 Author: thompsa Date: Tue Jan 13 19:03:12 2009 New Revision: 187173 URL: http://svn.freebsd.org/changeset/base/187173 Log: MFp4: //depot/projects/usb@155839 This change is about removing three fields from "struct usb2_xfer" which can be reached from "struct usb2_xfer_root" instead and cleaning up the code after this change. The fields are "xfer->udev", "xfer->xfer_mtx" and "xfer->usb2_sc". In this process the following changes were also made: Rename "usb2_root" to "xroot" which is short for "xfer root". Rename "priv_mtx" to "xfer_mtx" in USB core. The USB_XFER_LOCK and USB_XFER_UNLOCK macros should only be used in the USB core due to dependency towards "xroot". Substitute macros for the real lock in two USB device drivers. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb2/controller/at91dci.c head/sys/dev/usb2/controller/ehci2.c head/sys/dev/usb2/controller/musb2_otg.c head/sys/dev/usb2/controller/ohci2.c head/sys/dev/usb2/controller/uhci2.c head/sys/dev/usb2/controller/uss820dci.c head/sys/dev/usb2/core/usb2_busdma.c head/sys/dev/usb2/core/usb2_core.h head/sys/dev/usb2/core/usb2_debug.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_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 Tue Jan 13 19:03:01 2009 (r187172) +++ head/sys/dev/usb2/controller/at91dci.c Tue Jan 13 19:03:12 2009 (r187173) @@ -259,13 +259,13 @@ at91dci_pull_down(struct at91dci_softc * static void at91dci_wakeup_peer(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint8_t use_polling; if (!(sc->sc_flags.status_suspend)) { return; } - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; AT91_UDP_WRITE_4(sc, AT91_UDP_GSTATE, AT91_UDP_GSTATE_ESR); @@ -698,7 +698,7 @@ at91dci_xfer_do_fifo(struct usb2_xfer *x return (1); /* not complete */ done: - sc = xfer->usb2_sc; + sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); temp = (xfer->endpoint & UE_ADDR); /* update FIFO bank flag and multi buffer */ @@ -886,7 +886,7 @@ at91dci_setup_standard_chain(struct usb2 DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", xfer->address, UE_GET_ADDR(xfer->endpoint), - xfer->sumlen, usb2_get_speed(xfer->udev)); + xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); temp.max_frame_size = xfer->max_frame_size; @@ -901,7 +901,7 @@ at91dci_setup_standard_chain(struct usb2 temp.setup_alt_next = xfer->flags_int.short_frames_ok; temp.offset = 0; - sc = xfer->usb2_sc; + sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); ep_no = (xfer->endpoint & UE_ADDR); /* check if we should prepend a setup message */ @@ -1042,7 +1042,7 @@ at91dci_start_standard_chain(struct usb2 /* poll one time */ if (at91dci_xfer_do_fifo(xfer)) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint8_t ep_no = xfer->endpoint & UE_ADDR; /* @@ -1055,7 +1055,7 @@ at91dci_start_standard_chain(struct usb2 DPRINTFN(15, "enable interrupts on endpoint %d\n", ep_no); /* put transfer on interrupt queue */ - usb2_transfer_enqueue(&xfer->udev->bus->intr_q, xfer); + usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); /* start timeout, if any */ if (xfer->timeout != 0) { @@ -1069,7 +1069,7 @@ static void at91dci_root_intr_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); DPRINTFN(9, "\n"); @@ -1209,7 +1209,7 @@ done: static void at91dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint8_t ep_no; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -1623,7 +1623,7 @@ at91dci_device_isoc_fs_close(struct usb2 static void at91dci_device_isoc_fs_enter(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint32_t temp; uint32_t nframes; @@ -1705,7 +1705,7 @@ at91dci_root_ctrl_open(struct usb2_xfer static void at91dci_root_ctrl_close(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_ctrl.xfer == xfer) { sc->sc_root_ctrl.xfer = NULL; @@ -1809,11 +1809,11 @@ at91dci_root_ctrl_enter(struct usb2_xfer static void at91dci_root_ctrl_start(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); sc->sc_root_ctrl.xfer = xfer; - usb2_bus_roothub_exec(xfer->udev->bus); + usb2_bus_roothub_exec(xfer->xroot->bus); } static void @@ -1826,7 +1826,7 @@ static void at91dci_root_ctrl_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint16_t value; uint16_t index; uint8_t use_polling; @@ -1847,7 +1847,7 @@ at91dci_root_ctrl_done(struct usb2_xfer value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; /* demultiplex the control request */ @@ -2252,7 +2252,7 @@ at91dci_root_intr_open(struct usb2_xfer static void at91dci_root_intr_close(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_intr.xfer == xfer) { sc->sc_root_intr.xfer = NULL; @@ -2269,7 +2269,7 @@ at91dci_root_intr_enter(struct usb2_xfer static void at91dci_root_intr_start(struct usb2_xfer *xfer) { - struct at91dci_softc *sc = xfer->usb2_sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); sc->sc_root_intr.xfer = xfer; } @@ -2299,11 +2299,6 @@ at91dci_xfer_setup(struct usb2_setup_par xfer = parm->curr_xfer; /* - * setup xfer - */ - xfer->usb2_sc = sc; - - /* * NOTE: This driver does not use any of the parameters that * are computed from the following values. Just set some * reasonable dummies: Modified: head/sys/dev/usb2/controller/ehci2.c ============================================================================== --- head/sys/dev/usb2/controller/ehci2.c Tue Jan 13 19:03:01 2009 (r187172) +++ head/sys/dev/usb2/controller/ehci2.c Tue Jan 13 19:03:12 2009 (r187173) @@ -971,7 +971,7 @@ ehci_transfer_intr_enqueue(struct usb2_x return; } /* put transfer on interrupt queue */ - usb2_transfer_enqueue(&xfer->udev->bus->intr_q, xfer); + usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); /* start timeout, if any */ if (xfer->timeout != 0) { @@ -1135,7 +1135,7 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_ static usb2_error_t ehci_non_isoc_done_sub(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_qtd_t *td; ehci_qtd_t *td_alt_next; uint32_t status; @@ -1239,7 +1239,7 @@ ehci_non_isoc_done(struct usb2_xfer *xfe #if USB_DEBUG if (ehcidebug > 10) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_dump_sqtds(sc, xfer->td_transfer_first); } @@ -1291,7 +1291,7 @@ static uint8_t ehci_check_transfer(struct usb2_xfer *xfer) { struct usb2_pipe_methods *methods = xfer->pipe->methods; - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint32_t status; @@ -1521,7 +1521,7 @@ ehci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); /* transfer is transferred */ ehci_device_done(xfer, USB_ERR_TIMEOUT); @@ -1731,11 +1731,11 @@ ehci_setup_standard_chain(struct usb2_xf DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", xfer->address, UE_GET_ADDR(xfer->endpoint), - xfer->sumlen, usb2_get_speed(xfer->udev)); + xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); temp.average = xfer->max_usb2_frame_size; temp.max_frame_size = xfer->max_frame_size; - temp.sc = xfer->usb2_sc; + temp.sc = EHCI_BUS2SC(xfer->xroot->bus); /* toggle the DMA set we are using */ xfer->flags_int.curr_dma_set ^= 1; @@ -1763,7 +1763,7 @@ ehci_setup_standard_chain(struct usb2_xf temp.auto_data_toggle = 1; } - if (usb2_get_speed(xfer->udev) != USB_SPEED_HIGH) { + if (usb2_get_speed(xfer->xroot->udev) != USB_SPEED_HIGH) { /* max 3 retries */ temp.qtd_status |= htoehci32(temp.sc, EHCI_QTD_SET_CERR(3)); @@ -1894,12 +1894,12 @@ ehci_setup_standard_chain(struct usb2_xf EHCI_QH_SET_ENDPT(UE_GET_ADDR(xfer->endpoint)) | EHCI_QH_SET_MPL(xfer->max_packet_size)); - if (usb2_get_speed(xfer->udev) == USB_SPEED_HIGH) { + if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | EHCI_QH_DTC | EHCI_QH_SET_NRL(8)); } else { - if (usb2_get_speed(xfer->udev) == USB_SPEED_FULL) { + if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) { qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL) | EHCI_QH_DTC); } else { @@ -1922,8 +1922,8 @@ ehci_setup_standard_chain(struct usb2_xf (EHCI_QH_SET_MULT(xfer->max_packet_count & 3) | EHCI_QH_SET_CMASK(xfer->usb2_cmask) | EHCI_QH_SET_SMASK(xfer->usb2_smask) | - EHCI_QH_SET_HUBA(xfer->udev->hs_hub_addr) | - EHCI_QH_SET_PORT(xfer->udev->hs_port_no)); + EHCI_QH_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | + EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no)); qh->qh_endphub = htoehci32(temp.sc, qh_endphub); qh->qh_curqtd = htoehci32(temp.sc, 0); @@ -1951,7 +1951,7 @@ ehci_setup_standard_chain(struct usb2_xf usb2_pc_cpu_flush(qh->page_cache); - if (xfer->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->pwr_save.suspended == 0) { EHCI_APPEND_QH(qh, *qh_last); } } @@ -1960,7 +1960,7 @@ static void ehci_root_intr_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint16_t i; uint16_t m; @@ -2117,7 +2117,7 @@ static void ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error) { struct usb2_pipe_methods *methods = xfer->pipe->methods; - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -2130,7 +2130,7 @@ ehci_device_done(struct usb2_xfer *xfer, if (ehcidebug > 8) { DPRINTF("nexttog=%d; data after transfer:\n", xfer->pipe->toggle_next); - ehci_dump_sqtds(xfer->usb2_sc, + ehci_dump_sqtds(sc, xfer->td_transfer_first); } #endif @@ -2185,7 +2185,7 @@ ehci_device_bulk_enter(struct usb2_xfer static void ehci_device_bulk_start(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ehci_setup_standard_chain(xfer, &sc->sc_async_p_last); @@ -2228,7 +2228,7 @@ ehci_device_ctrl_enter(struct usb2_xfer static void ehci_device_ctrl_start(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ehci_setup_standard_chain(xfer, &sc->sc_async_p_last); @@ -2253,7 +2253,7 @@ struct usb2_pipe_methods ehci_device_ctr static void ehci_device_intr_open(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint16_t best; uint16_t bit; uint16_t x; @@ -2262,9 +2262,9 @@ ehci_device_intr_open(struct usb2_xfer * /* Allocate a microframe slot first: */ slot = usb2_intr_schedule_adjust - (xfer->udev, xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX); + (xfer->xroot->udev, xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX); - if (usb2_get_speed(xfer->udev) == USB_SPEED_HIGH) { + if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { xfer->usb2_uframe = slot; xfer->usb2_smask = (1 << slot) & 0xFF; xfer->usb2_cmask = 0; @@ -2306,11 +2306,11 @@ ehci_device_intr_open(struct usb2_xfer * static void ehci_device_intr_close(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint8_t slot; slot = usb2_intr_schedule_adjust - (xfer->udev, -(xfer->max_frame_size), xfer->usb2_uframe); + (xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb2_uframe); sc->sc_intr_stat[xfer->qh_pos]--; @@ -2326,7 +2326,7 @@ ehci_device_intr_enter(struct usb2_xfer static void ehci_device_intr_start(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ehci_setup_standard_chain(xfer, &sc->sc_intr_p_last[xfer->qh_pos]); @@ -2351,7 +2351,7 @@ struct usb2_pipe_methods ehci_device_int static void ehci_device_isoc_fs_open(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_sitd_t *td; uint32_t sitd_portaddr; uint8_t ds; @@ -2359,8 +2359,8 @@ ehci_device_isoc_fs_open(struct usb2_xfe sitd_portaddr = EHCI_SITD_SET_ADDR(xfer->address) | EHCI_SITD_SET_ENDPT(UE_GET_ADDR(xfer->endpoint)) | - EHCI_SITD_SET_HUBA(xfer->udev->hs_hub_addr) | - EHCI_SITD_SET_PORT(xfer->udev->hs_port_no); + EHCI_SITD_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | + EHCI_SITD_SET_PORT(xfer->xroot->udev->hs_port_no); if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) { sitd_portaddr |= EHCI_SITD_SET_DIR_IN; @@ -2399,7 +2399,7 @@ static void ehci_device_isoc_fs_enter(struct usb2_xfer *xfer) { struct usb2_page_search buf_res; - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); struct usb2_fs_isoc_schedule *fss_start; struct usb2_fs_isoc_schedule *fss_end; struct usb2_fs_isoc_schedule *fss; @@ -2460,7 +2460,7 @@ ehci_device_isoc_fs_enter(struct usb2_xf */ xfer->isoc_time_complete = usb2_fs_isoc_schedule_isoc_time_expand - (xfer->udev, &fss_start, &fss_end, nframes) + buf_offset + + (xfer->xroot->udev, &fss_start, &fss_end, nframes) + buf_offset + xfer->nframes; /* get the real number of frames */ @@ -2636,7 +2636,7 @@ struct usb2_pipe_methods ehci_device_iso static void ehci_device_isoc_hs_open(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_itd_t *td; uint32_t temp; uint8_t ds; @@ -2690,7 +2690,7 @@ static void ehci_device_isoc_hs_enter(struct usb2_xfer *xfer) { struct usb2_page_search buf_res; - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_itd_t *td; ehci_itd_t *td_last = NULL; ehci_itd_t **pp_last; @@ -2914,7 +2914,7 @@ ehci_root_ctrl_open(struct usb2_xfer *xf static void ehci_root_ctrl_close(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_ctrl.xfer == xfer) { sc->sc_root_ctrl.xfer = NULL; @@ -3021,13 +3021,13 @@ ehci_root_ctrl_enter(struct usb2_xfer *x static void ehci_root_ctrl_start(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); DPRINTF("\n"); sc->sc_root_ctrl.xfer = xfer; - usb2_bus_roothub_exec(xfer->udev->bus); + usb2_bus_roothub_exec(xfer->xroot->bus); } static void @@ -3040,7 +3040,7 @@ static void ehci_root_ctrl_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); char *ptr; uint32_t port; uint32_t v; @@ -3066,7 +3066,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " "wValue=0x%04x wIndex=0x%04x\n", @@ -3483,7 +3483,7 @@ ehci_root_intr_open(struct usb2_xfer *xf static void ehci_root_intr_close(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_intr.xfer == xfer) { sc->sc_root_intr.xfer = NULL; @@ -3500,7 +3500,7 @@ ehci_root_intr_enter(struct usb2_xfer *x static void ehci_root_intr_start(struct usb2_xfer *xfer) { - ehci_softc_t *sc = xfer->usb2_sc; + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); sc->sc_root_intr.xfer = xfer; } @@ -3538,11 +3538,6 @@ ehci_xfer_setup(struct usb2_setup_params nitd = 0; /* - * setup xfer - */ - xfer->usb2_sc = sc; - - /* * compute maximum number of some structures */ if (parm->methods == &ehci_device_ctrl_methods) { @@ -3864,7 +3859,7 @@ ehci_device_resume(struct usb2_device *u TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->udev == udev) { + if (xfer->xroot->udev == udev) { methods = xfer->pipe->methods; @@ -3898,7 +3893,7 @@ ehci_device_suspend(struct usb2_device * TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->udev == udev) { + if (xfer->xroot->udev == udev) { methods = xfer->pipe->methods; Modified: head/sys/dev/usb2/controller/musb2_otg.c ============================================================================== --- head/sys/dev/usb2/controller/musb2_otg.c Tue Jan 13 19:03:01 2009 (r187172) +++ head/sys/dev/usb2/controller/musb2_otg.c Tue Jan 13 19:03:12 2009 (r187173) @@ -204,14 +204,14 @@ musbotg_pull_down(struct musbotg_softc * static void musbotg_wakeup_peer(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint8_t temp; uint8_t use_polling; if (!(sc->sc_flags.status_suspend)) { return; } - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); temp |= MUSB2_MASK_RESUME; @@ -931,7 +931,7 @@ musbotg_xfer_do_fifo(struct usb2_xfer *x return (1); /* not complete */ done: - sc = xfer->usb2_sc; + sc = MUSBOTG_BUS2SC(xfer->xroot->bus); /* compute all actual lengths */ @@ -1130,7 +1130,7 @@ musbotg_setup_standard_chain(struct usb2 DPRINTFN(8, "addr=%d endpt=%d sumlen=%d speed=%d\n", xfer->address, UE_GET_ADDR(xfer->endpoint), - xfer->sumlen, usb2_get_speed(xfer->udev)); + xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); temp.max_frame_size = xfer->max_frame_size; @@ -1145,7 +1145,7 @@ musbotg_setup_standard_chain(struct usb2 temp.setup_alt_next = xfer->flags_int.short_frames_ok; temp.offset = 0; - sc = xfer->usb2_sc; + sc = MUSBOTG_BUS2SC(xfer->xroot->bus); ep_no = (xfer->endpoint & UE_ADDR); /* check if we should prepend a setup message */ @@ -1245,7 +1245,7 @@ musbotg_timeout(void *arg) DPRINTFN(1, "xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); /* transfer is transferred */ musbotg_device_done(xfer, USB_ERR_TIMEOUT); @@ -1254,7 +1254,7 @@ musbotg_timeout(void *arg) static void musbotg_ep_int_set(struct usb2_xfer *xfer, uint8_t on) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint16_t temp; uint8_t ep_no = xfer->endpoint & UE_ADDR; @@ -1304,7 +1304,7 @@ musbotg_start_standard_chain(struct usb2 DPRINTFN(14, "enabled interrupts on endpoint\n"); /* put transfer on interrupt queue */ - usb2_transfer_enqueue(&xfer->udev->bus->intr_q, xfer); + usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); /* start timeout, if any */ if (xfer->timeout != 0) { @@ -1318,7 +1318,7 @@ static void musbotg_root_intr_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); DPRINTFN(8, "\n"); @@ -1458,7 +1458,7 @@ done: static void musbotg_device_done(struct usb2_xfer *xfer, usb2_error_t error) { - USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", xfer, xfer->pipe, error); @@ -2021,7 +2021,7 @@ musbotg_device_isoc_close(struct usb2_xf static void musbotg_device_isoc_enter(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint32_t temp; uint32_t nframes; uint32_t fs_frames; @@ -2039,7 +2039,7 @@ musbotg_device_isoc_enter(struct usb2_xf */ temp = (nframes - xfer->pipe->isoc_next) & MUSB2_MASK_FRAME; - if (usb2_get_speed(xfer->udev) == USB_SPEED_HIGH) { + if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { fs_frames = (xfer->nframes + 7) / 8; } else { fs_frames = xfer->nframes; @@ -2109,7 +2109,7 @@ musbotg_root_ctrl_open(struct usb2_xfer static void musbotg_root_ctrl_close(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); if (sc->sc_root_ctrl.xfer == xfer) { sc->sc_root_ctrl.xfer = NULL; @@ -2214,11 +2214,11 @@ musbotg_root_ctrl_enter(struct usb2_xfer static void musbotg_root_ctrl_start(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); sc->sc_root_ctrl.xfer = xfer; - usb2_bus_roothub_exec(xfer->udev->bus); + usb2_bus_roothub_exec(xfer->xroot->bus); } static void @@ -2231,7 +2231,7 @@ static void musbotg_root_ctrl_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint16_t value; uint16_t index; uint8_t use_polling; @@ -2252,7 +2252,7 @@ musbotg_root_ctrl_done(struct usb2_xfer value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; /* demultiplex the control request */ @@ -2660,7 +2660,7 @@ musbotg_root_intr_open(struct usb2_xfer static void musbotg_root_intr_close(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); if (sc->sc_root_intr.xfer == xfer) { sc->sc_root_intr.xfer = NULL; @@ -2677,7 +2677,7 @@ musbotg_root_intr_enter(struct usb2_xfer static void musbotg_root_intr_start(struct usb2_xfer *xfer) { - struct musbotg_softc *sc = xfer->usb2_sc; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); sc->sc_root_intr.xfer = xfer; } @@ -2707,11 +2707,6 @@ musbotg_xfer_setup(struct usb2_setup_par xfer = parm->curr_xfer; /* - * setup xfer - */ - xfer->usb2_sc = sc; - - /* * NOTE: This driver does not use any of the parameters that * are computed from the following values. Just set some * reasonable dummies: Modified: head/sys/dev/usb2/controller/ohci2.c ============================================================================== --- head/sys/dev/usb2/controller/ohci2.c Tue Jan 13 19:03:01 2009 (r187172) +++ head/sys/dev/usb2/controller/ohci2.c Tue Jan 13 19:03:12 2009 (r187173) @@ -669,7 +669,7 @@ ohci_transfer_intr_enqueue(struct usb2_x return; } /* put transfer on interrupt queue */ - usb2_transfer_enqueue(&xfer->udev->bus->intr_q, xfer); + usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); /* start timeout, if any */ if (xfer->timeout != 0) { @@ -1233,7 +1233,7 @@ ohci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); /* transfer is transferred */ ohci_device_done(xfer, USB_ERR_TIMEOUT); @@ -1404,7 +1404,7 @@ ohci_setup_standard_chain(struct usb2_xf DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", xfer->address, UE_GET_ADDR(xfer->endpoint), - xfer->sumlen, usb2_get_speed(xfer->udev)); + xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); temp.average = xfer->max_usb2_frame_size; temp.max_frame_size = xfer->max_frame_size; @@ -1549,7 +1549,7 @@ ohci_setup_standard_chain(struct usb2_xf ed_flags |= (OHCI_ED_FORMAT_GEN | OHCI_ED_DIR_TD); - if (xfer->udev->speed == USB_SPEED_LOW) { + if (xfer->xroot->udev->speed == USB_SPEED_LOW) { ed_flags |= OHCI_ED_SPEED; } ed->ed_flags = htole32(ed_flags); @@ -1558,17 +1558,17 @@ ohci_setup_standard_chain(struct usb2_xf ed->ed_headp = td->td_self; - if (xfer->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->pwr_save.suspended == 0) { /* the append function will flush the endpoint descriptor */ OHCI_APPEND_QH(ed, *ed_last); if (methods == &ohci_device_bulk_methods) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF); } if (methods == &ohci_device_ctrl_methods) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF); } @@ -1581,7 +1581,7 @@ static void ohci_root_intr_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); uint32_t hstatus; uint16_t i; uint16_t m; @@ -1629,7 +1629,7 @@ static void ohci_device_done(struct usb2_xfer *xfer, usb2_error_t error) { struct usb2_pipe_methods *methods = xfer->pipe->methods; - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); ohci_ed_t *ed; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -1685,7 +1685,7 @@ ohci_device_bulk_enter(struct usb2_xfer static void ohci_device_bulk_start(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ohci_setup_standard_chain(xfer, &sc->sc_bulk_p_last); @@ -1728,7 +1728,7 @@ ohci_device_ctrl_enter(struct usb2_xfer static void ohci_device_ctrl_start(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ohci_setup_standard_chain(xfer, &sc->sc_ctrl_p_last); @@ -1753,7 +1753,7 @@ struct usb2_pipe_methods ohci_device_ctr static void ohci_device_intr_open(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); uint16_t best; uint16_t bit; uint16_t x; @@ -1786,7 +1786,7 @@ ohci_device_intr_open(struct usb2_xfer * static void ohci_device_intr_close(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); sc->sc_intr_stat[xfer->qh_pos]--; @@ -1802,7 +1802,7 @@ ohci_device_intr_enter(struct usb2_xfer static void ohci_device_intr_start(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); /* setup TD's and QH */ ohci_setup_standard_chain(xfer, &sc->sc_intr_p_last[xfer->qh_pos]); @@ -1841,7 +1841,7 @@ static void ohci_device_isoc_enter(struct usb2_xfer *xfer) { struct usb2_page_search buf_res; - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); struct ohci_hcca *hcca; uint32_t buf_offset; uint32_t nframes; @@ -1999,7 +1999,7 @@ ohci_device_isoc_enter(struct usb2_xfer OHCI_ED_SET_EN(UE_GET_ADDR(xfer->endpoint)) | OHCI_ED_SET_MAXP(xfer->max_frame_size)); - if (xfer->udev->speed == USB_SPEED_LOW) { + if (xfer->xroot->udev->speed == USB_SPEED_LOW) { ed_flags |= OHCI_ED_SPEED; } ed->ed_flags = htole32(ed_flags); @@ -2047,7 +2047,7 @@ ohci_root_ctrl_open(struct usb2_xfer *xf static void ohci_root_ctrl_close(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_ctrl.xfer == xfer) { sc->sc_root_ctrl.xfer = NULL; @@ -2127,11 +2127,11 @@ ohci_root_ctrl_enter(struct usb2_xfer *x static void ohci_root_ctrl_start(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); sc->sc_root_ctrl.xfer = xfer; - usb2_bus_roothub_exec(xfer->udev->bus); + usb2_bus_roothub_exec(xfer->xroot->bus); } static void @@ -2144,7 +2144,7 @@ static void ohci_root_ctrl_done(struct usb2_xfer *xfer, struct usb2_sw_transfer *std) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); char *ptr; uint32_t port; uint32_t v; @@ -2169,7 +2169,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf value = UGETW(std->req.wValue); index = UGETW(std->req.wIndex); - use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; + use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0; DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " "wValue=0x%04x wIndex=0x%04x\n", @@ -2470,7 +2470,7 @@ ohci_root_intr_open(struct usb2_xfer *xf static void ohci_root_intr_close(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); if (sc->sc_root_intr.xfer == xfer) { sc->sc_root_intr.xfer = NULL; @@ -2487,7 +2487,7 @@ ohci_root_intr_enter(struct usb2_xfer *x static void ohci_root_intr_start(struct usb2_xfer *xfer) { - ohci_softc_t *sc = xfer->usb2_sc; + ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); sc->sc_root_intr.xfer = xfer; } @@ -2518,11 +2518,6 @@ ohci_xfer_setup(struct usb2_setup_params sc = OHCI_BUS2SC(parm->udev->bus); xfer = parm->curr_xfer; - /* - * setup xfer - */ - xfer->usb2_sc = sc; - parm->hc_max_packet_size = 0x500; parm->hc_max_packet_count = 1; parm->hc_max_frame_size = OHCI_PAGE_SIZE; @@ -2753,7 +2748,7 @@ ohci_device_resume(struct usb2_device *u TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->udev == udev) { + if (xfer->xroot->udev == udev) { methods = xfer->pipe->methods; ed = xfer->qh_start[xfer->flags_int.curr_dma_set]; @@ -2791,7 +2786,7 @@ ohci_device_suspend(struct usb2_device * TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->udev == udev) { + if (xfer->xroot->udev == udev) { methods = xfer->pipe->methods; ed = xfer->qh_start[xfer->flags_int.curr_dma_set]; Modified: head/sys/dev/usb2/controller/uhci2.c ============================================================================== --- head/sys/dev/usb2/controller/uhci2.c Tue Jan 13 19:03:01 2009 (r187172) +++ head/sys/dev/usb2/controller/uhci2.c Tue Jan 13 19:03:12 2009 (r187173) @@ -878,7 +878,7 @@ uhci_transfer_intr_enqueue(struct usb2_x return; } /* put transfer on interrupt queue */ - usb2_transfer_enqueue(&xfer->udev->bus->intr_q, xfer); + usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); /* start timeout, if any */ if (xfer->timeout != 0) { @@ -1490,7 +1490,7 @@ uhci_timeout(void *arg) DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); /* transfer is transferred */ uhci_device_done(xfer, USB_ERR_TIMEOUT); @@ -1659,7 +1659,7 @@ uhci_setup_standard_chain(struct usb2_xf DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", xfer->address, UE_GET_ADDR(xfer->endpoint), - xfer->sumlen, usb2_get_speed(xfer->udev)); + xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); temp.average = xfer->max_frame_size; temp.max_frame_size = xfer->max_frame_size; @@ -1683,7 +1683,7 @@ uhci_setup_standard_chain(struct usb2_xf htole32(UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(3) | UHCI_TD_ACTIVE)); - if (xfer->udev->speed == USB_SPEED_LOW) { + if (xfer->xroot->udev->speed == USB_SPEED_LOW) { temp.td_status |= htole32(UHCI_TD_LS); } temp.td_token = @@ -1816,7 +1816,7 @@ static void uhci_device_done(struct usb2_xfer *xfer, usb2_error_t error) { struct usb2_pipe_methods *methods = xfer->pipe->methods; - uhci_softc_t *sc = xfer->usb2_sc; + uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_qh_t *qh; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -1836,7 +1836,7 @@ uhci_device_done(struct usb2_xfer *xfer, UHCI_REMOVE_QH(qh, sc->sc_bulk_p_last); } if (methods == &uhci_device_ctrl_methods) { - if (xfer->udev->speed == USB_SPEED_LOW) { + if (xfer->xroot->udev->speed == USB_SPEED_LOW) { UHCI_REMOVE_QH(qh, sc->sc_ls_ctl_p_last); } else { UHCI_REMOVE_QH(qh, sc->sc_fs_ctl_p_last); @@ -1885,7 +1885,7 @@ uhci_device_bulk_enter(struct usb2_xfer static void uhci_device_bulk_start(struct usb2_xfer *xfer) { - uhci_softc_t *sc = xfer->usb2_sc; + uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_td_t *td; uhci_qh_t *qh; @@ -1898,7 +1898,7 @@ uhci_device_bulk_start(struct usb2_xfer qh->e_next = td; qh->qh_e_next = td->td_self; - if (xfer->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->pwr_save.suspended == 0) { UHCI_APPEND_QH(qh, sc->sc_bulk_p_last); uhci_add_loop(sc); xfer->flags_int.bandwidth_reclaimed = 1; @@ -1944,7 +1944,7 @@ uhci_device_ctrl_enter(struct usb2_xfer static void uhci_device_ctrl_start(struct usb2_xfer *xfer) { - uhci_softc_t *sc = xfer->usb2_sc; + uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_qh_t *qh; uhci_td_t *td; @@ -1961,8 +1961,8 @@ uhci_device_ctrl_start(struct usb2_xfer * NOTE: some devices choke on bandwidth- reclamation for control * transfers */ - if (xfer->udev->pwr_save.suspended == 0) { - if (xfer->udev->speed == USB_SPEED_LOW) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***