summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Nuke all occurrences of usbd_abort_pipe() if it gets called rightmglocker2020-07-311-2/+1
| | | | | | | | | | before usbd_close_pipe(), since usbd_close_pipe() already takes care about aborting non-empty pipes. As investigated by gerhard@ usbdi.c rev. 1.57 did add usbd_abort_pipe() to usbd_close_pipe(), but the drivers didn't get cleaned up afterwards. ok gerhard@
* Remove unused function argument.mpi2020-03-161-5/+5
| | | | CID 1453335.
* use the UE_GET_XFERTYPE macro where applicablejasper2020-02-221-2/+2
| | | | ok mpi@
* Use the `iface' argument from the *attach() function instead of callingmpi2019-01-071-7/+2
| | | | | | usbd_device2interface_handle(). ok visa@
* Pass free(9) sizes for port arrays.mpi2018-11-101-14/+10
| | | | ok tedu@, visa@
* A pile of sizes to free(9). In test for a few days in snapshots.deraadt2017-04-081-6/+6
| | | | | Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
* Avoid calling usbd_set_config_index() in *_attach() and let the stackmpi2016-09-021-9/+5
| | | | | | | do it instead. If anything bad happen due to a malformed descriptor it makes no sense to try to attach a driver, and bail before probing.
* Unconnected xhci(4) super speed ports may come up with the XHCI_PS_WRC,kettenis2015-11-291-1/+7
| | | | | | | | | | | | indicating a warm reset has happened. Communicate this as UPS_C_BH_PORT_RESET to the upper layers and make uhub(4) clear this bit such that we receive further connection status change notifications. Make sure we only do this for super speed (USB 3.0) hubs as high speed (USB 2.0) hubs use the same bit for UPS_C_PORT_L1. Make hotplugging USB 3.0 devices work on my MacBookPro12,1. ok mpi@
* Clear the UPS_C_PORT_RESET feature when exploring. Apparently xhci(4) superkettenis2015-11-291-1/+7
| | | | | | | | | | speed ports may have the XHCI_PS_PRC bit set after xhci(4) attaches. Just clearing this bit isn't enough though, since the device is already connected and no further connection status change is signalled. So fake one. This makes the integrated SD card reader in the MacBookPro12,1 attach. ok mpi@
* Move the logic to handle a "connect status change" from uhub_explore()mpi2015-06-291-124/+134
| | | | | | | | into its own functions. Needed for upcoming "port link state" change handling. Tested by sobrado@
* Make xhci(4)'s root hub report the same status bits as physical USB3 hubs.mpi2015-06-221-9/+7
| | | | | | | | | | There's not bit to indicate the speed of a USB3.0 device attached to a hub port so do not abuse the PORT_TEST bit. Instead make the xhci(4) root hub report the PORT_POWER_SS bit when appropriate and use it to determin the speed of a new device. While here make the root hub report the link state and config error, from FreeBSD.
* Bring back r1.78 and r1.79, now that ajactouto@'s regression hasmpi2015-06-151-14/+33
| | | | | | | | been found: it was a hardware failure. When a bus is explored, do not probe the ports which status hasn't changed. This saves a lot of I/O when attaching/detaching devices and might help with some timing related problems.
* KNF.uebayasi2015-02-121-2/+2
|
* Report the TT Think Time of USB2.0 Hubs.mpi2015-01-021-2/+3
|
* More malloc() -> mallocarray() in the kernel.doug2014-12-091-3/+3
| | | | ok deraadt@ tedu@
* Revert the logic to skip ports which status hasn't changed, it introducesmpi2014-11-231-33/+14
| | | | a regression reported by ajacoutot@.
* Force a status check of all the ports of a newly attached hub. In thempi2014-11-201-6/+7
| | | | | | | | interrupt routine properly initialize a variable. Finally stop talking about the "bus event handler thread". Our USB stack has only one thread doing discovery for all buses. Prompted by a report from Patrick Wildt.
* When a bus is explored, do not probe the ports which status hasn'tmpi2014-11-111-15/+32
| | | | | | | | changed. This saves a lot of I/O when attaching/detaching devices and might help with some timing related problems. Has been in snap for ten days, committing now so that people testing xhci(4) test the same thing w/ snapshots and their own kernel.
* Add some fields needed for TT support.mpi2014-11-101-1/+3
|
* Give Super-Speed hubs a chance to route USB 3.0 transfers.mpi2014-11-071-1/+16
| | | | | | | | | Without knowing their depth, hubs couldn't find the bits correspdonding to their downstream port in the route-string. Now USB 3.0 devices just work(tm) anywhere in your hub chain. This commit would not have been possible without the cheese provided by miod@ at #HAMoween.
* Remove the port status argument from usbd_reset_port(). We don't dompi2014-11-011-2/+2
| | | | | anything with it and it simplifies this mess in order to implement warm reset.
* Check that the speed of a new device does not exceed its parent's speedmpi2014-10-011-1/+8
| | | | | | | | | prior to calling usbd_new_device(). This will let us set the specified default Max Packet Size before opening the control pipe and reduces spaghetti! ok stsp@
* Ask for the descriptor size corresponding to the number of ports presentmpi2014-08-101-4/+5
| | | | in the hub, not from some random value from the stack.
* Correctly recognize Super Speed devices, this is part of the work tompi2014-08-091-6/+24
| | | | | | | | | | | | be able to use USB 3.0 devices behind an external hub. This is a bit tricky because the SS status use a different power bit that maps to the Low speed one. So no longer accept devices without power bit and fallback to the parent hub's speed in case the status does not report any particular speed. Note that xhci(4) root hubs still set the traditionnal UPS_PORT_POWER bit with the correct device speed.
* Handle super speed hub descriptors.mpi2014-08-091-10/+27
|
* Do not store the whole USB hub descriptor in the "struct usbd_hub"mpi2014-08-091-14/+10
| | | | to help integrating super speed hubs that use a different descriptor.
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-9/+9
| | | | after discussions with beck deraadt kettenis.
* autoconf(9) is your friend and it knows you more than you think. Itmpi2014-07-091-39/+11
| | | | | | | | | even knows your children! So let him handle the seperation correctly. Do not rewrite your own custom config_detach_children(9) and as a bonus start removing the usbd_port tentacles from the stack. ok pirofti@, yuo@, miod@, deraadt@
* Apart from the early exploration done to find a console keyboard duringmpi2014-05-281-1/+4
| | | | | | | | | | | the boot process, USB devices must be attached or detached from the usb task thread in order to avoid races with periodical explorations issued by uhub(4) interrupts. Respect this rule when detaching root hubs during a suspend/resume cycle and avoid some hangs due to the aforementioned race. Tested by Mattieu Baptiste, thanks!
* Kill dead links.mpi2014-03-111-5/+1
|
* Recognize super speed devices, note that this driver sill usesmpi2014-03-081-2/+4
| | | | | | non-superspeed hub descriptors. This is the minimal change I came with to be able to properly attach and use USB 3.0 devices attached to a xHCI root hub, uhub(4) clearly needs some love.
* Indtroduce usbd_get_hub_descriptor() to start cleaning uhub(4)'s mess.mpi2014-03-071-15/+10
| | | | | This will help us deal with the different hub device descriptors used by super speed devices.
* Make uhub_explore() return an int rather than a usbd_satus. This hasmpi2013-10-191-7/+8
| | | | | | | no direct impact since its return value is never checked but it allows me to get rid of one (usless) status value. Note that usbd_status should be used for USB transfers.
* Simplify the debug output to help diagnose problems without needingmpi2013-05-211-59/+20
| | | | | | special glasses. No object change if UHUB_DEBUG is not defined.
* Get rid of various 'typedef struct' definitions and use plain structuremglocker2013-04-151-10/+10
| | | | | | | | | definitions instead. We don't change usb.h for now to stay compatible with userland. Tested by mpi@ on macppc and myself on i386. ok mpi@
* proc.h is way too much header for usb to handle.tedu2013-03-281-2/+1
|
* Avoid a potential NULL dereference if nports == 0.stsp2011-09-291-4/+5
| | | | | | | Found by Amit Kulkarni using clang. Fix from jakemsr; his diff was sitting on tech@ since February. ok myself, phessler, sthen, jasper and also pirofti, mikeb, krw (back in February)
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-4/+1
| | | | | | | | that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
* garbage collect "usb events". without /dev/usb there is no way to accessjakemsr2011-01-251-6/+1
| | | | | | them from userland, and nothing in the kernel uses them. ok krw@, miod@
* * replace per-driver dying and/or other state variables with use ofjakemsr2010-12-061-3/+3
| | | | | | | usbd_deactivete() and usbd_is_dying() * use usbd_deactivate() in activate()/DEACTIVATE * convert a few more direct checks of the associated bus' dying flag with usbd_is_dying()
* add a 'dying' flag to struct usbd_bus. use this to signify the busjakemsr2010-09-231-1/+6
| | | | | | | | | is dying, instead of setting a flag in struct usb_softc. as usbd_device_handle has a pointer to the usbd_bus it's attached to, usb devices, and functions they run or functions run on their behalf, can now easily check if their bus is dying. use this to stop usbd_do_request* from running and the usb task thread from adding new tasks when a device's bus is dying.
* instead of running usb_explore() from individual kthreads for eachjakemsr2010-09-231-2/+2
| | | | | | | USB bus, make usb_explore() a usb_task. reduces races during normal USB device detach, since now usb_tasks and detach happen in the same process. ok yuo@, matthew@ helped with the task thread loop
* The size of sc_status[] (the buffer for USB hub's interrupt pipe) will besasano2010-09-211-5/+17
| | | | | | | | | | | | | | determined by bNbrPorts in hub descriptor. USB hub sends status packet to host, it contains status bits for each port and hub itself. So, the packet size is ceil((port + 1) / 8) bytes. If host requests smaller than that size, the hub behavior is undefined. Some hub (Intel's RMH for example) sends whole status every time, it makes babble of USB. This is the reason that uhub_intr() of old code was suffered from USBD_IOERROR, Okay deraadt@ and yuo@.
* do not need to pad up the uhub allocation anymore, from miodderaadt2009-11-131-3/+2
|
* Avoid using the trick of malloc'ing more than a struct to grow the arrayderaadt2009-11-121-1/+11
| | | | | | | | of the last element. Bad technique. Use a pointer to the array. The author (or later people) will often not pay attention to the consequences of structure padding & alignment issues when they add new fields to the base structure, and there will be fireworks. tested by jasper, too
* Get rid of devact enum, substitute it with an int and coresponding defines.pirofti2009-10-131-3/+3
| | | | | | This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* treat usb vendor/product names as a locator, and have usbd_print handle it,deraadt2007-10-111-6/+1
| | | | | | so that it shows up before the :. as a result, all the usb devices do not need to have name printing code anymore. all this now works and prints nicely because usbd_probe_and_attach() is serialized. ok kettenis
* Remove the definition and usage of the USB_DECLARE_DRIVER_CLASS andmbalmer2007-06-141-2/+17
| | | | | | | | USB_DECLARE_DRIVER macros. No binary change. ok dlg.
* Remove the definition and use of the device_ptr_t which was a struct device *.mbalmer2007-06-121-2/+2
| | | | | | No binary change. ok mk.