summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_transfer.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid to check the same cache line/variable from all the lockingattilio2012-01-281-0/+1
| | | | | | | | | | | | | | | | primitives by breaking stop_scheduler into a per-thread variable. Also, store the new td_stopsched very close to td_*locks members as they will be accessed mostly in the same codepaths as td_stopsched and this results in avoiding a further cache-line pollution, possibly. STOP_SCHEDULER() was pondered to use a new 'thread' argument, in order to take advantage of already cached curthread, but in the end there should not really be a performance benefit, while introducing a KPI breakage. In collabouration with: flo Reviewed by: avg MFC after: 3 months (or never) X-MFC: r228424
* adapt usb transfer code for SCHEDULER_STOPPEDavg2011-12-211-3/+3
| | | | | | | | | | | | When SCHEDULER_STOPPED() is true the mtx_owned() call may return an unexpected and thus meaningless result. So, in the code paths that can be reached when SCHEDULER_STOPPED() is true we need to protect the mtx_owned() calls with the SCHEDULER_STOPPED() checks and ensure that an appropriate branch is taken in each case. Reviewed by: hselasky MFC after: 3 months X-MFC after: r228424
* Style change.hselasky2011-11-121-2/+2
| | | | | | | | | | | | - Make it easier to port the USB code to other platforms by only using one set of memory functions for clearing and copying memory. None of the memory copies are overlapping. This means using bcopy() is not required. - Fix a compile warning when USB_HAVE_BUSDMA=0 - Add missing semicolon in avr32dci. - Update some comments. MFC after: 1 week
* Avoid starting the USB transfer if an error is already pending.hselasky2011-09-201-4/+6
| | | | | | | | | This change fixes a race in device side mode during clear-stall from host, which can cause data to be sent too early on the given endpoint. Approved by: re (kib) MFC after: 1 week
* Reset clear-stall error counter before setting up the USB control transfers.hselasky2011-06-061-0/+5
| | | | MFC after: 14 days
* - Improvements to USB PF solutionhselasky2011-04-031-3/+26
| | | | | | | | | | | | | | - Add more fields for USB device and host mode - Add more information to USB PF header so that decoding can easily be done by software analyzer tools like Wireshark. - Optimise usbdump to display USB streams in text format more efficiently. - Software using USB PF must be recompiled after this commit, due to structure changes. MFC after: 7 days Approved by: thompsa (mentor)
* - Add support for software pre-scaling of ISOCHRONOUS transfers.hselasky2011-02-281-0/+2
| | | | | MFC after: 14 days Approved by: thompsa (mentor)
* Minor cleanup:hselasky2011-02-091-0/+2
| | | | | | | | - use device_printf() instead of printf() to give more accurate warnings. - use memcpy() instead of bcopy(). - add missing #if's for non-FreeBSD compilation. Approved by: thompsa (mentor)
* Make USB packet filtering code optional.hselasky2011-01-181-3/+6
| | | | Approved by: thompsa (mentor)
* Remove unneeded includes of <sys/linker_set.h>. Other headers that usejhb2011-01-111-1/+0
| | | | | | it internally contain nested includes. Reviewed by: bde
* Adds a USB packet filter feature to the stack that it could captureweongyo2010-11-221-0/+8
| | | | | | | | | packets which go through each USB host controllers. Its implementations are almost based on BPF code and very similar with it except it's little bit customized for USB packet only. The userland program usbdump(8) would be committed soon. Discussed with: hps, thompsa, yongari
* This commit adds full support for USB 3.0 devices in host and devicehselasky2010-10-041-45/+137
| | | | | | | | | | | | | | | | mode in the USB core. The patch mostly consists of updating the USB HUB code to support USB 3.0 HUBs. This patch also add some more USB controller methods to support more active-alike USB controllers like the XHCI which needs to be informed about various device state events. USB 3.0 HUBs are not tested yet, due to lack of hardware, but are believed to work. After this update the initial device descriptor is only read twice when we know that the bMaxPacketSize is too small for a single packet transfer of this descriptor. Approved by: thompsa (mentor)
* Change argument for usbd_get_dma_delay() from USB bus to USB device, somethompsa2010-09-021-8/+14
| | | | | | | embedded hardware needs to know exactly which device is in question before it exactly can decide the required delay. Submitted by: Hans Petter Selasky
* Add support for LOW speed BULK transfers. This mode is not recommended by thethompsa2010-06-221-1/+1
| | | | | | USB 2.0 standard, though some USB devices use it anyway. Submitted by: Hans Petter Selasky
* Use a more obvious prefix for the USB control (endpoint 0) transfers ratherthompsa2010-04-221-12/+12
| | | | than default_*.
* Properly name the sxlocks, mutexes and condvars.thompsa2010-04-221-1/+1
|
* Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this hadthompsa2010-04-221-1/+1
| | | | | | the illusion of a tunable setting but was always turned on regardless. MFC after: 1 week
* Make sure there is a way to reset the endpoint FIFO on transfer errors forthompsa2010-03-111-4/+18
| | | | | | ISOCHRONOUS transfers Submitted by: Hans Petter Selasky
* Remove overuse of exclamation marks in kernel printfs, there mere fact athompsa2009-11-261-10/+10
| | | | | | message has been printed is enough to get someones attention. Also remove the line number for DPRINTF/DPRINTFN, it already prints the funtion name and a unique message.
* Improve High Speed slot allocation mechanism by moving the computation to thethompsa2009-11-221-3/+17
| | | | | | endpoint rather than per xfer and provide functions around get/free of resources. Submitted by: Hans Petter Selasky
* improve support for high speed isochronous endpoints which does not run 1:1,thompsa2009-11-081-0/+23
| | | | | | but needs intervalling 1:2, 1:4 or 1:8 Submitted by: Hans Petter Selasky
* Fix a corner case where usbd_transfer_drain() can return too early if thethompsa2009-11-011-1/+19
| | | | | | | callback has dropped the mutex, leading to a panic. Submitted by: HPS MFC after: 3 days
* Add extra safety locking when clobbering xfer->flags_int.started in start andthompsa2009-09-281-7/+21
| | | | | | | stop functions, because xfer->flags_int is also updated by the USB controller, under the controller lock. Submitted by: Hans Petter Selasky
* MFp4 @ 168387thompsa2009-09-281-3/+3
| | | | | | | | | | | | | | | | - clean up USB detach logic. There seems to be some problems detaching multiple USB HUBs connected in series from the root. - after this patch the rule is: 1) Always use device_detach() on the USB HUB first. 2) Never just device_delete_child() on the USB HUB, because that function will traverse to all the device leaves and free them first, and then the USB stack will free the devices twice which doesn't work very well. - make sure the did DMA delay gets set after the timeout has elapsed to make logic more clear. There is no functional difference. Submitted by: Hans Petter Selasky
* - Patch to allow USB controller to resume operation afteralfred2009-08-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | being polled. - Remove the need for Giant from the USB HUB driver. - Leave device unconfigured instead of disabling the USB port when Huawei Autoinstall disk detection triggers. This should fix problems that the Huawei device is not detected after Autoinstall eject is issued. - Reported by: Nikolay Antsiferov - Fix memory use after free race for USB character devices. - Reported by: Lucius Windschuh - Factor out the enumeration lock into three functions to make the coming newbus lock conversion more easy. - usbd_enum_lock - usbd_enum_unlock - usbd_enum_is_locked Submitted by: hps
* USB CORE:alfred2009-07-301-6/+90
| | | | | | | | | | | - Add minimum polling support to drive UMASS and UKBD in case of panic. - Add extra check to ukbd probe to fix problem about mouse devices attaching like keyboards. - P4 ID: 166148 Submitted by: hps Approved by: re
* Sync to p4thompsa2009-06-271-8/+39
| | | | | | | | | - Add support for devices that handle set and clear stall in hardware. - Add missing get timestamp function - Add more xfer flags Submitted by: Hans Petter Selasky Approved by: re (kib)
* Fix a typeo in the frame len function to unbreak the build, make it shorterthompsa2009-06-231-2/+2
| | | | while I am here.
* - Make struct usb_xfer opaque so that drivers can not access the internalsthompsa2009-06-231-33/+195
| | | | - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h
* s/usb2_/usb_|usbd_/ on all function names for the USB stack.thompsa2009-06-151-197/+197
|
* Remove usb2_cv_* and just use the kernel condvar implementation, it was neededthompsa2009-06-151-4/+4
| | | | | earlier since condition variables didnt work with Giant but this was fixed 10 months ago.
* Rename usb pipes to endpoints as it better represents what they are, and structthompsa2009-06-071-65/+65
| | | | usb_pipe may be used for a different purpose later on.
* Revert the size_t part of the last commit for the moment, this blows up thethompsa2009-05-301-8/+8
| | | | USB_ADD_BYTES macro.
* s/usb2_/usb_/ on all typedefs for the USB stack.thompsa2009-05-291-25/+25
|
* s/usb2_/usb_/ on all C structs for the USB stack.thompsa2009-05-281-99/+99
|
* Improve device mode (gadget) stall handling.thompsa2009-05-211-2/+6
| | | | | | | | | Some hardware easily comes out of sync with regard to whether the current or the next control transfer should be stalled, if a stall command is always issued before receiving the SETUP packet. After this patch the stall command will only be issued when a transfer should actually be stalled. Submitted by: Hans Petter Selasky
* Use enums for speed and rev data types.thompsa2009-05-211-9/+9
|
* - rename usb2_mode to usb_mode [1]thompsa2009-05-211-9/+9
| | | | | | - change variable types to use the enum Submitted by: Hans Petter Selasky [1]
* The transfer must return USB_ERR_CANCELLED when the device is gone due to thethompsa2009-05-131-1/+5
| | | | | | way usb drivers work. Submitted by: Hans Petter Selasky
* Revert part of r191494 which used the udev state to mark suspending, this needsthompsa2009-05-051-9/+8
| | | | | | | | to be set via two variables (peer_suspended and self_suspended) and can not be merged into one. Submitted by: Hans Petter Selasky Pointy hat: me
* Track the usb device state as its powered on, addressed and configured. This ↵thompsa2009-04-251-15/+28
| | | | | | | | | helps to avoid touching the device when it is not going to respond and would otherwise timeout. Implement the suspend tracking as a udev state too.
* MFp4 //depot/projects/usb@160706thompsa2009-04-221-1/+10
| | | | | | Resolve possible device side mode deadlock by creating another thread. Submitted by: Hans Petter Selasky
* Provide a better commit log for r190735, forced by making a whitespace change.thompsa2009-04-061-1/+1
| | | | | | | | | | | | Refactor how we interface with the root HUB. This is achieved by making a direct call from usb2_do_request to the host controller for root hub requests, this call will perform the controller specific register read/writes and return the error code. This cuts out a lot of code in the host controller files and saves one thread per USB bus. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159946thompsa2009-04-051-38/+28
| | | | | | | Some cancelable flags are always true. Substitute these away. These cancelable flags were mostly useful with the root HUB which is now handled differently. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159922thompsa2009-04-051-1/+4
| | | | | | | Refactor how we interface with the root HUB. This cuts around 1200 lines of code totally and saves one thread per USB bus. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159909thompsa2009-04-051-76/+124
| | | | | | | | | | | | | - make usb2_power_mask_t 16-bit - remove "usb2_config_sub" structure from "usb2_config". To compensate for this "usb2_config" has a new field called "usb_mode" which select for which mode the current xfer entry is active. Options are: a) Device mode only b) Host mode only (default-by-zero) c) Both modes. This change was scripted using the following sed script: "s/\.mh\././g". - the standard packet size table in "usb_transfer.c" is now a function, hence the code for the function uses less memory than the table itself. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb @159479,159502,159516,159522,159529thompsa2009-03-201-17/+34
| | | | | | | | Workaround for buggy USB hardware not handling new SETUP packet before STATUS stage is complete, this allows xfers to endpoint0 to return a short frame. Submitted by: Hans Petter Selasky Reported by: me
* MFp4 //depot/projects/usb @159431,159437,159438thompsa2009-03-201-29/+29
| | | | | | | - start using the new USB typedefs in the USB core - Remove usage of USB_ADD_BYTES() Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159392thompsa2009-03-201-10/+27
| | | | | | Add ifdefs for making parts of usb conditional. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb @159430thompsa2009-03-201-1/+0
| | | | | | | | | | - Move tunable defines into usb_core.h and dependancy towards usb_defs.h - Leave hardcoded defines in "usb_defs.h". - Allow overriding all tunable defines. - Add more customisable typedefs. - Correct maximum device number. Submitted by: Hans Petter Selasky
OpenPOWER on IntegriCloud