PERFORCE change 155839 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Jan 8 15:31:42 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=155839
Change 155839 by hselasky at hselasky_laptop001 on 2009/01/08 23:31:16
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.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#21 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#27 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#22 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#24 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#21 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#19 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_busdma.c#17 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#32 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_debug.c#7 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_handle_request.c#14 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#30 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_request.c#29 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#37 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.h#13 edit
.. //depot/projects/usb/src/sys/dev/usb2/serial/uvscom2.c#15 edit
.. //depot/projects/usb/src/sys/dev/usb2/storage/ata-usb2.c#13 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#21 (text+ko) ====
@@ -259,13 +259,13 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
static void
at91dci_root_intr_start(struct usb2_xfer *xfer)
{
- struct at91dci_softc *sc = xfer->usb2_sc;
+ struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus);
sc->sc_root_intr.xfer = xfer;
}
@@ -2299,11 +2299,6 @@
xfer = parm->curr_xfer;
/*
- * setup xfer
- */
- xfer->usb2_sc = sc;
-
- /*
* NOTE: This driver does not use any of the parameters that
* are computed from the following values. Just set some
* reasonable dummies:
==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#27 (text+ko) ====
@@ -971,7 +971,7 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
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_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_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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*/
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
static void
ehci_root_intr_start(struct usb2_xfer *xfer)
{
- ehci_softc_t *sc = xfer->usb2_sc;
+ ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
sc->sc_root_intr.xfer = xfer;
}
@@ -3538,11 +3538,6 @@
nitd = 0;
/*
- * setup xfer
- */
- xfer->usb2_sc = sc;
-
- /*
* compute maximum number of some structures
*/
if (parm->methods == &ehci_device_ctrl_methods) {
@@ -3864,7 +3859,7 @@
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 @@
TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
- if (xfer->udev == udev) {
+ if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#22 (text+ko) ====
@@ -204,14 +204,14 @@
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 @@
return (1); /* not complete */
done:
- sc = xfer->usb2_sc;
+ sc = MUSBOTG_BUS2SC(xfer->xroot->bus);
/* compute all actual lengths */
@@ -1130,7 +1130,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*/
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
static void
musbotg_root_intr_start(struct usb2_xfer *xfer)
{
- struct musbotg_softc *sc = xfer->usb2_sc;
+ struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus);
sc->sc_root_intr.xfer = xfer;
}
@@ -2707,11 +2707,6 @@
xfer = parm->curr_xfer;
/*
- * setup xfer
- */
- xfer->usb2_sc = sc;
-
- /*
* NOTE: This driver does not use any of the parameters that
* are computed from the following values. Just set some
* reasonable dummies:
==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#24 (text+ko) ====
@@ -669,7 +669,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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];
==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#21 (text+ko) ====
@@ -878,7 +878,7 @@
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 @@
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 @@
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 @@
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 @@
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);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list