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
This commit is contained in:
parent
f892798d89
commit
13bd84042e
@ -259,13 +259,13 @@ at91dci_pull_down(struct at91dci_softc *sc)
|
||||
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 *xfer)
|
||||
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_xfer *xfer)
|
||||
|
||||
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_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
/* 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_xfer *xfer)
|
||||
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 @@ at91dci_standard_done(struct usb2_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
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 *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 *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 *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 *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 *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;
|
||||
}
|
||||
@ -2298,11 +2298,6 @@ at91dci_xfer_setup(struct usb2_setup_params *parm)
|
||||
sc = AT9100_DCI_BUS2SC(parm->udev->bus);
|
||||
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
|
||||
|
@ -971,7 +971,7 @@ ehci_transfer_intr_enqueue(struct usb2_xfer *xfer)
|
||||
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_t *last)
|
||||
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 *xfer)
|
||||
|
||||
#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_xfer *xfer, ehci_qh_t **qh_last)
|
||||
|
||||
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_xfer *xfer, ehci_qh_t **qh_last)
|
||||
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_xfer *xfer, ehci_qh_t **qh_last)
|
||||
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_xfer *xfer, ehci_qh_t **qh_last)
|
||||
(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_xfer *xfer, ehci_qh_t **qh_last)
|
||||
|
||||
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, usb2_error_t error)
|
||||
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 *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 *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_ctrl_methods =
|
||||
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 *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 *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 *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_intr_methods =
|
||||
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_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
*/
|
||||
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_isoc_fs_methods =
|
||||
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 *xfer)
|
||||
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 *xfer)
|
||||
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 *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;
|
||||
|
||||
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 *xfer)
|
||||
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 *xfer)
|
||||
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;
|
||||
}
|
||||
@ -3537,11 +3537,6 @@ ehci_xfer_setup(struct usb2_setup_params *parm)
|
||||
nsitd = 0;
|
||||
nitd = 0;
|
||||
|
||||
/*
|
||||
* setup xfer
|
||||
*/
|
||||
xfer->usb2_sc = sc;
|
||||
|
||||
/*
|
||||
* compute maximum number of some structures
|
||||
*/
|
||||
@ -3864,7 +3859,7 @@ ehci_device_resume(struct usb2_device *udev)
|
||||
|
||||
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 *udev)
|
||||
|
||||
TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
|
||||
|
||||
if (xfer->udev == udev) {
|
||||
if (xfer->xroot->udev == udev) {
|
||||
|
||||
methods = xfer->pipe->methods;
|
||||
|
||||
|
@ -204,14 +204,14 @@ musbotg_pull_down(struct musbotg_softc *sc)
|
||||
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 *xfer)
|
||||
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_xfer *xfer)
|
||||
|
||||
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_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
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 @@ musbotg_standard_done(struct usb2_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
*/
|
||||
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 *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 *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 *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 *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 *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;
|
||||
}
|
||||
@ -2706,11 +2706,6 @@ musbotg_xfer_setup(struct usb2_setup_params *parm)
|
||||
sc = MUSBOTG_BUS2SC(parm->udev->bus);
|
||||
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
|
||||
|
@ -669,7 +669,7 @@ ohci_transfer_intr_enqueue(struct usb2_xfer *xfer)
|
||||
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_xfer *xfer, ohci_ed_t **ed_last)
|
||||
|
||||
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_xfer *xfer, ohci_ed_t **ed_last)
|
||||
|
||||
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_xfer *xfer, ohci_ed_t **ed_last)
|
||||
|
||||
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 *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 *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_ctrl_methods =
|
||||
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 *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 *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 *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 *xfer)
|
||||
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 *xfer)
|
||||
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 *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;
|
||||
|
||||
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 *xfer)
|
||||
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 *xfer)
|
||||
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 *parm)
|
||||
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 *udev)
|
||||
|
||||
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 *udev)
|
||||
|
||||
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];
|
||||
|
@ -878,7 +878,7 @@ uhci_transfer_intr_enqueue(struct usb2_xfer *xfer)
|
||||
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_xfer *xfer)
|
||||
|
||||
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_xfer *xfer)
|
||||
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, usb2_error_t error)
|
||||
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 *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 *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 *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 *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) {
|
||||
if (xfer->xroot->udev->pwr_save.suspended == 0) {
|
||||
if (xfer->xroot->udev->speed == USB_SPEED_LOW) {
|
||||
UHCI_APPEND_QH(qh, sc->sc_ls_ctl_p_last);
|
||||
} else {
|
||||
UHCI_APPEND_QH(qh, sc->sc_fs_ctl_p_last);
|
||||
@ -1990,7 +1990,7 @@ struct usb2_pipe_methods uhci_device_ctrl_methods =
|
||||
static void
|
||||
uhci_device_intr_open(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
uint16_t best;
|
||||
uint16_t bit;
|
||||
uint16_t x;
|
||||
@ -2023,7 +2023,7 @@ uhci_device_intr_open(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_device_intr_close(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
sc->sc_intr_stat[xfer->qh_pos]--;
|
||||
|
||||
@ -2039,7 +2039,7 @@ uhci_device_intr_enter(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_device_intr_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;
|
||||
|
||||
@ -2052,7 +2052,7 @@ uhci_device_intr_start(struct usb2_xfer *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) {
|
||||
|
||||
/* enter QHs into the controller data structures */
|
||||
UHCI_APPEND_QH(qh, sc->sc_intr_p_last[xfer->qh_pos]);
|
||||
@ -2117,7 +2117,7 @@ static void
|
||||
uhci_device_isoc_enter(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uhci_mem_layout ml;
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
uint32_t nframes;
|
||||
uint32_t temp;
|
||||
uint32_t *plen;
|
||||
@ -2301,7 +2301,7 @@ uhci_root_ctrl_open(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_root_ctrl_close(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
if (sc->sc_root_ctrl.xfer == xfer) {
|
||||
sc->sc_root_ctrl.xfer = NULL;
|
||||
@ -2492,13 +2492,13 @@ uhci_root_ctrl_enter(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_root_ctrl_start(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_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
|
||||
@ -2511,7 +2511,7 @@ static void
|
||||
uhci_root_ctrl_done(struct usb2_xfer *xfer,
|
||||
struct usb2_sw_transfer *std)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
char *ptr;
|
||||
uint16_t x;
|
||||
uint16_t port;
|
||||
@ -2537,7 +2537,7 @@ uhci_root_ctrl_done(struct usb2_xfer *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;
|
||||
|
||||
DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x "
|
||||
"wValue=0x%04x wIndex=0x%04x\n",
|
||||
@ -2866,7 +2866,7 @@ uhci_root_intr_open(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_root_intr_close(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
if (sc->sc_root_intr.xfer == xfer) {
|
||||
sc->sc_root_intr.xfer = NULL;
|
||||
@ -2883,7 +2883,7 @@ uhci_root_intr_enter(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uhci_root_intr_start(struct usb2_xfer *xfer)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
sc->sc_root_intr.xfer = xfer;
|
||||
|
||||
@ -2895,7 +2895,7 @@ static void
|
||||
uhci_root_intr_done(struct usb2_xfer *xfer,
|
||||
struct usb2_sw_transfer *std)
|
||||
{
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
|
||||
|
||||
@ -2921,7 +2921,7 @@ static void
|
||||
uhci_root_intr_check(void *arg)
|
||||
{
|
||||
struct usb2_xfer *xfer = arg;
|
||||
uhci_softc_t *sc = xfer->usb2_sc;
|
||||
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
DPRINTFN(21, "\n");
|
||||
|
||||
@ -2975,11 +2975,6 @@ uhci_xfer_setup(struct usb2_setup_params *parm)
|
||||
sc = UHCI_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 = 0x500;
|
||||
@ -3241,7 +3236,7 @@ uhci_device_resume(struct usb2_device *udev)
|
||||
|
||||
TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
|
||||
|
||||
if (xfer->udev == udev) {
|
||||
if (xfer->xroot->udev == udev) {
|
||||
|
||||
methods = xfer->pipe->methods;
|
||||
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
@ -3252,7 +3247,7 @@ uhci_device_resume(struct usb2_device *udev)
|
||||
xfer->flags_int.bandwidth_reclaimed = 1;
|
||||
}
|
||||
if (methods == &uhci_device_ctrl_methods) {
|
||||
if (xfer->udev->speed == USB_SPEED_LOW) {
|
||||
if (xfer->xroot->udev->speed == USB_SPEED_LOW) {
|
||||
UHCI_APPEND_QH(qh, sc->sc_ls_ctl_p_last);
|
||||
} else {
|
||||
UHCI_APPEND_QH(qh, sc->sc_fs_ctl_p_last);
|
||||
@ -3283,7 +3278,7 @@ uhci_device_suspend(struct usb2_device *udev)
|
||||
|
||||
TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
|
||||
|
||||
if (xfer->udev == udev) {
|
||||
if (xfer->xroot->udev == udev) {
|
||||
|
||||
methods = xfer->pipe->methods;
|
||||
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
@ -3296,7 +3291,7 @@ uhci_device_suspend(struct usb2_device *udev)
|
||||
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);
|
||||
|
@ -825,7 +825,7 @@ uss820dci_setup_standard_chain(struct usb2_xfer *xfer)
|
||||
|
||||
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;
|
||||
|
||||
@ -840,7 +840,7 @@ uss820dci_setup_standard_chain(struct usb2_xfer *xfer)
|
||||
temp.setup_alt_next = xfer->flags_int.short_frames_ok;
|
||||
temp.offset = 0;
|
||||
|
||||
sc = xfer->usb2_sc;
|
||||
sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
ep_no = (xfer->endpoint & UE_ADDR);
|
||||
|
||||
/* check if we should prepend a setup message */
|
||||
@ -949,7 +949,7 @@ uss820dci_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 */
|
||||
uss820dci_device_done(xfer, USB_ERR_TIMEOUT);
|
||||
@ -958,7 +958,7 @@ uss820dci_timeout(void *arg)
|
||||
static void
|
||||
uss820dci_intr_set(struct usb2_xfer *xfer, uint8_t set)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
uint8_t ep_no = (xfer->endpoint & UE_ADDR);
|
||||
uint8_t ep_reg;
|
||||
uint8_t temp;
|
||||
@ -1010,7 +1010,7 @@ uss820dci_start_standard_chain(struct usb2_xfer *xfer)
|
||||
uss820dci_intr_set(xfer, 1);
|
||||
|
||||
/* 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) {
|
||||
@ -1024,7 +1024,7 @@ static void
|
||||
uss820dci_root_intr_done(struct usb2_xfer *xfer,
|
||||
struct usb2_sw_transfer *std)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
DPRINTFN(9, "\n");
|
||||
|
||||
@ -1164,7 +1164,7 @@ uss820dci_standard_done(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_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);
|
||||
@ -1638,7 +1638,7 @@ uss820dci_device_isoc_fs_close(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_device_isoc_fs_enter(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
uint32_t temp;
|
||||
uint32_t nframes;
|
||||
|
||||
@ -1720,7 +1720,7 @@ uss820dci_root_ctrl_open(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_root_ctrl_close(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
if (sc->sc_root_ctrl.xfer == xfer) {
|
||||
sc->sc_root_ctrl.xfer = NULL;
|
||||
@ -1824,11 +1824,11 @@ uss820dci_root_ctrl_enter(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_root_ctrl_start(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_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
|
||||
@ -1841,7 +1841,7 @@ static void
|
||||
uss820dci_root_ctrl_done(struct usb2_xfer *xfer,
|
||||
struct usb2_sw_transfer *std)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
uint16_t value;
|
||||
uint16_t index;
|
||||
uint8_t use_polling;
|
||||
@ -1862,7 +1862,7 @@ uss820dci_root_ctrl_done(struct usb2_xfer *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 */
|
||||
|
||||
@ -2258,7 +2258,7 @@ uss820dci_root_intr_open(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_root_intr_close(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
if (sc->sc_root_intr.xfer == xfer) {
|
||||
sc->sc_root_intr.xfer = NULL;
|
||||
@ -2275,7 +2275,7 @@ uss820dci_root_intr_enter(struct usb2_xfer *xfer)
|
||||
static void
|
||||
uss820dci_root_intr_start(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uss820dci_softc *sc = xfer->usb2_sc;
|
||||
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
|
||||
|
||||
sc->sc_root_intr.xfer = xfer;
|
||||
}
|
||||
@ -2304,11 +2304,6 @@ uss820dci_xfer_setup(struct usb2_setup_params *parm)
|
||||
sc = USS820_DCI_BUS2SC(parm->udev->bus);
|
||||
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
|
||||
|
@ -1226,15 +1226,15 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq)
|
||||
uint32_t nframes;
|
||||
|
||||
xfer = pq->curr;
|
||||
info = xfer->usb2_root;
|
||||
info = xfer->xroot;
|
||||
|
||||
mtx_assert(info->priv_mtx, MA_OWNED);
|
||||
mtx_assert(info->xfer_mtx, MA_OWNED);
|
||||
|
||||
if (xfer->error) {
|
||||
/* some error happened */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
usb2_transfer_done(xfer, 0);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
return;
|
||||
}
|
||||
if (!xfer->flags_int.bdma_setup) {
|
||||
@ -1306,9 +1306,9 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq)
|
||||
|
||||
}
|
||||
if (info->dma_error) {
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
return;
|
||||
}
|
||||
if (info->dma_currframe != info->dma_nframes) {
|
||||
@ -1352,7 +1352,7 @@ usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt)
|
||||
|
||||
info = udpt->info;
|
||||
|
||||
mtx_assert(info->priv_mtx, MA_OWNED);
|
||||
mtx_assert(info->xfer_mtx, MA_OWNED);
|
||||
|
||||
/* copy error */
|
||||
info->dma_error = udpt->dma_error;
|
||||
|
@ -160,9 +160,9 @@
|
||||
#define USB_BUS_LOCK(_b) mtx_lock(&(_b)->bus_mtx)
|
||||
#define USB_BUS_UNLOCK(_b) mtx_unlock(&(_b)->bus_mtx)
|
||||
#define USB_BUS_LOCK_ASSERT(_b, _t) mtx_assert(&(_b)->bus_mtx, _t)
|
||||
#define USB_XFER_LOCK(_x) mtx_lock((_x)->xfer_mtx)
|
||||
#define USB_XFER_UNLOCK(_x) mtx_unlock((_x)->xfer_mtx)
|
||||
#define USB_XFER_LOCK_ASSERT(_x, _t) mtx_assert((_x)->xfer_mtx, _t)
|
||||
#define USB_XFER_LOCK(_x) mtx_lock((_x)->xroot->xfer_mtx)
|
||||
#define USB_XFER_UNLOCK(_x) mtx_unlock((_x)->xroot->xfer_mtx)
|
||||
#define USB_XFER_LOCK_ASSERT(_x, _t) mtx_assert((_x)->xroot->xfer_mtx, _t)
|
||||
/* structure prototypes */
|
||||
|
||||
struct file;
|
||||
@ -307,10 +307,7 @@ struct usb2_xfer {
|
||||
* are waiting on */
|
||||
struct usb2_page *dma_page_ptr;
|
||||
struct usb2_pipe *pipe; /* our USB pipe */
|
||||
struct usb2_device *udev;
|
||||
struct mtx *xfer_mtx; /* cannot be changed during operation */
|
||||
struct usb2_xfer_root *usb2_root; /* used by HC driver */
|
||||
void *usb2_sc; /* used by HC driver */
|
||||
struct usb2_xfer_root *xroot; /* used by HC driver */
|
||||
void *qh_start[2]; /* used by HC driver */
|
||||
void *td_start[2]; /* used by HC driver */
|
||||
void *td_transfer_first; /* used by HC driver */
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <dev/usb2/core/usb2_debug.h>
|
||||
#include <dev/usb2/core/usb2_process.h>
|
||||
#include <dev/usb2/core/usb2_device.h>
|
||||
#include <dev/usb2/core/usb2_busdma.h>
|
||||
#include <dev/usb2/core/usb2_transfer.h>
|
||||
|
||||
/*
|
||||
* Define this unconditionally in case a kernel module is loaded that
|
||||
@ -128,6 +130,7 @@ usb2_dump_pipe(struct usb2_pipe *pipe)
|
||||
void
|
||||
usb2_dump_xfer(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct usb2_device *udev;
|
||||
printf("usb2_dump_xfer: xfer=%p\n", xfer);
|
||||
if (xfer == NULL) {
|
||||
return;
|
||||
@ -137,12 +140,13 @@ usb2_dump_xfer(struct usb2_xfer *xfer)
|
||||
xfer);
|
||||
return;
|
||||
}
|
||||
udev = xfer->xroot->udev;
|
||||
printf("xfer %p: udev=%p vid=0x%04x pid=0x%04x addr=%d "
|
||||
"pipe=%p ep=0x%02x attr=0x%02x\n",
|
||||
xfer, xfer->udev,
|
||||
UGETW(xfer->udev->ddesc.idVendor),
|
||||
UGETW(xfer->udev->ddesc.idProduct),
|
||||
xfer->udev->address, xfer->pipe,
|
||||
xfer, udev,
|
||||
UGETW(udev->ddesc.idVendor),
|
||||
UGETW(udev->ddesc.idProduct),
|
||||
udev->address, xfer->pipe,
|
||||
xfer->pipe->edesc->bEndpointAddress,
|
||||
xfer->pipe->edesc->bmAttributes);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ usb2_handle_request_callback(struct usb2_xfer *xfer)
|
||||
|
||||
if (err == USB_ERR_BAD_CONTEXT) {
|
||||
/* we need to re-setup the control transfer */
|
||||
usb2_needs_explore(xfer->udev->bus, 0);
|
||||
usb2_needs_explore(xfer->xroot->bus, 0);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -126,6 +126,7 @@ usb2_handle_request_callback(struct usb2_xfer *xfer)
|
||||
static usb2_error_t
|
||||
usb2_handle_set_config(struct usb2_xfer *xfer, uint8_t conf_no)
|
||||
{
|
||||
struct usb2_device *udev = xfer->xroot->udev;
|
||||
usb2_error_t err = 0;
|
||||
|
||||
/*
|
||||
@ -134,7 +135,7 @@ usb2_handle_set_config(struct usb2_xfer *xfer, uint8_t conf_no)
|
||||
*/
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
mtx_lock(&Giant); /* XXX */
|
||||
sx_xlock(xfer->udev->default_sx + 1);
|
||||
sx_xlock(udev->default_sx + 1);
|
||||
|
||||
if (conf_no == USB_UNCONFIG_NO) {
|
||||
conf_no = USB_UNCONFIG_INDEX;
|
||||
@ -146,19 +147,19 @@ usb2_handle_set_config(struct usb2_xfer *xfer, uint8_t conf_no)
|
||||
conf_no--;
|
||||
}
|
||||
|
||||
if (usb2_set_config_index(xfer->udev, conf_no)) {
|
||||
if (usb2_set_config_index(udev, conf_no)) {
|
||||
DPRINTF("set config %d failed\n", conf_no);
|
||||
err = USB_ERR_STALLED;
|
||||
goto done;
|
||||
}
|
||||
if (usb2_probe_and_attach(xfer->udev, USB_IFACE_INDEX_ANY)) {
|
||||
if (usb2_probe_and_attach(udev, USB_IFACE_INDEX_ANY)) {
|
||||
DPRINTF("probe and attach failed\n");
|
||||
err = USB_ERR_STALLED;
|
||||
goto done;
|
||||
}
|
||||
done:
|
||||
mtx_unlock(&Giant); /* XXX */
|
||||
sx_unlock(xfer->udev->default_sx + 1);
|
||||
sx_unlock(udev->default_sx + 1);
|
||||
USB_XFER_LOCK(xfer);
|
||||
return (err);
|
||||
}
|
||||
@ -177,7 +178,7 @@ usb2_handle_iface_request(struct usb2_xfer *xfer,
|
||||
{
|
||||
struct usb2_interface *iface;
|
||||
struct usb2_interface *iface_parent; /* parent interface */
|
||||
struct usb2_device *udev = xfer->udev;
|
||||
struct usb2_device *udev = xfer->xroot->udev;
|
||||
int error;
|
||||
uint8_t iface_index;
|
||||
|
||||
@ -332,11 +333,12 @@ usb2_handle_iface_request(struct usb2_xfer *xfer,
|
||||
static usb2_error_t
|
||||
usb2_handle_set_stall(struct usb2_xfer *xfer, uint8_t ep, uint8_t do_stall)
|
||||
{
|
||||
struct usb2_device *udev = xfer->xroot->udev;
|
||||
usb2_error_t err;
|
||||
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
err = usb2_set_endpoint_stall(xfer->udev,
|
||||
usb2_get_pipe_by_addr(xfer->udev, ep), do_stall);
|
||||
err = usb2_set_endpoint_stall(udev,
|
||||
usb2_get_pipe_by_addr(udev, ep), do_stall);
|
||||
USB_XFER_LOCK(xfer);
|
||||
return (err);
|
||||
}
|
||||
@ -379,7 +381,7 @@ usb2_handle_remote_wakeup(struct usb2_xfer *xfer, uint8_t is_on)
|
||||
struct usb2_device *udev;
|
||||
struct usb2_bus *bus;
|
||||
|
||||
udev = xfer->udev;
|
||||
udev = xfer->xroot->udev;
|
||||
bus = udev->bus;
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
@ -479,7 +481,7 @@ usb2_handle_request(struct usb2_xfer *xfer)
|
||||
max_len = 0;
|
||||
src_zcopy = NULL;
|
||||
src_mcopy = NULL;
|
||||
udev = xfer->udev;
|
||||
udev = xfer->xroot->udev;
|
||||
|
||||
/* get some request fields decoded */
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ usb2_transfer_power_ref(struct usb2_xfer *xfer, int val)
|
||||
uint8_t needs_hw_power;
|
||||
uint8_t xfer_type;
|
||||
|
||||
udev = xfer->udev;
|
||||
udev = xfer->xroot->udev;
|
||||
|
||||
if (udev->device_index == USB_ROOT_HUB_ADDR) {
|
||||
/* no power save for root HUB */
|
||||
|
@ -80,7 +80,7 @@ usb2_do_request_callback(struct usb2_xfer *xfer)
|
||||
usb2_start_hardware(xfer);
|
||||
break;
|
||||
default:
|
||||
usb2_cv_signal(xfer->udev->default_cv);
|
||||
usb2_cv_signal(xfer->xroot->udev->default_cv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -94,18 +94,21 @@ void
|
||||
usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct usb2_device_request req;
|
||||
struct usb2_device *udev;
|
||||
struct usb2_pipe *pipe;
|
||||
struct usb2_pipe *pipe_end;
|
||||
struct usb2_pipe *pipe_first;
|
||||
uint8_t to = USB_EP_MAX;
|
||||
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
udev = xfer->xroot->udev;
|
||||
|
||||
USB_BUS_LOCK(udev->bus);
|
||||
|
||||
/* round robin pipe clear stall */
|
||||
|
||||
pipe = xfer->udev->pipe_curr;
|
||||
pipe_end = xfer->udev->pipes + USB_EP_MAX;
|
||||
pipe_first = xfer->udev->pipes;
|
||||
pipe = udev->pipe_curr;
|
||||
pipe_end = udev->pipes + USB_EP_MAX;
|
||||
pipe_first = udev->pipes;
|
||||
if (pipe == NULL) {
|
||||
pipe = pipe_first;
|
||||
}
|
||||
@ -145,11 +148,11 @@ usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
/* set length */
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->nframes = 1;
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(udev->bus);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(udev->bus);
|
||||
break;
|
||||
}
|
||||
pipe++;
|
||||
@ -165,8 +168,8 @@ usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
|
||||
/* store current pipe */
|
||||
xfer->udev->pipe_curr = pipe;
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
udev->pipe_curr = pipe;
|
||||
USB_BUS_UNLOCK(udev->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -367,7 +370,8 @@ usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx,
|
||||
}
|
||||
if (temp > 0) {
|
||||
usb2_pause_mtx(
|
||||
xfer->xfer_mtx, temp);
|
||||
xfer->xroot->xfer_mtx,
|
||||
temp);
|
||||
}
|
||||
#endif
|
||||
xfer->flags.manual_status = 0;
|
||||
@ -384,8 +388,8 @@ usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx,
|
||||
if ((flags & USB_USE_POLLING) || cold) {
|
||||
usb2_do_poll(udev->default_xfer, USB_DEFAULT_XFER_MAX);
|
||||
} else {
|
||||
usb2_cv_wait(xfer->udev->default_cv,
|
||||
xfer->xfer_mtx);
|
||||
usb2_cv_wait(udev->default_cv,
|
||||
xfer->xroot->xfer_mtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,12 +243,12 @@ usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm,
|
||||
for (x = 0; x != n_dma_pc; x++) {
|
||||
/* need to initialize the page cache */
|
||||
parm->dma_page_cache_ptr[x].tag_parent =
|
||||
&parm->curr_xfer->usb2_root->dma_parent_tag;
|
||||
&parm->curr_xfer->xroot->dma_parent_tag;
|
||||
}
|
||||
for (x = 0; x != count; x++) {
|
||||
/* need to initialize the page cache */
|
||||
parm->xfer_page_cache_ptr[x].tag_parent =
|
||||
&parm->curr_xfer->usb2_root->dma_parent_tag;
|
||||
&parm->curr_xfer->xroot->dma_parent_tag;
|
||||
}
|
||||
|
||||
if (ppc) {
|
||||
@ -670,7 +670,7 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
|
||||
if (parm->buf) {
|
||||
for (x = 0; x != n_frbuffers; x++) {
|
||||
xfer->frbuffers[x].tag_parent =
|
||||
&xfer->usb2_root->dma_parent_tag;
|
||||
&xfer->xroot->dma_parent_tag;
|
||||
|
||||
if (xfer->flags_int.bdma_enable &&
|
||||
(parm->bufsize_max > 0)) {
|
||||
@ -715,7 +715,7 @@ usb2_error_t
|
||||
usb2_transfer_setup(struct usb2_device *udev,
|
||||
const uint8_t *ifaces, struct usb2_xfer **ppxfer,
|
||||
const struct usb2_config *setup_start, uint16_t n_setup,
|
||||
void *priv_sc, struct mtx *priv_mtx)
|
||||
void *priv_sc, struct mtx *xfer_mtx)
|
||||
{
|
||||
struct usb2_xfer dummy;
|
||||
struct usb2_setup_params parm;
|
||||
@ -745,9 +745,9 @@ usb2_transfer_setup(struct usb2_device *udev,
|
||||
DPRINTFN(6, "ifaces array is NULL!\n");
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
if (priv_mtx == NULL) {
|
||||
if (xfer_mtx == NULL) {
|
||||
DPRINTFN(6, "using global lock\n");
|
||||
priv_mtx = &Giant;
|
||||
xfer_mtx = &Giant;
|
||||
}
|
||||
/* sanity checks */
|
||||
for (setup = setup_start, n = 0;
|
||||
@ -799,13 +799,14 @@ usb2_transfer_setup(struct usb2_device *udev,
|
||||
|
||||
usb2_cv_init(&info->cv_drain, "WDRAIN");
|
||||
|
||||
info->priv_mtx = priv_mtx;
|
||||
info->xfer_mtx = xfer_mtx;
|
||||
|
||||
usb2_dma_tag_setup(&info->dma_parent_tag,
|
||||
parm.dma_tag_p, udev->bus->dma_parent_tag[0].tag,
|
||||
priv_mtx, &usb2_bdma_done_event, info, 32, parm.dma_tag_max);
|
||||
xfer_mtx, &usb2_bdma_done_event, info, 32, parm.dma_tag_max);
|
||||
|
||||
info->bus = udev->bus;
|
||||
info->udev = udev;
|
||||
|
||||
TAILQ_INIT(&info->done_q.head);
|
||||
info->done_q.command = &usb2_callback_wrapper;
|
||||
@ -814,9 +815,9 @@ usb2_transfer_setup(struct usb2_device *udev,
|
||||
info->dma_q.command = &usb2_bdma_work_loop;
|
||||
|
||||
info->done_m[0].hdr.pm_callback = &usb2_callback_proc;
|
||||
info->done_m[0].usb2_root = info;
|
||||
info->done_m[0].xroot = info;
|
||||
info->done_m[1].hdr.pm_callback = &usb2_callback_proc;
|
||||
info->done_m[1].usb2_root = info;
|
||||
info->done_m[1].xroot = info;
|
||||
|
||||
/* create a callback thread */
|
||||
|
||||
@ -871,11 +872,9 @@ usb2_transfer_setup(struct usb2_device *udev,
|
||||
xfer = USB_ADD_BYTES(buf, parm.size[0]);
|
||||
|
||||
ppxfer[n] = xfer;
|
||||
xfer->udev = udev;
|
||||
xfer->address = udev->address;
|
||||
xfer->priv_sc = priv_sc;
|
||||
xfer->xfer_mtx = priv_mtx;
|
||||
xfer->usb2_root = info;
|
||||
xfer->xroot = info;
|
||||
info->setup_refcount++;
|
||||
|
||||
usb2_callout_init_mtx(&xfer->timeout_handle,
|
||||
@ -1100,7 +1099,7 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup)
|
||||
if (xfer) {
|
||||
if (xfer->pipe) {
|
||||
USB_XFER_LOCK(xfer);
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
/*
|
||||
* HINT: when you start/stop a transfer, it
|
||||
@ -1112,7 +1111,7 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup)
|
||||
*
|
||||
* That way, if your code has many parts that
|
||||
* will not stop running under the same
|
||||
* lock, in other words "priv_mtx", the
|
||||
* lock, in other words "xfer_mtx", the
|
||||
* usb2_transfer_start and
|
||||
* usb2_transfer_stop functions will simply
|
||||
* return when they detect a NULL pointer
|
||||
@ -1124,7 +1123,7 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup)
|
||||
*/
|
||||
pxfer[n_setup] = NULL;
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
|
||||
usb2_transfer_drain(xfer);
|
||||
@ -1145,8 +1144,8 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup)
|
||||
|
||||
usb2_callout_drain(&xfer->timeout_handle);
|
||||
|
||||
if (xfer->usb2_root) {
|
||||
info = xfer->usb2_root;
|
||||
if (xfer->xroot) {
|
||||
info = xfer->xroot;
|
||||
|
||||
USB_BUS_LOCK(info->bus);
|
||||
|
||||
@ -1349,16 +1348,16 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
|
||||
#if USB_DEBUG
|
||||
if (USB_DEBUG_VAR > 0) {
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
usb2_dump_pipe(xfer->pipe);
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
#endif
|
||||
|
||||
USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_NOTOWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED);
|
||||
|
||||
/* Only open the USB transfer once! */
|
||||
if (!xfer->flags_int.open) {
|
||||
@ -1366,9 +1365,9 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
|
||||
DPRINTF("open\n");
|
||||
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
(xfer->pipe->methods->open) (xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
/* set "transferring" flag */
|
||||
xfer->flags_int.transferring = 1;
|
||||
@ -1381,9 +1380,9 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
* frequently the "done_q":
|
||||
*/
|
||||
if (xfer->wait_queue) {
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
usb2_transfer_dequeue(xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
/* clear "did_dma_delay" flag */
|
||||
xfer->flags_int.did_dma_delay = 0;
|
||||
@ -1415,16 +1414,16 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
*/
|
||||
DPRINTF("xfer=%p nframes=0: stall "
|
||||
"or clear stall!\n", xfer);
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
/* start the transfer */
|
||||
usb2_command_wrapper(&xfer->pipe->pipe_q, xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
usb2_transfer_done(xfer, USB_ERR_INVAL);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
/* compute total transfer length */
|
||||
@ -1433,9 +1432,9 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
xfer->sumlen += xfer->frlengths[x];
|
||||
if (xfer->sumlen < xfer->frlengths[x]) {
|
||||
/* length wrapped around */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
usb2_transfer_done(xfer, USB_ERR_INVAL);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1450,9 +1449,9 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
if (xfer->flags_int.control_xfr) {
|
||||
|
||||
if (usb2_start_hardware_sub(xfer)) {
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
usb2_transfer_done(xfer, USB_ERR_STALLED);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1488,7 +1487,7 @@ usb2_start_hardware(struct usb2_xfer *xfer)
|
||||
*/
|
||||
if (xfer->flags_int.bdma_enable) {
|
||||
/* insert the USB transfer last in the BUS-DMA queue */
|
||||
usb2_command_wrapper(&xfer->usb2_root->dma_q, xfer);
|
||||
usb2_command_wrapper(&xfer->xroot->dma_q, xfer);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
@ -1508,7 +1507,7 @@ usb2_pipe_enter(struct usb2_xfer *xfer)
|
||||
|
||||
USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
|
||||
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
pipe = xfer->pipe;
|
||||
|
||||
@ -1524,7 +1523,7 @@ usb2_pipe_enter(struct usb2_xfer *xfer)
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -1533,7 +1532,7 @@ usb2_pipe_enter(struct usb2_xfer *xfer)
|
||||
|
||||
/* start the transfer */
|
||||
usb2_command_wrapper(&pipe->pipe_q, xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1562,10 +1561,10 @@ usb2_transfer_start(struct usb2_xfer *xfer)
|
||||
if (xfer->flags_int.transferring) {
|
||||
return;
|
||||
}
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
/* call the USB transfer callback */
|
||||
usb2_callback_ss_done_defer(xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1596,7 +1595,7 @@ usb2_transfer_stop(struct usb2_xfer *xfer)
|
||||
}
|
||||
/* try to stop the current USB transfer */
|
||||
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
xfer->error = USB_ERR_CANCELLED;/* override any previous error */
|
||||
/*
|
||||
* Clear "open" and "started" when both private and USB lock
|
||||
@ -1648,7 +1647,7 @@ usb2_transfer_stop(struct usb2_xfer *xfer)
|
||||
}
|
||||
}
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1672,22 +1671,22 @@ usb2_transfer_pending(struct usb2_xfer *xfer)
|
||||
/* trivial case */
|
||||
return (1);
|
||||
}
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
if (xfer->wait_queue) {
|
||||
/* we are waiting on a queue somewhere */
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return (1);
|
||||
}
|
||||
info = xfer->usb2_root;
|
||||
info = xfer->xroot;
|
||||
pq = &info->done_q;
|
||||
|
||||
if (pq->curr == xfer) {
|
||||
/* we are currently scheduled for callback */
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return (1);
|
||||
}
|
||||
/* we are not pending */
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1709,7 +1708,7 @@ usb2_transfer_drain(struct usb2_xfer *xfer)
|
||||
/* transfer is gone */
|
||||
return;
|
||||
}
|
||||
if (xfer->xfer_mtx != &Giant) {
|
||||
if (xfer->xroot->xfer_mtx != &Giant) {
|
||||
USB_XFER_LOCK_ASSERT(xfer, MA_NOTOWNED);
|
||||
}
|
||||
USB_XFER_LOCK(xfer);
|
||||
@ -1722,7 +1721,7 @@ usb2_transfer_drain(struct usb2_xfer *xfer)
|
||||
* Wait until the current outstanding USB
|
||||
* transfer is complete !
|
||||
*/
|
||||
usb2_cv_wait(&xfer->usb2_root->cv_drain, xfer->xfer_mtx);
|
||||
usb2_cv_wait(&xfer->xroot->cv_drain, xfer->xroot->xfer_mtx);
|
||||
}
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
}
|
||||
@ -1769,7 +1768,7 @@ static void
|
||||
usb2_callback_proc(struct usb2_proc_msg *_pm)
|
||||
{
|
||||
struct usb2_done_msg *pm = (void *)_pm;
|
||||
struct usb2_xfer_root *info = pm->usb2_root;
|
||||
struct usb2_xfer_root *info = pm->xroot;
|
||||
|
||||
/* Change locking order */
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
@ -1778,14 +1777,14 @@ usb2_callback_proc(struct usb2_proc_msg *_pm)
|
||||
* We exploit the fact that the mutex is the same for all
|
||||
* callbacks that will be called from this thread:
|
||||
*/
|
||||
mtx_lock(info->priv_mtx);
|
||||
mtx_lock(info->xfer_mtx);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
|
||||
/* Continue where we lost track */
|
||||
usb2_command_wrapper(&info->done_q,
|
||||
info->done_q.curr);
|
||||
|
||||
mtx_unlock(info->priv_mtx);
|
||||
mtx_unlock(info->xfer_mtx);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1797,10 +1796,10 @@ usb2_callback_proc(struct usb2_proc_msg *_pm)
|
||||
static void
|
||||
usb2_callback_ss_done_defer(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct usb2_xfer_root *info = xfer->usb2_root;
|
||||
struct usb2_xfer_root *info = xfer->xroot;
|
||||
struct usb2_xfer_queue *pq = &info->done_q;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
if (pq->curr != xfer) {
|
||||
usb2_transfer_enqueue(pq, xfer);
|
||||
@ -1836,10 +1835,10 @@ static void
|
||||
usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
{
|
||||
struct usb2_xfer *xfer = pq->curr;
|
||||
struct usb2_xfer_root *info = xfer->usb2_root;
|
||||
struct usb2_xfer_root *info = xfer->xroot;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
if (!mtx_owned(xfer->xfer_mtx)) {
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
if (!mtx_owned(xfer->xroot->xfer_mtx)) {
|
||||
/*
|
||||
* Cases that end up here:
|
||||
*
|
||||
@ -1870,22 +1869,22 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
/* get next USB transfer in the queue */
|
||||
info->done_q.curr = NULL;
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_NOTOWNED);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED);
|
||||
|
||||
/* set correct USB state for callback */
|
||||
if (!xfer->flags_int.transferring) {
|
||||
xfer->usb2_state = USB_ST_SETUP;
|
||||
if (!xfer->flags_int.started) {
|
||||
/* we got stopped before we even got started */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (usb2_callback_wrapper_sub(xfer)) {
|
||||
/* the callback has been deferred */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
goto done;
|
||||
}
|
||||
/* decrement power reference */
|
||||
@ -1911,7 +1910,7 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
(xfer->callback) (xfer);
|
||||
|
||||
/* pickup the USB mutex again */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
/*
|
||||
* Check if we got started after that we got cancelled, but
|
||||
@ -1933,7 +1932,7 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
(!xfer->flags_int.transferring)) {
|
||||
/* "usb2_transfer_drain()" is waiting for end of transfer */
|
||||
xfer->flags_int.draining = 0;
|
||||
usb2_cv_broadcast(&xfer->usb2_root->cv_drain);
|
||||
usb2_cv_broadcast(&xfer->xroot->cv_drain);
|
||||
}
|
||||
|
||||
/* do the next callback, if any */
|
||||
@ -1954,7 +1953,7 @@ usb2_dma_delay_done_cb(void *arg)
|
||||
{
|
||||
struct usb2_xfer *xfer = arg;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
DPRINTFN(3, "Completed %p\n", xfer);
|
||||
|
||||
@ -2019,7 +2018,7 @@ usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
{
|
||||
struct usb2_xfer_queue *pq;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
DPRINTF("err=%s\n", usb2_errstr(error));
|
||||
|
||||
@ -2045,12 +2044,12 @@ usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
*/
|
||||
usb2_transfer_dequeue(xfer);
|
||||
|
||||
if (mtx_owned(xfer->xfer_mtx)) {
|
||||
if (mtx_owned(xfer->xroot->xfer_mtx)) {
|
||||
/*
|
||||
* If the private USB lock is not locked, then we assume
|
||||
* that the BUS-DMA load stage has been passed:
|
||||
*/
|
||||
pq = &xfer->usb2_root->dma_q;
|
||||
pq = &xfer->xroot->dma_q;
|
||||
|
||||
if (pq->curr == xfer) {
|
||||
/* start the next BUS-DMA load, if any */
|
||||
@ -2059,10 +2058,10 @@ usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
}
|
||||
/* keep some statistics */
|
||||
if (xfer->error) {
|
||||
xfer->udev->bus->stats_err.uds_requests
|
||||
xfer->xroot->bus->stats_err.uds_requests
|
||||
[xfer->pipe->edesc->bmAttributes & UE_XFERTYPE]++;
|
||||
} else {
|
||||
xfer->udev->bus->stats_ok.uds_requests
|
||||
xfer->xroot->bus->stats_ok.uds_requests
|
||||
[xfer->pipe->edesc->bmAttributes & UE_XFERTYPE]++;
|
||||
}
|
||||
|
||||
@ -2083,7 +2082,7 @@ usb2_transfer_start_cb(void *arg)
|
||||
struct usb2_xfer *xfer = arg;
|
||||
struct usb2_pipe *pipe = xfer->pipe;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
DPRINTF("start\n");
|
||||
|
||||
@ -2118,11 +2117,11 @@ usb2_transfer_set_stall(struct usb2_xfer *xfer)
|
||||
USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
|
||||
|
||||
/* avoid any races by locking the USB mutex */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
xfer->flags.stall_pipe = 1;
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2141,11 +2140,11 @@ usb2_transfer_clear_stall(struct usb2_xfer *xfer)
|
||||
USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
|
||||
|
||||
/* avoid any races by locking the USB mutex */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
|
||||
xfer->flags.stall_pipe = 0;
|
||||
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2163,7 +2162,7 @@ usb2_pipe_start(struct usb2_xfer_queue *pq)
|
||||
xfer = pq->curr;
|
||||
pipe = xfer->pipe;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
/*
|
||||
* If the pipe is already stalled we do nothing !
|
||||
@ -2187,14 +2186,15 @@ usb2_pipe_start(struct usb2_xfer_queue *pq)
|
||||
struct usb2_device *udev;
|
||||
struct usb2_xfer_root *info;
|
||||
|
||||
udev = xfer->udev;
|
||||
info = xfer->xroot;
|
||||
udev = info->udev;
|
||||
pipe->is_stalled = 1;
|
||||
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
(udev->bus->methods->set_stall) (
|
||||
udev, NULL, pipe);
|
||||
} else if (udev->default_xfer[1]) {
|
||||
info = udev->default_xfer[1]->usb2_root;
|
||||
info = udev->default_xfer[1]->xroot;
|
||||
if (usb2_proc_msignal(&info->done_p,
|
||||
&udev->cs_msg[0], &udev->cs_msg[1])) {
|
||||
/* ignore */
|
||||
@ -2265,7 +2265,7 @@ void
|
||||
usb2_transfer_timeout_ms(struct usb2_xfer *xfer,
|
||||
void (*cb) (void *arg), uint32_t ms)
|
||||
{
|
||||
USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
|
||||
/* defer delay */
|
||||
usb2_callout_reset(&xfer->timeout_handle,
|
||||
@ -2298,9 +2298,9 @@ usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
|
||||
if ((!xfer->flags_int.open) &&
|
||||
(!xfer->flags_int.did_close)) {
|
||||
DPRINTF("close\n");
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
(xfer->pipe->methods->close) (xfer);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
/* only close once */
|
||||
xfer->flags_int.did_close = 1;
|
||||
return (1); /* wait for new callback */
|
||||
@ -2321,16 +2321,16 @@ usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
|
||||
/* we can not cancel this delay */
|
||||
xfer->flags_int.can_cancel_immed = 0;
|
||||
|
||||
temp = usb2_get_dma_delay(xfer->udev->bus);
|
||||
temp = usb2_get_dma_delay(xfer->xroot->bus);
|
||||
|
||||
DPRINTFN(3, "DMA delay, %u ms, "
|
||||
"on %p\n", temp, xfer);
|
||||
|
||||
if (temp != 0) {
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
&usb2_dma_delay_done_cb, temp);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return (1); /* wait for new callback */
|
||||
}
|
||||
}
|
||||
@ -2422,7 +2422,7 @@ usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
|
||||
* If the current USB transfer is completing we need to start the
|
||||
* next one:
|
||||
*/
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
if (pipe->pipe_q.curr == xfer) {
|
||||
usb2_command_wrapper(&pipe->pipe_q, NULL);
|
||||
|
||||
@ -2434,7 +2434,7 @@ usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
|
||||
xfer->pipe->is_synced = 0;
|
||||
}
|
||||
}
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
done:
|
||||
return (0);
|
||||
}
|
||||
@ -2637,7 +2637,7 @@ usb2_clear_stall_callback(struct usb2_xfer *xfer1,
|
||||
* "ata-usb.c" depends on this)
|
||||
*/
|
||||
|
||||
usb2_clear_data_toggle(xfer2->udev, xfer2->pipe);
|
||||
usb2_clear_data_toggle(xfer2->xroot->udev, xfer2->pipe);
|
||||
|
||||
/* setup a clear-stall packet */
|
||||
|
||||
@ -2730,7 +2730,7 @@ void
|
||||
usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max)
|
||||
{
|
||||
struct usb2_xfer *xfer;
|
||||
struct usb2_xfer_root *usb2_root;
|
||||
struct usb2_xfer_root *xroot;
|
||||
struct usb2_device *udev;
|
||||
struct usb2_proc_msg *pm;
|
||||
uint32_t to;
|
||||
@ -2744,8 +2744,8 @@ usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max)
|
||||
for (n = 0; n != max; n++) {
|
||||
xfer = ppxfer[n];
|
||||
if (xfer) {
|
||||
usb2_root = xfer->usb2_root;
|
||||
udev = xfer->udev;
|
||||
xroot = xfer->xroot;
|
||||
udev = xroot->udev;
|
||||
|
||||
/*
|
||||
* Poll hardware - signal that we are polling by
|
||||
@ -2756,10 +2756,10 @@ usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max)
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
|
||||
/* poll clear stall start */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
pm = &udev->cs_msg[0].hdr;
|
||||
(pm->pm_callback) (pm);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
|
||||
if (udev->default_xfer[1]) {
|
||||
|
||||
@ -2767,20 +2767,20 @@ usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max)
|
||||
usb2_callout_poll(udev->default_xfer[1]);
|
||||
|
||||
/* poll clear stall done thread */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
pm = &udev->default_xfer[1]->
|
||||
usb2_root->done_m[0].hdr;
|
||||
xroot->done_m[0].hdr;
|
||||
(pm->pm_callback) (pm);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
/* poll timeout */
|
||||
usb2_callout_poll(xfer);
|
||||
|
||||
/* poll done thread */
|
||||
USB_BUS_LOCK(xfer->udev->bus);
|
||||
pm = &usb2_root->done_m[0].hdr;
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
pm = &xroot->done_m[0].hdr;
|
||||
(pm->pm_callback) (pm);
|
||||
USB_BUS_UNLOCK(xfer->udev->bus);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
struct usb2_done_msg {
|
||||
struct usb2_proc_msg hdr;
|
||||
struct usb2_xfer_root *usb2_root;
|
||||
struct usb2_xfer_root *xroot;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -46,17 +46,17 @@ struct usb2_xfer_root {
|
||||
struct usb2_xfer_queue done_q;
|
||||
struct usb2_done_msg done_m[2];
|
||||
struct cv cv_drain;
|
||||
|
||||
struct usb2_dma_parent_tag dma_parent_tag;
|
||||
|
||||
struct usb2_process done_p;
|
||||
|
||||
void *memory_base;
|
||||
struct mtx *priv_mtx;
|
||||
struct mtx *xfer_mtx; /* cannot be changed during operation */
|
||||
struct usb2_page_cache *dma_page_cache_start;
|
||||
struct usb2_page_cache *dma_page_cache_end;
|
||||
struct usb2_page_cache *xfer_page_cache_start;
|
||||
struct usb2_page_cache *xfer_page_cache_end;
|
||||
struct usb2_bus *bus;
|
||||
struct usb2_bus *bus; /* pointer to USB bus (cached) */
|
||||
struct usb2_device *udev; /* pointer to USB device */
|
||||
|
||||
uint32_t memory_size;
|
||||
uint32_t setup_refcount;
|
||||
|
@ -339,9 +339,9 @@ uvscom_attach(device_t dev)
|
||||
goto detach;
|
||||
}
|
||||
/* start interrupt pipe */
|
||||
USB_XFER_LOCK(sc->sc_xfer[4]);
|
||||
mtx_lock(&Giant);
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
USB_XFER_UNLOCK(sc->sc_xfer[4]);
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
return (0);
|
||||
|
||||
|
@ -773,11 +773,12 @@ atausb2_t_bbb_status_callback(struct usb2_xfer *xfer)
|
||||
|
||||
sc->ata_request = NULL;
|
||||
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
/* drop the USB transfer lock while doing the ATA interrupt */
|
||||
mtx_unlock(&sc->locked_mtx);
|
||||
|
||||
ata_interrupt(device_get_softc(request->parent));
|
||||
|
||||
USB_XFER_LOCK(xfer);
|
||||
mtx_lock(&sc->locked_mtx);
|
||||
return;
|
||||
|
||||
case USB_ST_SETUP:
|
||||
|
Loading…
Reference in New Issue
Block a user