summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/ehci.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Only check if the abort transfer is the interrupt one if the pipe ismpi2014-08-051-2/+2
| | | | | | | | | | | opened with a callback. If a driver opens an interrupt pipe without callback function, like umct(4) does with one of its bulk in endpoints being reported as an interrupt endpoint, then we can end up aborting a transfer which is different from the interrupt one. Issue reported by Roberto E. Vargas Caballero, ok deraadt@
* don't return unitialised memory on error in ehci_alloc_sqtd()jsg2014-08-031-2/+2
| | | | | | | | | It seems mpi introduced a problem into ehci.c rev 1.162 two weeks ago. An error check that used to return NULL now jumps to the end of the function, but sqtd isn't initialised at that point. ok miod@ deraadt@
* Protect the freelists of transfer descriptors with the appropriate splmpi2014-07-121-18/+17
| | | | | | | | | | | so that we do not end up allocating two times new descriptors. This happens if a thread finds an empty list, start allocating, got interrupted and the interrupt also finds an empty list. Fix an issue reported by Nils Frohberg. ok yuo@, pirofti@
* Use the correct poll interval for HS root hub before it gets copied, nompi2014-07-121-2/+2
| | | | real impact since this descriptor is not used in the kernel. From NetBSD.
* Do not set the bus dying flag during DVACT_DEACTIVATE otherwise thempi2014-07-101-5/+1
| | | | | | | | explore thread will not disconnect the root hub. The flag will be set before detaching the children, like it is done during a suspend- resume cycle. Fix a panic when unplugging a cardbus *hci(4).
* Adds an optional bus function to set the address of a new device andmpi2014-07-091-1/+2
| | | | | | | | | explicitly set it when required. Right now xhci(4) does not need such function because it assigns addresses when the first pipe of a device is opened. ok yuo@, pirofti@
* Clearing the data toggle bit only makes sense for endpoints that use it,mpi2014-06-041-11/+1
| | | | | | since this function is optional get rid of the no-op ones. ok ratchov@
* Use C99 initializers for pipe and bus methods.mpi2014-06-041-42/+42
| | | | | | | Apart from improving readability, this will help us reduce the number of no-op functions now that some of them are optional. ok ratchov@
* Remove unused fields from the pipes.mpi2014-05-301-21/+1
|
* Reduce the difference between HC drivers by always passing a genericmpi2014-05-161-23/+26
| | | | | usbd_xfer pointer to the routines processing finished transfers to make it crystal clear that the timeout and abort logic is the same everywhere.
* There is no need to remember which usb(4) device is the child of an USBmpi2014-05-161-8/+6
| | | | host controller because autoconf(9) already does it.
* Plug an xfer leak when detaching root hubs.mpi2014-05-091-16/+5
| | | | | | | | | This leak is similar to the public xfer leak #1 that was affecting device interrupt pipes except that root hubs are rarely detached. Note that this xfer is never associated to any TD and is just used to indicate that some of the HC ports has changed status, so there is no need to flag it as "done" before completing it.
* Plug one more xfer leak.mpi2014-05-081-1/+4
| | | | | | Now that aborting interrupt pipes does not prevent us from freeing the associated xfer, make sure to flag this xfer as "done" even if there's no need to abort it in hardware.
* Make use of usbd_xfer_isread() instead of rerolling it everywhere.mpi2014-05-041-48/+25
| | | | | | | This has the side effect of simplifying and reducing the differences between the various *hci_alloc_*_chain() functions since they are the principal place where we want to known if the transfer is a read or a write.
* Get rid of EHCI_NULL. No functional change.mpi2014-05-041-20/+18
|
* Finally plug the public xfer leak #1 in our USB stack.mpi2014-04-291-6/+3
| | | | | | | | | | | | | | | | Every call to usbd_abort_pipe() on an interrupt pipe would simply reset the intrxfer pointer, which would prevent usbd_close_pipe() to free it. Since we abort pipes in a lot of situations: when a device is detached, when a USB-to-serial adapter is closed, when an error occurs, when the machine is suspended, etc, this would result in hundreds of leaked xfers in most of my machines. xhci(4) is not affected, but you can't enable it right now since the stack is not ready :) While here put a KASSERT() to make sure drivers are only calling the interrupt abort method for intrxfer, if that's not the case, please let met know.
* Get rid of the per-softc freelist of transfer descriptors and use ampi2014-04-291-28/+27
| | | | | | per-driver pool(9) instead. With inputs from mikeb@
* Start de-obfuscating the HC drivers.mpi2014-04-271-126/+106
| | | | | | | | | Since pipe methods have an xfer argument, always use it to get acces to various data structure (pipe, bus, device) instead of having a different way to get a pointer to these descriptors in every function. Also kill the {E,U}XFER() macro and use a consistent name accross all the methods for {e,u}hci_xfer.
* Instead of matching root hubs with a custom address, that only worksmpi2014-03-251-5/+5
| | | | | | | because USB_START_ADDR is defined to 0 and the softc is M_ZERO'd, assume that root hubs are the only devices with a depth of 0. Root hubs can now happily be detached and reattached.
* Unify the *hci_timeout() functions, there should be no functional change.mpi2014-03-151-11/+7
|
* Kill dead links.mpi2014-03-111-10/+1
|
* Transfer descriptors already have a back pointer to the USB devicempi2014-03-071-15/+12
| | | | | | | descriptor they are linked to, so no need to dereference their pipe pointer. Simplify a lot of affectations, no functional change. ok pirofti@
* We already have three identical copies of the *hci_str() function,mpi2014-03-071-22/+4
| | | | | so merge them into usbd_str() to not introduce other copies with the upcoming HC drivers.
* Partially revert r1.134, bring back the code suspending root hub's portsmpi2014-02-241-2/+29
| | | | | | | before reseting the controller in order to save power when the machine is suspended. ok deraadt@
* Remove a hack to update the address and packet length for every devicempi2014-01-151-14/+2
| | | | | | | | | request and instead re-open the default pipe with updated values when attaching a new device, adapted from FreeBSD r162977. This fixes a problem where the controller could have cached the previous values and would fail to get the device descriptor, leaving the device unrecognized with a message like: "device problem, disabling port n".
* Add a DVACT_WAKEUP op to the *_activate() API. This is called after thederaadt2013-12-061-8/+8
| | | | | | | | kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people
* In our USB world, timeouts are in milliseconds, so use timeout_add_msec()mpi2013-11-091-3/+1
| | | | | | coherently through all our controller drivers and kill the mstohz() macro. ok pirofti@
* Reduce the differences between our controller drivers and initializempi2013-11-091-7/+3
| | | | | | | the timeout task in the *_timeout() routine. It now becomes obvious that the allocx/freex hooks can be merged. ok pirofti@
* Remove isoc_len from the transfer descriptor, it is assigned once butmpi2013-11-071-6/+3
| | | | never read.
* Move the abort_task storage to the generic USB xfer structure insteadmpi2013-11-011-9/+9
| | | | of defining it in every controller specific structure.
* Rework of the suspend/resume logic.mpi2013-06-121-82/+72
| | | | | | | | | | | | | Do not places the ports into suspend mode now that we detach/attach all USB devicess during a suspend/resume cycle. Emit a reset when reinitializing the controller after resume and try to use the same logic as in ehci_init(). Correctly wait for the controller to set the HCHalted bit to one before attempting a reset. Tested by many and have been in snap for a week.
* Enforce ca_activate tree-walks over the entire heirarchy for all events,deraadt2013-05-301-1/+3
| | | | | | cleaning up some shutdown-hook related code on the way. (A few drivers related to sparc are still skipped at kettenis' request) ok kettenis mlarkin, tested by many others too
* Remove `abort_task' from usb task queue before recycling a `structyasuoka2013-05-201-1/+4
| | | | | | | | | usbd_xfer object' which includes the `abort_task'. Otherwise usb_abort_task_thread() may try to dequeue the recycled task then it causes panic with page fault. reported by Edd Barrett and Wade, Daniel. ok mpi
* Remove allocm() and freem() from the USB bus interface now that theympi2013-04-191-28/+1
| | | | | | are only used as wrappers around usb_{alloc,free}mem(). ok deraadt@, mglocker@
* Get rid of various 'typedef struct' definitions and use plain structuremglocker2013-04-151-241/+243
| | | | | | | | | 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
|
* Our arc4random() is safe to use in any context, so we don't the crazyderaadt2012-10-091-10/+2
| | | | | | fake randomizer for pre-boot. We still need better interrupt scheduling, but this makes that more clear. ok yuo mpi
* Revamp the sequences for suspend/hibernate -> resume so that the codederaadt2012-10-081-4/+4
| | | | | | | | | | paths are reflexive. It is now possible to fail part-way through a suspend sequence, and recover along the resume code path. Split DVACT_SUSPEND by adding a new DVACT_POWERDOWN method is used after hibernate (and suspend too) to finish the job. Some drivers must be converted at the same time to use this instead of shutdown hooks (the others will follow at a later time) ok kettenis mlarkin
* Fix typos in DPRINTF() so error messages refer to correct *hci.krw2012-08-171-2/+2
| | | | Spotted by Artturi Alm. Thanks!
* Make all *_device_*_start() functions (e.g. ohci_device_intr_start())krw2012-08-071-2/+3
| | | | | | | | | | wait for an interrupt when the bus is in polling mode. Otherwise some devices like my YE-Data USB Floppy take a short sharp trip to ddb> at 'halt -p'. Most of the functions were already doing the wait. ok miod@. With modification that printf's become DPRINTF's.
* When aborting a transfer set the halted bit to the QH's qTD and removempi2012-07-071-112/+16
| | | | | superflous code. This fix an abort loop problem reported by Gerhard Roth, based on his initial diff. Has been in snap for some weeks, ok deraadt@
* There's no need to check for the last qTD of a list because they arempi2012-06-231-5/+3
| | | | | | NULL-terminated. Part of a larger diff from Gerhard Roth
* Fix a bad copy/paste; when starting an isochronous transfer set thempi2012-06-231-2/+2
| | | | | | first and last qTD pointers to NULL because only iTDs will be used. Part of a larger diff from Gerhard Roth
* Remove unused and confusing 'head' argument.mpi2012-05-131-21/+11
| | | | Part of a larger diff from Gerhard Roth, ok miod@
* Remove unused xfer pointer from the qTD structure.mpi2012-05-121-5/+1
| | | | ok miod@
* Because qTD lists are NULL terminated, there is no need for an extrampi2012-05-121-15/+14
| | | | | | 'sqtdend' argument when freeing one of them. Part of a larger diff from Gerhard Roth with some tweaks, ok miod@
* Read the HCSPARAMS register from the correct location, and adderic2011-07-101-5/+4
| | | | | | parentheses where needed to get the resulting mask right. ok krw@ yuo@ deraadt@
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-3/+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
* ansify a few files. ok deraadt dlg krw matthewtedu2011-06-231-2/+2
|
* use the dying flag in struct usbd_bus instead of a private dying flagjakemsr2010-12-141-21/+21
| | | | | | in *hci_softc ok miod@, krw@