summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_hub.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r310242:hselasky2017-01-091-0/+25
| | | | | | | | Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid boot panics in conjunction with the recently added EARLY_AP_STARTUP feature. The panics happen due to using kernel facilities like callouts too early. Tested by: jhb @
* MFC r286773:hselasky2015-08-291-2/+2
| | | | | Improve the realtime properties of USB transfers for embedded systems like RPI-B and RPI-2.
* MFC r279270:hselasky2015-03-051-6/+14
| | | | | | | | Add ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo. PR: 198015 PR: 198019 PR: 198026
* MFC r274020:hselasky2014-11-291-2/+2
| | | | Reduce boot verbosity.
* MFC r272733, r272807 and r272822:hselasky2014-10-271-11/+81
| | | | | Add support for disabling USB enumeration or USB port power in general or on selected USB HUBs.
* MFC r261270:n_hibma2014-06-181-1/+2
| | | | | | | | | Fix the ordering of the arguments to printf in uhub_child_location_string(). This produced bogus information in dev.<USB driver>.<id>.%location output from sysctl.
* MFC r267240:hselasky2014-06-111-53/+109
| | | | | | | | | Resolve a deadlock setting the USB configuration index from userspace on USB HUBs by moving the code into the USB explore threads. The deadlock happens because child devices of the USB HUB don't have the expected reference count when called from outside the explore thread. Only the HUB device itself, which the IOCTL interface locks, gets the correct reference count.
* MFC r260588 and r260589:hselasky2014-01-241-9/+234
| | | | | | | | | | - Separate I/O errors from reception of STALL PID. - Implement better error recovery for Transaction Translators, TTs, found in High Speed USB HUBs which translate from High Speed USB into FULL or LOW speed USB. In some rare cases SPLIT transactions might get lost, which might leave the TT in an unknown state. Whenever we detect such an error try to issue either a clear TT buffer request, or if that is not possible reset the whole TT.
* MFC r257206:hselasky2013-10-301-5/+33
| | | | | | | | Fix a deadlock when trying to power off a USB device. The deadlock happens because the code in question is trying to modify the parent USB port registers outside the USB explore thread. Approved by: re (glebius)
* Don't issue USB resume signalling in USB device mode, if the USB powerhselasky2013-09-121-1/+2
| | | | | | | | mode is ON and suspend is detected. This confuses iPads running in USB host mode at least. MFC after: 1 week Approved by: re (hrs)
* - Try to fix build of 32-bit compatibility USB support for FreeBSD andhselasky2013-08-121-1/+0
| | | | | | | | | | | Linux targets without breaking the existing IOCTL API. - Remove some not-needed header file inclusions. - Wrap a long line. MFC after: 1 week Reported by: Damjan Jovanovic <damjan.jov@gmail.com>
* Fix some statical clang analyzer warnings.hselasky2013-05-251-1/+0
|
* - Add more defines to limit USB memory usage and number of allocationshselasky2013-05-031-7/+19
| | | | | | | | in reduced memory systems. - Split allocation and freeing of the configuration descriptor into a separate function, so that the configuration descriptor can be made fixed size to save memory allocations. This applies for both device and host mode.
* Resolve a LOR after r246616. Protect control requests using the USB devicehselasky2013-02-131-4/+9
| | | | | | | | | enumeration lock. Make sure all callers of usbd_enum_lock() check the return value. Remove the control transfer specific lock. Bump the FreeBSD version number, hence external USB modules may need to be recompiled due to a USB device structure change. MFC after: 1 week
* Add defines to more easily allow a single threaded version of the FreeBSDhselasky2013-02-051-1/+1
| | | | USB stack. This is useful for non-kernel purposes, like the loader.
* Modify the FreeBSD USB kernel code so that it can be compiled directlyhselasky2013-01-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | into the FreeBSD boot loader, typically for non-USB aware BIOSes, EFI systems or embedded platforms. This is also useful for out of the system compilation of the FreeBSD USB stack for various purposes. The USB kernel files can now optionally include a global header file which should include all needed definitions required to compile the FreeBSD USB stack. When the global USB header file is included, no other USB header files will be included by default. Add new file containing the USB stack configuration for the FreeBSD loader build. Replace some __FBSDID()'s by /* $FreeBSD$ */ comments. Now all USB files follow the same style. Use cases: - console in loader via USB - loading kernel via USB Discussed with: Hiroki Sato, hrs @ EuroBSDCon
* Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.hselasky2012-10-261-2/+1
| | | | | | | | Rearrange the tunables and belonging sysctl declarations, so that they are next to eachother. Submitted by: n_hibma @ MFC after: 1 week
* Make several timing parameters of the USB enumeration sequence tuneable.hselasky2012-10-241-6/+6
| | | | | | | | | | | Also update the port reset time from 250ms to 50ms. Some USB devices have a hard limit in hardware at 222ms for the port reset time and will not enumerate unless this delay is closer to the usb.org defined value. This patch can fix enumeration with some USB devices. Tested by: Guido van Rooij Submitted by: Nick Hibma MFC after: 1 week
* Style.hselasky2012-10-021-1/+1
| | | | MFC after: 1 week
* Remove unused field.hselasky2012-10-021-4/+0
| | | | MFC after: 1 week
* Inherit USB mode from RootHUB port where the USB device is connected.hselasky2012-10-011-1/+4
| | | | | | | Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs. This simplifies some checks in the USB controller drivers. MFC after: 1 week
* Add support for the so-called streams feature of BULK endpointshselasky2012-08-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in SUPER-speed mode, USB 3.0. This feature has not been tested yet, due to lack of hardware. This feature is useful when implementing protocols like UASP, USB attached SCSI which promises higher USB mass storage throughput. This patch also implements support for hardware processing of endpoints for increased performance. The switching to hardware processing of an endpoint is done via a callback to the USB controller driver. The stream feature is implemented like a variant of a hardware USB protocol. USB controller drivers implementing device mode needs to be updated to implement the new "xfer_stall" USB controller method and remove the "xfer" argument from the "set_stall" method. The API's toward existing USB drivers are preserved. To setup a USB transfer in stream mode, set the "stream_id" field of the USB config structure to the desired value. The maximum number of BULK streams is currently hardcoded and limited to 8 via a define in usb_freebsd.h. All USB drivers should be re-compiled after this change. LibUSB will be updated next week to support streams mode. A new IOCTL to setup BULK streams as already been implemented. The ugen device nodes currently only supports stream ID zero. The FreeBSD version has been bumped. MFC after: 2 weeks
* Add support for Multi-TT mode of modern USB HUBs.hselasky2012-04-291-119/+106
| | | | | | | | | | This will give you more bandwidth for isochronous FULL speed applications connected through a High Speed HUB. This patch has been tested with XHCI and EHCI. MFC after: 1 week
* Fix compiler warnings, mostly signed issues,hselasky2012-04-021-3/+3
| | | | | | when USB modules are compiled with WARNS=9. MFC after: 1 weeks
* Improve support for USB 3.0 HUBs. In certain states wehselasky2012-01-131-6/+8
| | | | | | should do a warm reset instead of the default reset. MFC after: 5 days
* Correct use of USB 3.0 POWER bit in the port status register,hselasky2012-01-131-8/+11
| | | | | | | hence it was overlapping the USB 3.0 root HUB's speed bits. Reported by: Kohji Okuno MFC after: 1 week
* - Try to fix support for USB 3.0 HUBs.hselasky2012-01-121-12/+39
| | | | | | - Try to fix support for USB 3.0 suspend and resume. MFC after: 1 week
* Fix for race against user-space applications trying to change thehselasky2011-12-211-0/+9
| | | | | | | configuration on USB HUBs. PR: kern/163091 MFC after: 1 week
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Fix suspend and resume of FULL and HIGH speed USB deviceshselasky2011-10-261-0/+1
| | | | | | | in the generic XHCI driver. There appears to be some minor logic missing for this feature to work. MFC after: 3 days
* - Add additional information to the PnP info of USB HUBs children whichhselasky2011-06-241-1/+5
| | | | | | | | | | is now required by bus_autoconf. - Allow interface class matching even if device class is vendor specific. - Update bus_autoconf tool to not generate system and subsystem match lines for the nomatch event. PR: misc/157903 MFC after: 14 days
* Improve enumeration of Low- and Full-speed devices connected through ahselasky2011-06-061-3/+24
| | | | | | | | | High-speed USB HUB by resetting the transaction translator (TT) before trying re-enumeration. Also when clear-stall fails multiple times try a re-enumeration. Suggested by: Trevor Blackwell MFC after: 14 days
* Remove unneeded includes of <sys/linker_set.h>. Other headers that usejhb2011-01-111-1/+0
| | | | | | it internally contain nested includes. Reviewed by: bde
* Add support for setting per-interface PnP information.hselasky2010-10-271-2/+4
| | | | | Submitted by: Nick Hibma Approved by: thompsa (mentor)
* This commit adds full support for USB 3.0 devices in host and devicehselasky2010-10-041-76/+354
| | | | | | | | | | | | | | | | 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)
* Serialise USB re-enumeration with the USB explore thread.hselasky2010-10-041-0/+22
| | | | | | | This patch can solve problems when multiple USB devices are re-enumerated at the same time on the same bus. Approved by: thompsa (mentor)
* Reduce the need to accesss struct usb_device by providing functions to accessthompsa2010-09-021-1/+2
| | | | | | the product, manufacturer and serial strings. Submitted by: Hans Petter Selasky
* Add support for power mode filtering as some USB hardware does not supportthompsa2010-09-021-2/+29
| | | | | | power saving. Submitted by: Hans Petter Selasky
* Change argument for usbd_get_dma_delay() from USB bus to USB device, somethompsa2010-09-021-2/+3
| | | | | | | 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 missing MODULE_VERSION() definitions, this resolves problems aroundthompsa2010-09-011-0/+1
| | | | | | | | duplicate module loads. PR: usb/125736 Submitted by: danger, mm Reviewed by: hselasky
* Provide more information about the device location in the USB system.thompsa2010-05-121-2/+4
| | | | Submitted by: Hans Petter Sekasky
* If a USB device is suspended and a USB set config request is issued when thethompsa2010-05-121-41/+83
| | | | | | | | | | USB enumeration lock is locked, then the USB stack fails to resume the device because locking the USB enumeration lock is part of the resume procedure. To solve this issue a new lock is introduced which only protects the suspend and resume callbacks, which can be dropped inside the usbd_do_request_flags() function, to allow suspend and resume during so-called enumeration operations. Submitted by: Hans Petter Selasky
* Use a more obvious prefix for the USB control (endpoint 0) transfers ratherthompsa2010-04-221-1/+1
| | | | than default_*.
* 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.
* Provide tunables for some of the usb sysctls that affect boot behaviour.thompsa2009-11-221-0/+2
| | | | Submitted by: Andriy Gapon
* Improve High Speed slot allocation mechanism by moving the computation to thethompsa2009-11-221-14/+167
| | | | | | endpoint rather than per xfer and provide functions around get/free of resources. Submitted by: Hans Petter Selasky
* MFp4 @ 168387thompsa2009-09-281-22/+41
| | | | | | | | | | | | | | | | - 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-8/+21
| | | | | | | | | | | | | | | | | | | | | | | 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
* Temporarily revert the new-bus locking for 8.0 release. It will bejhb2009-08-201-14/+5
| | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio
* Make the newbus subsystem Giant free by adding the new newbus sxlock.attilio2009-08-021-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
OpenPOWER on IntegriCloud