PERFORCE change 163396 for review
Andrew Thompson
thompsa at FreeBSD.org
Wed Jun 3 03:58:14 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163396
Change 163396 by thompsa at thompsa_burger on 2009/06/03 03:57:28
Checkpoint WIP. Not much more than variable renames.
Affected files ...
.. //depot/projects/usb_buf/src/sys/dev/usb/controller/ehci.c#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_busdma.c#6 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_busdma.h#4 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_controller.h#6 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_core.h#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_debug.c#6 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_debug.h#5 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_dev.h#4 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_device.c#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_device.h#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_generic.c#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_handle_request.c#5 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_hub.c#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_msctest.c#4 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_request.c#8 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.c#7 edit
.. //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.h#6 edit
Differences ...
==== //depot/projects/usb_buf/src/sys/dev/usb/controller/ehci.c#7 (text+ko) ====
@@ -70,7 +70,7 @@
((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
#if USB_DEBUG
-static int ehcidebug = 0;
+static int ehcidebug = 100;
static int ehcinohighspeed = 0;
SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci");
@@ -94,8 +94,8 @@
extern struct usb_pipe_methods ehci_device_isoc_hs_methods;
static void ehci_do_poll(struct usb_bus *bus);
-static void ehci_device_done(struct usb_xfer *xfer, usb_error_t error);
-static uint8_t ehci_check_transfer(struct usb_xfer *xfer);
+static void ehci_device_done(struct usb_urb *urb, usb_error_t error);
+static uint8_t ehci_check_transfer(struct usb_urb *urb);
static void ehci_timeout(void *arg);
static void ehci_root_intr(ehci_softc_t *sc);
@@ -952,18 +952,20 @@
#endif
static void
-ehci_transfer_intr_enqueue(struct usb_xfer *xfer)
+ehci_transfer_intr_enqueue(struct usb_urb *urb)
{
+ struct usb_pipe *pipe = urb->ub_pipe;
+
/* check for early completion */
- if (ehci_check_transfer(xfer)) {
+ if (ehci_check_transfer(urb)) {
return;
}
/* put transfer on interrupt queue */
- usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
+ usb2_transfer_enqueue(&pipe->xroot->bus->intr_q, urb);
/* start timeout, if any */
- if (xfer->timeout != 0) {
- usb2_transfer_timeout_ms(xfer, &ehci_timeout, xfer->timeout);
+ if (urb->timeout != 0) {
+ usb2_transfer_timeout_ms(urb, &ehci_timeout, urb->timeout);
}
}
@@ -1121,19 +1123,20 @@
}
static usb_error_t
-ehci_non_isoc_done_sub(struct usb_xfer *xfer)
+ehci_non_isoc_done_sub(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ ehci_softc_t *sc = EHCI_BUS2SC(urb->ub_pipe->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
ehci_qtd_t *td;
ehci_qtd_t *td_alt_next;
uint32_t status;
uint16_t len;
- td = xfer->td_transfer_cache;
+ td = urb->td_transfer_cache;
td_alt_next = td->alt_next;
- if (xfer->aframes != xfer->nframes) {
- xfer->frlengths[xfer->aframes] = 0;
+ if (urb->aframes != urb->nframes) {
+ urb->frlengths[urb->aframes] = 0;
}
while (1) {
@@ -1151,11 +1154,11 @@
DPRINTF("Invalid status length, "
"0x%04x/0x%04x bytes\n", len, td->len);
status |= EHCI_QTD_HALTED;
- } else if (xfer->aframes != xfer->nframes) {
- xfer->frlengths[xfer->aframes] += td->len - len;
+ } else if (urb->aframes != urb->nframes) {
+ urb->frlengths[urb->aframes] += td->len - len;
}
/* Check for last transfer */
- if (((void *)td) == xfer->td_transfer_last) {
+ if (((void *)td) == urb->td_transfer_last) {
td = NULL;
break;
}
@@ -1167,7 +1170,7 @@
}
/* Check for short transfer */
if (len > 0) {
- if (xfer->flags_int.short_frames_ok) {
+ if (urb->flags_int.short_frames_ok) {
/* follow alt next */
td = td->alt_next;
} else {
@@ -1186,18 +1189,18 @@
/* update transfer cache */
- xfer->td_transfer_cache = td;
+ urb->td_transfer_cache = td;
/* update data toggle */
- xfer->endpoint->toggle_next =
+ pipe->endpoint->toggle_next =
(status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0;
#if USB_DEBUG
if (status & EHCI_QTD_STATERRS) {
DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x"
"status=%s%s%s%s%s%s%s%s\n",
- xfer->address, xfer->endpointno, xfer->aframes,
+ pipe->address, pipe->endpointno, urb->aframes,
(status & EHCI_QTD_ACTIVE) ? "[ACTIVE]" : "[NOT_ACTIVE]",
(status & EHCI_QTD_HALTED) ? "[HALTED]" : "",
(status & EHCI_QTD_BUFERR) ? "[BUFERR]" : "",
@@ -1214,54 +1217,55 @@
}
static void
-ehci_non_isoc_done(struct usb_xfer *xfer)
+ehci_non_isoc_done(struct usb_urb *urb)
{
+ struct usb_pipe *pipe = urb->ub_pipe;
usb_error_t err = 0;
- DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
- xfer, xfer->endpoint);
+ DPRINTFN(13, "urb=%p endpoint=%p transfer done\n",
+ urb, pipe->endpoint);
#if USB_DEBUG
if (ehcidebug > 10) {
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
- ehci_dump_sqtds(sc, xfer->td_transfer_first);
+ ehci_dump_sqtds(sc, urb->td_transfer_first);
}
#endif
/* reset scanner */
- xfer->td_transfer_cache = xfer->td_transfer_first;
+ urb->td_transfer_cache = urb->td_transfer_first;
- if (xfer->flags_int.control_xfr) {
+ if (urb->flags_int.control_xfr) {
- if (xfer->flags_int.control_hdr) {
+ if (urb->flags_int.control_hdr) {
- err = ehci_non_isoc_done_sub(xfer);
+ err = ehci_non_isoc_done_sub(urb);
}
- xfer->aframes = 1;
+ urb->aframes = 1;
- if (xfer->td_transfer_cache == NULL) {
+ if (urb->td_transfer_cache == NULL) {
goto done;
}
}
- while (xfer->aframes != xfer->nframes) {
+ while (urb->aframes != urb->nframes) {
- err = ehci_non_isoc_done_sub(xfer);
- xfer->aframes++;
+ err = ehci_non_isoc_done_sub(urb);
+ urb->aframes++;
- if (xfer->td_transfer_cache == NULL) {
+ if (urb->td_transfer_cache == NULL) {
goto done;
}
}
- if (xfer->flags_int.control_xfr &&
- !xfer->flags_int.control_act) {
+ if (urb->flags_int.control_xfr &&
+ !urb->flags_int.control_act) {
- err = ehci_non_isoc_done_sub(xfer);
+ err = ehci_non_isoc_done_sub(urb);
}
done:
- ehci_device_done(xfer, err);
+ ehci_device_done(urb, err);
}
/*------------------------------------------------------------------------*
@@ -1272,32 +1276,33 @@
* Else: USB transfer is finished
*------------------------------------------------------------------------*/
static uint8_t
-ehci_check_transfer(struct usb_xfer *xfer)
+ehci_check_transfer(struct usb_urb *urb)
{
- struct usb_pipe_methods *methods = xfer->endpoint->methods;
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ struct usb_pipe_methods *methods = pipe->endpoint->methods;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
uint32_t status;
- DPRINTFN(13, "xfer=%p checking transfer\n", xfer);
+ DPRINTFN(13, "urb=%p checking transfer\n", urb);
if (methods == &ehci_device_isoc_fs_methods) {
ehci_sitd_t *td;
/* isochronous full speed transfer */
- td = xfer->td_transfer_last;
+ td = urb->td_transfer_last;
usb2_pc_cpu_invalidate(td->page_cache);
status = hc32toh(sc, td->sitd_status);
/* also check if first is complete */
- td = xfer->td_transfer_first;
+ td = urb->td_transfer_first;
usb2_pc_cpu_invalidate(td->page_cache);
status |= hc32toh(sc, td->sitd_status);
if (!(status & EHCI_SITD_ACTIVE)) {
- ehci_device_done(xfer, USB_ERR_NORMAL_COMPLETION);
+ ehci_device_done(urb, USB_ERR_NORMAL_COMPLETION);
goto transferred;
}
} else if (methods == &ehci_device_isoc_hs_methods) {
@@ -1305,7 +1310,7 @@
/* isochronous high speed transfer */
- td = xfer->td_transfer_last;
+ td = urb->td_transfer_last;
usb2_pc_cpu_invalidate(td->page_cache);
status =
td->itd_status[0] | td->itd_status[1] |
@@ -1314,7 +1319,7 @@
td->itd_status[6] | td->itd_status[7];
/* also check first transfer */
- td = xfer->td_transfer_first;
+ td = urb->td_transfer_first;
usb2_pc_cpu_invalidate(td->page_cache);
status |=
td->itd_status[0] | td->itd_status[1] |
@@ -1324,7 +1329,7 @@
/* if no transactions are active we continue */
if (!(status & htohc32(sc, EHCI_ITD_ACTIVE))) {
- ehci_device_done(xfer, USB_ERR_NORMAL_COMPLETION);
+ ehci_device_done(urb, USB_ERR_NORMAL_COMPLETION);
goto transferred;
}
} else {
@@ -1336,7 +1341,7 @@
* check whether there is an error somewhere in the middle,
* or whether there was a short packet (SPD and not ACTIVE)
*/
- td = xfer->td_transfer_cache;
+ td = urb->td_transfer_cache;
while (1) {
usb2_pc_cpu_invalidate(td->page_cache);
@@ -1347,13 +1352,13 @@
*/
if (status & EHCI_QTD_ACTIVE) {
/* update cache */
- xfer->td_transfer_cache = td;
+ urb->td_transfer_cache = td;
goto done;
}
/*
* last transfer descriptor makes the transfer done
*/
- if (((void *)td) == xfer->td_transfer_last) {
+ if (((void *)td) == urb->td_transfer_last) {
break;
}
/*
@@ -1367,7 +1372,7 @@
* packet also makes the transfer done
*/
if (EHCI_QTD_GET_BYTES(status)) {
- if (xfer->flags_int.short_frames_ok) {
+ if (urb->flags_int.short_frames_ok) {
/* follow alt next */
if (td->alt_next) {
td = td->alt_next;
@@ -1379,12 +1384,12 @@
}
td = td->obj_next;
}
- ehci_non_isoc_done(xfer);
+ ehci_non_isoc_done(urb);
goto transferred;
}
done:
- DPRINTFN(13, "xfer=%p is still active\n", xfer);
+ DPRINTFN(13, "urb=%p is still active\n", urb);
return (0);
transferred:
@@ -1408,14 +1413,14 @@
static void
ehci_interrupt_poll(ehci_softc_t *sc)
{
- struct usb_xfer *xfer;
+ struct usb_urb *urb;
repeat:
- TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
+ TAILQ_FOREACH(urb, &sc->sc_bus.intr_q.head, wait_entry) {
/*
* check if transfer is transferred
*/
- if (ehci_check_transfer(xfer)) {
+ if (ehci_check_transfer(urb)) {
/* queue has been modified */
goto repeat;
}
@@ -1499,14 +1504,14 @@
static void
ehci_timeout(void *arg)
{
- struct usb_xfer *xfer = arg;
+ struct usb_urb *urb = arg;
- DPRINTF("xfer=%p\n", xfer);
+ DPRINTF("urb=%p\n", urb);
- USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
+ //USB_BUS_LOCK_ASSERT(urb->pipe->bus, MA_OWNED);
/* transfer is transferred */
- ehci_device_done(xfer, USB_ERR_TIMEOUT);
+ ehci_device_done(urb, USB_ERR_TIMEOUT);
}
static void
@@ -1705,8 +1710,9 @@
}
static void
-ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
+ehci_setup_standard_chain(struct usb_urb *urb, ehci_qh_t **qh_last)
{
+ struct usb_pipe *pipe = urb->ub_pipe;
struct ehci_std_temp temp;
struct usb_pipe_methods *methods;
ehci_qh_t *qh;
@@ -1716,30 +1722,30 @@
uint32_t x;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
- xfer->address, UE_GET_ADDR(xfer->endpointno),
- xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
+ pipe->address, UE_GET_ADDR(pipe->endpointno),
+ urb->sumlen, usb2_get_speed(pipe->xroot->udev));
- temp.average = xfer->max_hc_frame_size;
- temp.max_frame_size = xfer->max_frame_size;
- temp.sc = EHCI_BUS2SC(xfer->xroot->bus);
+ temp.average = pipe->max_hc_frame_size;
+ temp.max_frame_size = pipe->max_frame_size;
+ temp.sc = EHCI_BUS2SC(pipe->xroot->bus);
/* toggle the DMA set we are using */
- xfer->flags_int.curr_dma_set ^= 1;
+ urb->flags_int.curr_dma_set ^= 1;
/* get next DMA set */
- td = xfer->td_start[xfer->flags_int.curr_dma_set];
+ td = urb->td_start[urb->flags_int.curr_dma_set];
- xfer->td_transfer_first = td;
- xfer->td_transfer_cache = td;
+ urb->td_transfer_first = td;
+ urb->td_transfer_cache = td;
temp.td = NULL;
temp.td_next = td;
temp.qtd_status = 0;
temp.last_frame = 0;
- temp.setup_alt_next = xfer->flags_int.short_frames_ok;
+ temp.setup_alt_next = urb->flags_int.short_frames_ok;
- if (xfer->flags_int.control_xfr) {
- if (xfer->endpoint->toggle_next) {
+ if (urb->flags_int.control_xfr) {
+ if (pipe->endpoint->toggle_next) {
/* DATA1 is next */
temp.qtd_status |=
htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
@@ -1749,15 +1755,15 @@
temp.auto_data_toggle = 1;
}
- if (usb2_get_speed(xfer->xroot->udev) != USB_SPEED_HIGH) {
+ if (usb2_get_speed(pipe->udev) != USB_SPEED_HIGH) {
/* max 3 retries */
temp.qtd_status |=
htohc32(temp.sc, EHCI_QTD_SET_CERR(3));
}
/* check if we should prepend a setup message */
- if (xfer->flags_int.control_xfr) {
- if (xfer->flags_int.control_hdr) {
+ if (urb->flags_int.control_xfr) {
+ if (urb->flags_int.control_hdr) {
temp.qtd_status &=
htohc32(temp.sc, EHCI_QTD_SET_CERR(3));
@@ -1766,13 +1772,13 @@
EHCI_QTD_SET_PID(EHCI_QTD_PID_SETUP) |
EHCI_QTD_SET_TOGGLE(0));
- temp.len = xfer->frlengths[0];
- temp.pc = xfer->frbuffers + 0;
+ temp.len = urb->frlengths[0];
+ temp.pc = urb->frbuffers + 0;
temp.shortpkt = temp.len ? 1 : 0;
/* check for last frame */
- if (xfer->nframes == 1) {
+ if (urb->nframes == 1) {
/* no STATUS stage yet, SETUP is last */
- if (xfer->flags_int.control_act) {
+ if (urb->flags_int.control_act) {
temp.last_frame = 1;
temp.setup_alt_next = 0;
}
@@ -1784,19 +1790,19 @@
x = 0;
}
- while (x != xfer->nframes) {
+ while (x != urb->nframes) {
/* DATA0 / DATA1 message */
- temp.len = xfer->frlengths[x];
- temp.pc = xfer->frbuffers + x;
+ temp.len = urb->frlengths[x];
+ temp.pc = urb->frbuffers + x;
x++;
- if (x == xfer->nframes) {
- if (xfer->flags_int.control_xfr) {
+ if (x == urb->nframes) {
+ if (urb->flags_int.control_xfr) {
/* no STATUS stage yet, DATA is last */
- if (xfer->flags_int.control_act) {
+ if (urb->flags_int.control_act) {
temp.last_frame = 1;
temp.setup_alt_next = 0;
}
@@ -1821,13 +1827,13 @@
/* regular data transfer */
- temp.shortpkt = (xfer->flags.force_short_xfer) ? 0 : 1;
+ temp.shortpkt = (pipe->flags.force_short_xfer) ? 0 : 1;
}
/* set endpoint direction */
temp.qtd_status |=
- (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) ?
+ (UE_GET_DIR(pipe->endpointno) == UE_DIR_IN) ?
htohc32(temp.sc, EHCI_QTD_ACTIVE |
EHCI_QTD_SET_PID(EHCI_QTD_PID_IN)) :
htohc32(temp.sc, EHCI_QTD_ACTIVE |
@@ -1838,8 +1844,8 @@
/* check if we should append a status stage */
- if (xfer->flags_int.control_xfr &&
- !xfer->flags_int.control_act) {
+ if (urb->flags_int.control_xfr &&
+ !urb->flags_int.control_act) {
/*
* Send a DATA1 message and invert the current endpoint
@@ -1849,7 +1855,7 @@
temp.qtd_status &= htohc32(temp.sc, EHCI_QTD_SET_CERR(3) |
EHCI_QTD_SET_TOGGLE(1));
temp.qtd_status |=
- (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) ?
+ (UE_GET_DIR(pipe->endpointno) == UE_DIR_OUT) ?
htohc32(temp.sc, EHCI_QTD_ACTIVE |
EHCI_QTD_SET_PID(EHCI_QTD_PID_IN) |
EHCI_QTD_SET_TOGGLE(1)) :
@@ -1876,36 +1882,36 @@
/* must have at least one frame! */
- xfer->td_transfer_last = td;
+ urb->td_transfer_last = td;
#if USB_DEBUG
if (ehcidebug > 8) {
DPRINTF("nexttog=%d; data before transfer:\n",
- xfer->endpoint->toggle_next);
+ pipe->endpoint->toggle_next);
ehci_dump_sqtds(temp.sc,
- xfer->td_transfer_first);
+ urb->td_transfer_first);
}
#endif
- methods = xfer->endpoint->methods;
+ methods = pipe->endpoint->methods;
- qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
+ qh = urb->qh_start[urb->flags_int.curr_dma_set];
/* the "qh_link" field is filled when the QH is added */
qh_endp =
- (EHCI_QH_SET_ADDR(xfer->address) |
- EHCI_QH_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) |
- EHCI_QH_SET_MPL(xfer->max_packet_size));
+ (EHCI_QH_SET_ADDR(pipe->address) |
+ EHCI_QH_SET_ENDPT(UE_GET_ADDR(pipe->endpointno)) |
+ EHCI_QH_SET_MPL(pipe->max_packet_size));
- if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
+ if (usb2_get_speed(pipe->xroot->udev) == USB_SPEED_HIGH) {
qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) |
EHCI_QH_DTC);
if (methods != &ehci_device_intr_methods)
qh_endp |= EHCI_QH_SET_NRL(8);
} else {
- if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) {
+ if (usb2_get_speed(pipe->xroot->udev) == USB_SPEED_FULL) {
qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL) |
EHCI_QH_DTC);
} else {
@@ -1925,11 +1931,11 @@
qh->qh_endp = htohc32(temp.sc, qh_endp);
qh_endphub =
- (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->xroot->udev->hs_hub_addr) |
- EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no));
+ (EHCI_QH_SET_MULT(pipe->max_packet_count & 3) |
+ EHCI_QH_SET_CMASK(pipe->usb2_cmask) |
+ EHCI_QH_SET_SMASK(pipe->usb2_smask) |
+ EHCI_QH_SET_HUBA(pipe->udev->hs_hub_addr) |
+ EHCI_QH_SET_PORT(pipe->udev->hs_port_no));
qh->qh_endphub = htohc32(temp.sc, qh_endphub);
qh->qh_curqtd = htohc32(temp.sc, 0);
@@ -1943,13 +1949,13 @@
qh->qh_endp &= htohc32(temp.sc, ~EHCI_QH_DTC);
- if (xfer->endpoint->toggle_next) {
+ if (pipe->endpoint->toggle_next) {
/* DATA1 is next */
qh->qh_qtd.qtd_status |=
htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
}
}
- td = xfer->td_transfer_first;
+ td = urb->td_transfer_first;
qh->qh_qtd.qtd_next = td->qtd_self;
qh->qh_qtd.qtd_altnext =
@@ -1957,7 +1963,7 @@
usb2_pc_cpu_flush(qh->page_cache);
- if (xfer->xroot->udev->flags.self_suspended == 0) {
+ if (pipe->udev->flags.self_suspended == 0) {
EHCI_APPEND_QH(qh, *qh_last);
}
}
@@ -1990,17 +1996,18 @@
}
static void
-ehci_isoc_fs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
+ehci_isoc_fs_done(ehci_softc_t *sc, struct usb_urb *urb)
{
- uint32_t nframes = xfer->nframes;
+ struct usb_pipe *pipe = urb->ub_pipe;
+ uint32_t nframes = urb->nframes;
uint32_t status;
- uint32_t *plen = xfer->frlengths;
+ uint32_t *plen = urb->frlengths;
uint16_t len = 0;
- ehci_sitd_t *td = xfer->td_transfer_first;
- ehci_sitd_t **pp_last = &sc->sc_isoc_fs_p_last[xfer->qh_pos];
+ ehci_sitd_t *td = urb->td_transfer_first;
+ ehci_sitd_t **pp_last = &sc->sc_isoc_fs_p_last[pipe->qh_pos];
- DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
- xfer, xfer->endpoint);
+ DPRINTFN(13, "urb=%p endpoint=%p transfer done\n",
+ urb, pipe->endpoint);
while (nframes--) {
if (td == NULL) {
@@ -2039,22 +2046,23 @@
td = td->obj_next;
}
- xfer->aframes = xfer->nframes;
+ urb->aframes = urb->nframes;
}
static void
-ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
+ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_urb *urb)
{
- uint32_t nframes = xfer->nframes;
+ struct usb_pipe *pipe = urb->ub_pipe;
+ uint32_t nframes = urb->nframes;
uint32_t status;
- uint32_t *plen = xfer->frlengths;
+ uint32_t *plen = urb->frlengths;
uint16_t len = 0;
uint8_t td_no = 0;
- ehci_itd_t *td = xfer->td_transfer_first;
- ehci_itd_t **pp_last = &sc->sc_isoc_hs_p_last[xfer->qh_pos];
+ ehci_itd_t *td = urb->td_transfer_first;
+ ehci_itd_t **pp_last = &sc->sc_isoc_hs_p_last[pipe->qh_pos];
- DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
- xfer, xfer->endpoint);
+ DPRINTFN(13, "urb=%p endpoint=%p transfer done\n",
+ urb, pipe->endpoint);
while (nframes--) {
if (td == NULL) {
@@ -2104,92 +2112,94 @@
td = td->obj_next;
}
}
- xfer->aframes = xfer->nframes;
+ urb->aframes = urb->nframes;
}
/* NOTE: "done" can be run two times in a row,
* from close and from interrupt
*/
static void
-ehci_device_done(struct usb_xfer *xfer, usb_error_t error)
+ehci_device_done(struct usb_urb *urb, usb_error_t error)
{
- struct usb_pipe_methods *methods = xfer->endpoint->methods;
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ struct usb_pipe_methods *methods = pipe->endpoint->methods;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
- DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
- xfer, xfer->endpoint, error);
+ DPRINTFN(2, "urb=%p, endpoint=%p, error=%d\n",
+ urb, pipe->endpoint, error);
if ((methods == &ehci_device_bulk_methods) ||
(methods == &ehci_device_ctrl_methods)) {
#if USB_DEBUG
if (ehcidebug > 8) {
DPRINTF("nexttog=%d; data after transfer:\n",
- xfer->endpoint->toggle_next);
+ pipe->endpoint->toggle_next);
ehci_dump_sqtds(sc,
- xfer->td_transfer_first);
+ urb->td_transfer_first);
}
#endif
- EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set],
+ EHCI_REMOVE_QH(urb->qh_start[urb->flags_int.curr_dma_set],
sc->sc_async_p_last);
}
if (methods == &ehci_device_intr_methods) {
- EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set],
- sc->sc_intr_p_last[xfer->qh_pos]);
+ EHCI_REMOVE_QH(urb->qh_start[urb->flags_int.curr_dma_set],
+ sc->sc_intr_p_last[pipe->qh_pos]);
}
/*
* Only finish isochronous transfers once which will update
- * "xfer->frlengths".
+ * "urb->frlengths".
*/
- if (xfer->td_transfer_first &&
- xfer->td_transfer_last) {
+ if (urb->td_transfer_first &&
+ urb->td_transfer_last) {
if (methods == &ehci_device_isoc_fs_methods) {
- ehci_isoc_fs_done(sc, xfer);
+ ehci_isoc_fs_done(sc, urb);
}
if (methods == &ehci_device_isoc_hs_methods) {
- ehci_isoc_hs_done(sc, xfer);
+ ehci_isoc_hs_done(sc, urb);
}
- xfer->td_transfer_first = NULL;
- xfer->td_transfer_last = NULL;
+ urb->td_transfer_first = NULL;
+ urb->td_transfer_last = NULL;
}
/* dequeue transfer and start next transfer */
- usb2_transfer_done(xfer, error);
+ usb2_transfer_done(urb, error);
}
/*------------------------------------------------------------------------*
* ehci bulk support
*------------------------------------------------------------------------*/
static void
-ehci_device_bulk_open(struct usb_xfer *xfer)
+ehci_device_bulk_open(struct usb_urb *urb)
{
return;
}
static void
-ehci_device_bulk_close(struct usb_xfer *xfer)
+ehci_device_bulk_close(struct usb_urb *urb)
{
- ehci_device_done(xfer, USB_ERR_CANCELLED);
+ ehci_device_done(urb, USB_ERR_CANCELLED);
}
static void
-ehci_device_bulk_enter(struct usb_xfer *xfer)
+ehci_device_bulk_enter(struct usb_urb *urb)
{
return;
}
static void
-ehci_device_bulk_start(struct usb_xfer *xfer)
+ehci_device_bulk_start(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
uint32_t temp;
/* setup TD's and QH */
- ehci_setup_standard_chain(xfer, &sc->sc_async_p_last);
+ ehci_setup_standard_chain(urb, &sc->sc_async_p_last);
/* put transfer on interrupt queue */
- ehci_transfer_intr_enqueue(xfer);
+ ehci_transfer_intr_enqueue(urb);
/* XXX Performance quirk: Some Host Controllers have a too low
* interrupt rate. Issue an IAAD to stimulate the Host
@@ -2212,33 +2222,34 @@
* ehci control support
*------------------------------------------------------------------------*/
static void
-ehci_device_ctrl_open(struct usb_xfer *xfer)
+ehci_device_ctrl_open(struct usb_urb *urb)
{
return;
}
static void
-ehci_device_ctrl_close(struct usb_xfer *xfer)
+ehci_device_ctrl_close(struct usb_urb *urb)
{
- ehci_device_done(xfer, USB_ERR_CANCELLED);
+ ehci_device_done(urb, USB_ERR_CANCELLED);
}
static void
-ehci_device_ctrl_enter(struct usb_xfer *xfer)
+ehci_device_ctrl_enter(struct usb_urb *urb)
{
return;
}
static void
-ehci_device_ctrl_start(struct usb_xfer *xfer)
+ehci_device_ctrl_start(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
/* setup TD's and QH */
- ehci_setup_standard_chain(xfer, &sc->sc_async_p_last);
+ ehci_setup_standard_chain(urb, &sc->sc_async_p_last);
/* put transfer on interrupt queue */
- ehci_transfer_intr_enqueue(xfer);
+ ehci_transfer_intr_enqueue(urb);
}
struct usb_pipe_methods ehci_device_ctrl_methods =
@@ -2253,9 +2264,10 @@
* ehci interrupt support
*------------------------------------------------------------------------*/
static void
-ehci_device_intr_open(struct usb_xfer *xfer)
+ehci_device_intr_open(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
uint16_t best;
uint16_t bit;
uint16_t x;
@@ -2264,16 +2276,16 @@
/* Allocate a microframe slot first: */
slot = usb2_intr_schedule_adjust
- (xfer->xroot->udev, xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX);
+ (pipe->xroot->udev, pipe->max_frame_size, USB_HS_MICRO_FRAMES_MAX);
- if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
- xfer->usb2_uframe = slot;
- xfer->usb2_smask = (1 << slot) & 0xFF;
- xfer->usb2_cmask = 0;
+ if (usb2_get_speed(pipe->xroot->udev) == USB_SPEED_HIGH) {
+ pipe->usb2_uframe = slot;
+ pipe->usb2_smask = (1 << slot) & 0xFF;
+ pipe->usb2_cmask = 0;
} else {
- xfer->usb2_uframe = slot;
- xfer->usb2_smask = (1 << slot) & 0x3F;
- xfer->usb2_cmask = (-(4 << slot)) & 0xFE;
+ pipe->usb2_uframe = slot;
+ pipe->usb2_smask = (1 << slot) & 0x3F;
+ pipe->usb2_cmask = (-(4 << slot)) & 0xFE;
}
/*
@@ -2283,7 +2295,7 @@
best = 0;
bit = EHCI_VIRTUAL_FRAMELIST_COUNT / 2;
while (bit) {
- if (xfer->interval >= bit) {
+ if (pipe->interval >= bit) {
x = bit;
best = bit;
while (x & bit) {
@@ -2299,42 +2311,44 @@
}
sc->sc_intr_stat[best]++;
- xfer->qh_pos = best;
+ pipe->qh_pos = best;
DPRINTFN(3, "best=%d interval=%d\n",
- best, xfer->interval);
+ best, pipe->interval);
}
static void
-ehci_device_intr_close(struct usb_xfer *xfer)
+ehci_device_intr_close(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
uint8_t slot;
slot = usb2_intr_schedule_adjust
- (xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb2_uframe);
+ (pipe->xroot->udev, -(pipe->max_frame_size), pipe->usb2_uframe);
- sc->sc_intr_stat[xfer->qh_pos]--;
+ sc->sc_intr_stat[pipe->qh_pos]--;
- ehci_device_done(xfer, USB_ERR_CANCELLED);
+ ehci_device_done(urb, USB_ERR_CANCELLED);
}
static void
-ehci_device_intr_enter(struct usb_xfer *xfer)
+ehci_device_intr_enter(struct usb_urb *urb)
{
return;
}
static void
-ehci_device_intr_start(struct usb_xfer *xfer)
+ehci_device_intr_start(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
/* setup TD's and QH */
- ehci_setup_standard_chain(xfer, &sc->sc_intr_p_last[xfer->qh_pos]);
+ ehci_setup_standard_chain(urb, &sc->sc_intr_p_last[pipe->qh_pos]);
/* put transfer on interrupt queue */
- ehci_transfer_intr_enqueue(xfer);
+ ehci_transfer_intr_enqueue(urb);
}
struct usb_pipe_methods ehci_device_intr_methods =
@@ -2349,20 +2363,21 @@
* ehci full speed isochronous support
*------------------------------------------------------------------------*/
static void
-ehci_device_isoc_fs_open(struct usb_xfer *xfer)
+ehci_device_isoc_fs_open(struct usb_urb *urb)
{
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
+ ehci_softc_t *sc = EHCI_BUS2SC(pipe->xroot->bus);
ehci_sitd_t *td;
uint32_t sitd_portaddr;
uint8_t ds;
sitd_portaddr =
- EHCI_SITD_SET_ADDR(xfer->address) |
- EHCI_SITD_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) |
- EHCI_SITD_SET_HUBA(xfer->xroot->udev->hs_hub_addr) |
- EHCI_SITD_SET_PORT(xfer->xroot->udev->hs_port_no);
+ EHCI_SITD_SET_ADDR(pipe->address) |
+ EHCI_SITD_SET_ENDPT(UE_GET_ADDR(pipe->endpointno)) |
+ EHCI_SITD_SET_HUBA(pipe->xroot->udev->hs_hub_addr) |
+ EHCI_SITD_SET_PORT(pipe->xroot->udev->hs_port_no);
- if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) {
+ if (UE_GET_DIR(pipe->endpointno) == UE_DIR_IN) {
sitd_portaddr |= EHCI_SITD_SET_DIR_IN;
}
sitd_portaddr = htohc32(sc, sitd_portaddr);
@@ -2371,7 +2386,7 @@
for (ds = 0; ds != 2; ds++) {
- for (td = xfer->td_start[ds]; td; td = td->obj_next) {
+ for (td = urb->td_start[ds]; td; td = td->obj_next) {
td->sitd_portaddr = sitd_portaddr;
@@ -2390,16 +2405,17 @@
}
static void
-ehci_device_isoc_fs_close(struct usb_xfer *xfer)
+ehci_device_isoc_fs_close(struct usb_urb *urb)
{
- ehci_device_done(xfer, USB_ERR_CANCELLED);
+ ehci_device_done(urb, USB_ERR_CANCELLED);
}
static void
-ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
+ehci_device_isoc_fs_enter(struct usb_urb *urb)
{
struct usb_page_search buf_res;
- ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
+ struct usb_pipe *pipe = urb->ub_pipe;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list