From owner-p4-projects@FreeBSD.ORG Mon Jun 18 06:42:47 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 41F0416A46C; Mon, 18 Jun 2007 06:42:47 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 149C816A41F for ; Mon, 18 Jun 2007 06:42:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id F0FC013C455 for ; Mon, 18 Jun 2007 06:42:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5I6gk3f079046 for ; Mon, 18 Jun 2007 06:42:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5I6gkp3079030 for perforce@freebsd.org; Mon, 18 Jun 2007 06:42:46 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 18 Jun 2007 06:42:46 GMT Message-Id: <200706180642.l5I6gkp3079030@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 121894 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2007 06:42:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=121894 Change 121894 by hselasky@hselasky_mini_itx on 2007/06/18 06:42:17 Hi, My main hacking location did not have internet access, so here is a multiple changes submit. Summed up: 1) s/.endpoint = -1/.endpoint = UE_ADDR_ANY/g. Various people suggested this. 2) s/.direction = -1/.direction = UE_DIR_ANY/g. Various people suggested this. 3) The "interval" field has now got new meaning depending on the endpoint type in question. See the README for more info. This allows easy implementation of BULK-IN power saving for example. 4) USBD_SYNCHRONOUS was removed. Planned removal. 5) Automatic clear-stall mechanism was removed. Axe down and simplify. 6) New USB transfer flag, USBD_PIPE_BOF. See the README for more info. 7) Add "USBD_PIPE_BOF" where possibly needed. 8) Factored out and simplified clear stall callback into "usbd_clear_stall_callback()". This saves some code. 9) No more bombing out on clear stall failure. The system will go into an infinite loop trying to clear stall every "xfer->interval", currently 50, milliseconds. 10) Low level timeouts must be started from the "start" method and not the "enter" method. See OHCI/EHCI/UHCU drivers. This follows from change 3) 11) High-speed bInterval has a unit of 125us for the Interrupt endpoint (fix) Else the interval is given in units of 1ms. 12) Remove "bus->use_polling" variable. It is not used any more. Instead check the "cold" variable inside the "usbd_do_request_flags_mtx()" function. Also see the USBD_USE_POLLING flag if you need to use polling. 13) Some not yet finished structures sneaked into "usb.h" 14) Some nits. --HPS Affected files ... .. //depot/projects/usb/src/sys/dev/ata/ata-usb.c#14 edit .. //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#13 edit .. //depot/projects/usb/src/sys/dev/usb/README#14 edit .. //depot/projects/usb/src/sys/dev/usb/ehci.c#34 edit .. //depot/projects/usb/src/sys/dev/usb/if_aue.c#26 edit .. //depot/projects/usb/src/sys/dev/usb/if_axe.c#27 edit .. //depot/projects/usb/src/sys/dev/usb/if_cdce.c#20 edit .. //depot/projects/usb/src/sys/dev/usb/if_cue.c#22 edit .. //depot/projects/usb/src/sys/dev/usb/if_kue.c#24 edit .. //depot/projects/usb/src/sys/dev/usb/if_rue.c#23 edit .. //depot/projects/usb/src/sys/dev/usb/if_rum.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/if_udav.c#23 edit .. //depot/projects/usb/src/sys/dev/usb/if_ural.c#29 edit .. //depot/projects/usb/src/sys/dev/usb/if_zyd.c#12 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.c#28 edit .. //depot/projects/usb/src/sys/dev/usb/uark.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/ubsa.c#19 edit .. //depot/projects/usb/src/sys/dev/usb/ubser.c#13 edit .. //depot/projects/usb/src/sys/dev/usb/ucycom.c#12 edit .. //depot/projects/usb/src/sys/dev/usb/udbp.c#9 edit .. //depot/projects/usb/src/sys/dev/usb/ufm.c#11 edit .. //depot/projects/usb/src/sys/dev/usb/ufoma.c#19 edit .. //depot/projects/usb/src/sys/dev/usb/uftdi.c#17 edit .. //depot/projects/usb/src/sys/dev/usb/ugen.c#18 edit .. //depot/projects/usb/src/sys/dev/usb/ugensa.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.c#28 edit .. //depot/projects/usb/src/sys/dev/usb/uhid.c#15 edit .. //depot/projects/usb/src/sys/dev/usb/uhub.c#12 edit .. //depot/projects/usb/src/sys/dev/usb/uipaq.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/ukbd.c#18 edit .. //depot/projects/usb/src/sys/dev/usb/ulpt.c#19 edit .. //depot/projects/usb/src/sys/dev/usb/umass.c#18 edit .. //depot/projects/usb/src/sys/dev/usb/umct.c#13 edit .. //depot/projects/usb/src/sys/dev/usb/umodem.c#22 edit .. //depot/projects/usb/src/sys/dev/usb/umoscom.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/ums.c#19 edit .. //depot/projects/usb/src/sys/dev/usb/uplcom.c#20 edit .. //depot/projects/usb/src/sys/dev/usb/urio.c#9 edit .. //depot/projects/usb/src/sys/dev/usb/usb.c#14 edit .. //depot/projects/usb/src/sys/dev/usb/usb.h#11 edit .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#39 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#41 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#26 edit .. //depot/projects/usb/src/sys/dev/usb/uscanner.c#9 edit .. //depot/projects/usb/src/sys/dev/usb/uvisor.c#15 edit .. //depot/projects/usb/src/sys/dev/usb/uvscom.c#20 edit .. //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#11 edit .. //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#6 edit Differences ... ==== //depot/projects/usb/src/sys/dev/ata/ata-usb.c#14 (text) ==== @@ -173,7 +173,7 @@ [ATAUSB_T_BBB_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &atausb_t_bbb_reset1_callback, @@ -183,7 +183,7 @@ [ATAUSB_T_BBB_RESET2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &atausb_t_bbb_reset2_callback, @@ -193,7 +193,7 @@ [ATAUSB_T_BBB_RESET3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &atausb_t_bbb_reset3_callback, @@ -202,7 +202,7 @@ [ATAUSB_T_BBB_COMMAND] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = sizeof(struct bbb_cbw), .flags = USBD_USE_DMA, @@ -212,7 +212,7 @@ [ATAUSB_T_BBB_DATA_READ] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = ATAUSB_BULK_SIZE, .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), @@ -223,7 +223,7 @@ [ATAUSB_T_BBB_DATA_RD_CS] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &atausb_t_bbb_data_rd_cs_callback, @@ -232,7 +232,7 @@ [ATAUSB_T_BBB_DATA_WRITE] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = ATAUSB_BULK_SIZE, .flags = USBD_USE_DMA, @@ -243,7 +243,7 @@ [ATAUSB_T_BBB_DATA_WR_CS] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &atausb_t_bbb_data_wr_cs_callback, @@ -252,7 +252,7 @@ [ATAUSB_T_BBB_STATUS] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = sizeof(struct bbb_csw), .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), @@ -581,8 +581,9 @@ return; tr_setup: - usbd_clear_stall_tr_setup(xfer, sc->xfer[stall_xfer]); - usbd_clear_stall_tr_transferred(xfer, sc->xfer[stall_xfer]); + if (usbd_clear_stall_callback(xfer, sc->xfer[stall_xfer])) { + goto tr_transferred; + } return; } ==== //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#13 (text+ko) ==== @@ -455,7 +455,7 @@ uaudio_cfg_record_full_speed[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = UAUDIO_NFRAMES, @@ -465,7 +465,7 @@ [1] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = UAUDIO_NFRAMES, @@ -478,7 +478,7 @@ uaudio_cfg_record_high_speed[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = (UAUDIO_NFRAMES * 8), @@ -488,7 +488,7 @@ [1] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = (UAUDIO_NFRAMES * 8), @@ -501,7 +501,7 @@ uaudio_cfg_play_full_speed[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = UAUDIO_NFRAMES, @@ -511,7 +511,7 @@ [1] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = UAUDIO_NFRAMES, @@ -524,7 +524,7 @@ uaudio_cfg_play_high_speed[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = (UAUDIO_NFRAMES * 8), @@ -534,7 +534,7 @@ [1] = { .type = UE_ISOCHRONOUS, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ .frames = (UAUDIO_NFRAMES * 8), @@ -548,7 +548,7 @@ [0] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = (sizeof(usb_device_request_t) + 4), .callback = &uaudio_mixer_write_cfg_callback, .timeout = 1000, /* 1 second */ @@ -579,40 +579,42 @@ umidi_config[UMIDI_N_TRANSFER] = { [0] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMIDI_BULK_SIZE, - .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_SHORT_XFER_OK), .callback = &umidi_bulk_write_callback, }, [1] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = UMIDI_BULK_SIZE, - .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_SHORT_XFER_OK), .callback = &umidi_bulk_read_callback, }, [2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &umidi_write_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &umidi_read_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, }; @@ -3289,32 +3291,11 @@ { struct umidi_chan *chan = xfer->priv_sc; struct usbd_xfer *xfer_other = chan->xfer[1]; - u_int32_t n; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - chan->flags &= ~UMIDI_FLAG_READ_STALL; - - if (xfer->error != USBD_CANCELLED) { - for (n = 0; n < chan->max_cable; n++) { - if (chan->sub[n].read_open) { - usb_cdev_put_data_error(&(chan->sub[n].cdev)); - } - } + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(0, "stall cleared\n"); + chan->flags &= ~UMIDI_FLAG_READ_STALL; + usbd_transfer_start(xfer_other); } return; } @@ -3387,30 +3368,11 @@ { struct umidi_chan *chan = xfer->priv_sc; struct usbd_xfer *xfer_other = chan->xfer[0]; - u_int32_t n; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - if (xfer->error != USBD_CANCELLED) { - for (n = 0; n < chan->max_cable; n++) { - if (chan->sub[n].write_open) { - usb_cdev_get_data_error(&(chan->sub[n].cdev)); - } - } + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(0, "stall cleared\n"); + chan->flags &= ~UMIDI_FLAG_WRITE_STALL; + usbd_transfer_start(xfer_other); } return; } ==== //depot/projects/usb/src/sys/dev/usb/README#14 (text+ko) ==== @@ -76,8 +76,10 @@ tr_transferred: /* read data from xfer->buffer if any */ + return; + tr_error: - /* print error message */ + /* print error message and clear stall for example */ return; } @@ -192,9 +194,26 @@ "-1" or "UE_DIR_ANY" will select the first matching endpoint. Else valid values are: "UE_DIR_IN" and "UE_DIR_OUT". This field is mandatory. -- The "interval" field selects the interrupt interval, for "type" = UE_INTERRUPT. - The "interval" is given in milliseconds. "0" selects the default - interrupt interval. +- The "interval" field selects the interrupt interval. The value of this + field is given in milliseconds and is independent of device speed. Depending + on the endpoint type, this field has different meaning: + + UE_INTERRUPT) + "0" use the default interrupt interval based on endpoint descriptor. + "Else" use the given value for polling rate. + + UE_ISOCHRONOUS) + "0" use default. + "Else" the value is ignored. + + UE_BULK) + UE_CONTROL) + "0" no transfer pre-delay. + "Else" a delay as given by this field in milliseconds is + inserted before the hardware is started when + "usbd_start_hardware()" is called. + NOTE: The transfer timeout, if any, is started after that + the pre-delay has elapsed! - The "timeout" field, if non-zero, will set the transfer timeout, in milliseconds. @@ -207,13 +226,6 @@ "index" should be used. - The "flags" field allows one to set flags for the transfer. Valid flags are: - USBD_SYNCHRONOUS - This flag can only be used with the default callback, - "usbd_default_callback()", and will cause the - "usbd_transfer_start()" function to sleep, exiting all - mutexes, until the transfer is finished. This flag is - depreciated. - USBD_FORCE_SHORT_XFER This flag forces the last USB packet sent to be short. A short packet has a length of less than "xfer->max_packet_size", which @@ -229,6 +241,10 @@ without exiting any mutexes, until the transfer is finished or has timed out. + NOTE: If polling is used the "timeout" field should be non-zero! + NOTE: USBD_CANCELLED is returned in case of timeout + instead of USBD_TIMEOUT! + USBD_USE_DMA This flag will cause the USB host controller driver to not allocate a second data buffer, "xfer->buffer". Instead of @@ -237,6 +253,29 @@ offset, src, len)" or "usbd_copy_out(&(xfer->buf_data), offset, dst, len)". This saves an extra data copy. + USBD_PIPE_BOF + This flag causes a failing USB transfer to remain first + in the PIPE queue except in the case of "xfer->error" equal + to "USBD_CANCELLED". No other USB transfers in the affected + PIPE queue will be started until either: + + 1) The failing USB transfer is stopped using "usbd_transfer_stop()". + 2) The failing USB transfer performs a successful transfer. + + The purpose of this flag is to avoid races when multiple + transfers are queued for execution on an USB endpoint, and + the first executing transfer fails leading to the need + for clearing of stall for example. In this case this flag + is used to prevent the following USB transfers from being + executed at the same time the clear-stall command is + executed on the USB control endpoint. + + "BOF" is short for "Block On Failure" + + NOTE: This flag should be set on all BULK and INTERRUPT + USB transfers which use an endpoint that can be shared + between userland and kernel. + - The "bufsize" field sets the total buffer size in bytes. If this field is zero, "wMaxPacketSize" will be used, multiplied by the "frames" field if the transfer type is isochronous. This is useful for ==== //depot/projects/usb/src/sys/dev/usb/ehci.c#34 (text+ko) ==== @@ -2217,12 +2217,6 @@ } } - if(error) - { - /* next transfer needs to clear stall */ - xfer->pipe->clearstall = 1; - } - /* transfer transferred (no callback!) */ usbd_transfer_done(xfer,error); @@ -2686,12 +2680,6 @@ /**/ ehci_add_interrupt_info(sc, xfer); - if(xfer->timeout && (!(xfer->flags & USBD_USE_POLLING))) - { - __callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), - (void *)(void *)ehci_timeout, xfer); - } - /* enqueue transfer * (so that it can be aborted through pipe abort) */ @@ -2702,7 +2690,12 @@ static void ehci_device_isoc_fs_start(struct usbd_xfer *xfer) { - /* already started, nothing to do */ + /* start timeout, if any (should not be done by the enter routine) */ + if(xfer->timeout && (!(xfer->flags & USBD_USE_POLLING))) + { + __callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + (void *)(void *)ehci_timeout, xfer); + } return; } @@ -3006,12 +2999,6 @@ /**/ ehci_add_interrupt_info(sc, xfer); - if(xfer->timeout && (!(xfer->flags & USBD_USE_POLLING))) - { - __callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), - (void *)(void *)ehci_timeout, xfer); - } - /* enqueue transfer * (so that it can be aborted through pipe abort) */ @@ -3022,7 +3009,12 @@ static void ehci_device_isoc_hs_start(struct usbd_xfer *xfer) { - /* already started, nothing to do */ + /* start timeout, if any (should not be done by the enter routine) */ + if(xfer->timeout && (!(xfer->flags & USBD_USE_POLLING))) + { + __callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + (void *)(void *)ehci_timeout, xfer); + } return; } @@ -3848,9 +3840,9 @@ { if ((xfer->pipe->methods == &ehci_device_intr_methods) && (udev->speed == USB_SPEED_HIGH)) - usbd_std_transfer_setup(xfer, setup, 0x400, 0xC00, 3); + usbd_std_transfer_setup(udev, xfer, setup, 0x400, 0xC00, 3); else - usbd_std_transfer_setup(xfer, setup, 0x400, 0x400, 1); + usbd_std_transfer_setup(udev, xfer, setup, 0x400, 0x400, 1); nqh = 1; nqtd = (1+ /* SETUP */ 1+ /* STATUS */ 1 /* SHORTPKT */) + @@ -3858,7 +3850,7 @@ } else if(xfer->pipe->methods == &ehci_device_isoc_fs_methods) { - usbd_std_transfer_setup(xfer, setup, 188, 188, 1); + usbd_std_transfer_setup(udev, xfer, setup, 188, 188, 1); if(xfer->nframes == 0) { @@ -3882,7 +3874,7 @@ } else if(xfer->pipe->methods == &ehci_device_isoc_hs_methods) { - usbd_std_transfer_setup(xfer, setup, 0x400, 0xC00, 3); + usbd_std_transfer_setup(udev, xfer, setup, 0x400, 0xC00, 3); if(xfer->nframes == 0) { @@ -3906,7 +3898,7 @@ } else { - usbd_std_transfer_setup(xfer, setup, 0x400, 0x400, 1); + usbd_std_transfer_setup(udev, xfer, setup, 0x400, 0x400, 1); } } ==== //depot/projects/usb/src/sys/dev/usb/if_aue.c#26 (text+ko) ==== @@ -272,48 +272,50 @@ [0] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = (MCLBYTES + 2), - .flags = (USBD_USE_DMA|USBD_FORCE_SHORT_XFER), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_FORCE_SHORT_XFER), .callback = &aue_bulk_write_callback, .timeout = 10000, /* 10 seconds */ }, [1] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = (MCLBYTES + 4 + ETHER_CRC_LEN), - .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_SHORT_XFER_OK), .callback = &aue_bulk_read_callback, }, [2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &aue_bulk_write_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &aue_bulk_read_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [4] = { .type = UE_INTERRUPT, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .flags = USBD_SHORT_XFER_OK, + .flags = (USBD_PIPE_BOF|USBD_SHORT_XFER_OK), .bufsize = 0, /* use wMaxPacketSize */ .callback = &aue_intr_callback, }, @@ -321,11 +323,12 @@ [5] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &aue_intr_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, }; @@ -986,25 +989,12 @@ struct aue_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[4]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AUE_FLAG_INTR_STALL; - usbd_transfer_start(xfer_other); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AUE_FLAG_INTR_STALL; + usbd_transfer_start(xfer_other); + } return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AUE_FLAG_INTR_STALL; - DPRINTF(sc, 0, "interrupt read pipe stopped\n"); - return; } static void @@ -1054,25 +1044,12 @@ struct aue_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[1]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AUE_FLAG_READ_STALL; + usbd_transfer_start(xfer_other); + } return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AUE_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AUE_FLAG_READ_STALL; - DPRINTF(sc, 0, "bulk read pipe stopped\n"); - return; } static void @@ -1170,24 +1147,11 @@ struct aue_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[0]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AUE_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AUE_FLAG_WRITE_STALL; - DPRINTF(sc, 0, "bulk write pipe stopped\n"); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AUE_FLAG_WRITE_STALL; + usbd_transfer_start(xfer_other); + } return; } ==== //depot/projects/usb/src/sys/dev/usb/if_axe.c#27 (text+ko) ==== @@ -231,23 +231,23 @@ [0] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = AXE_BULK_BUF_SIZE, - .flags = (USBD_USE_DMA|USBD_FORCE_SHORT_XFER), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_FORCE_SHORT_XFER), .callback = &axe_bulk_write_callback, .timeout = 10000, /* 10 seconds */ }, [1] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, #if (MCLBYTES < 2048) #error "(MCLBYTES < 2048)" #endif .bufsize = MCLBYTES, - .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_SHORT_XFER_OK), .callback = &axe_bulk_read_callback, .timeout = 0, /* no timeout */ }, @@ -255,28 +255,30 @@ [2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &axe_bulk_write_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &axe_bulk_read_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [4] = { .type = UE_INTERRUPT, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .flags = USBD_SHORT_XFER_OK, + .flags = (USBD_PIPE_BOF|USBD_SHORT_XFER_OK), .bufsize = 0, /* use wMaxPacketSize */ .callback = &axe_intr_callback, }, @@ -284,11 +286,12 @@ [5] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &axe_intr_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, }; @@ -972,25 +975,12 @@ struct axe_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[4]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AXE_FLAG_INTR_STALL; - usbd_transfer_start(xfer_other); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AXE_FLAG_INTR_STALL; + usbd_transfer_start(xfer_other); + } return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AXE_FLAG_INTR_STALL; - DPRINTF(sc, 0, "interrupt read pipe stopped\n"); - return; } static void @@ -1027,25 +1017,12 @@ struct axe_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[1]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AXE_FLAG_READ_STALL; + usbd_transfer_start(xfer_other); + } return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AXE_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AXE_FLAG_READ_STALL; - DPRINTF(sc, 0, "bulk read pipe stopped\n"); - return; } #if (AXE_BULK_BUF_SIZE >= 0x10000) @@ -1194,24 +1171,11 @@ struct axe_softc *sc = xfer->priv_sc; struct usbd_xfer *xfer_other = sc->sc_xfer[0]; - USBD_CHECK_STATUS(xfer); - - tr_setup: - /* start clear stall */ - usbd_clear_stall_tr_setup(xfer, xfer_other); - return; - - tr_transferred: - usbd_clear_stall_tr_transferred(xfer, xfer_other); - - sc->sc_flags &= ~AXE_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - return; - - tr_error: - /* bomb out */ - sc->sc_flags &= ~AXE_FLAG_WRITE_STALL; - DPRINTF(sc, 0, "bulk write pipe stopped\n"); + if (usbd_clear_stall_callback(xfer, xfer_other)) { + DPRINTF(sc, 0, "stall cleared\n"); + sc->sc_flags &= ~AXE_FLAG_WRITE_STALL; + usbd_transfer_start(xfer_other); + } return; } ==== //depot/projects/usb/src/sys/dev/usb/if_cdce.c#20 (text+ko) ==== @@ -109,41 +109,43 @@ [0] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = (MCLBYTES + 4), - .flags = (USBD_USE_DMA|USBD_FORCE_SHORT_XFER), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_FORCE_SHORT_XFER), .callback = &cdce_bulk_write_callback, .timeout = 10000, /* 10 seconds */ }, [1] = { .type = UE_BULK, - .endpoint = -1, /* any */ + .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = (MCLBYTES + 4), - .flags = (USBD_USE_DMA|USBD_SHORT_XFER_OK), + .flags = (USBD_PIPE_BOF|USBD_USE_DMA|USBD_SHORT_XFER_OK), .callback = &cdce_bulk_read_callback, }, [2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, .callback = &cdce_bulk_write_clear_stall_callback, .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ - .direction = -1, + .direction = UE_DIR_ANY, .bufsize = sizeof(usb_device_request_t), .flags = USBD_USE_DMA, >>> TRUNCATED FOR MAIL (1000 lines) <<<