summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uhci.c
Commit message (Collapse)AuthorAgeFilesLines
* Move usb to a graveyard location under sys/legacy/dev, it is intended that theAndrew Thompson2009-02-231-3704/+0
| | | | | | | | | | new USB2 stack will fully replace this for 8.0. Remove kernel modules, a subsequent commit will update conf/files. Unhook usbdevs from the build. Notes: svn path=/head/; revision=188939
* Expand callout compatibility macros in the main usb bridges.Warner Losh2007-06-141-14/+13
| | | | Notes: svn path=/head/; revision=170730
* Remove more unnecessary and unwanted __OtherBSD__ ifdefs.Warner Losh2007-06-131-58/+0
| | | | Notes: svn path=/head/; revision=170657
* Don't assume the run bit is still set after a suspend.Julian Elischer2007-03-271-0/+1
| | | | | | | | Submitted by: Andrea Bittau ( adotbittauatcsdotucldotacdotuk) MFC After: 1 week Notes: svn path=/head/; revision=167947
* Use a different task queue for host controller and peripheral driverIan Dowse2006-10-191-1/+2
| | | | | | | | | | | | | | | tasks. Since the host controllers rely on tasks to process transfer timeouts, if a synchronous transfer from a driver was invoked from a task and timed out, it would never complete because the single task thread was stuck performing the synchronous transfer so couldn't process the timeout. This affected the axe, udav and ural drivers. Problem hardware provided by: guido Notes: svn path=/head/; revision=163493
* More removing compatibility macros.Warner Losh2006-09-071-23/+23
| | | | | | | | | md5 still the same. "Dave, stop. I feel my mind slipping away." -- hal Notes: svn path=/head/; revision=162097
* s/Static/static/gWarner Losh2006-09-061-112/+112
| | | | | | | | | | | | | s/device_ptr_t/device_t/g No md5 changes in the .o's # Note to the md5 tracking club: $FreeBSD$ changes md5 after every commit # so you need to checkout -kk to get $FreeBSD$ instead of the actual value # of the keyword. Notes: svn path=/head/; revision=162095
* If a zero-length bulk or interrupt transfer is requested then assumeIan Dowse2006-05-281-8/+8
| | | | | | | | | | | | | USBD_FORCE_SHORT_XFER to ensure that we actually build and execute a transfer. This means that the various alloc_sqtd_chain functions will always construct a transfer, so it is safe to modify the allocated descriptors on return. Previously there were cases where a zero length transfer would cause a NULL dereference. Reported by: bp Notes: svn path=/head/; revision=159024
* Use the limited scatter-gather capabilities of ehci, ohci and uhciIan Dowse2006-05-281-45/+219
| | | | | | | | | | | | | | | | | | host controllers to avoid the need to allocate any multi-page physically contiguous memory blocks. This makes it possible to use USB devices reliably on low-memory systems or when memory is too fragmented for contiguous allocations to succeed. The USB subsystem now uses bus_dmamap_load() directly on the buffers supplied by USB peripheral drivers, so this also avoids having to copy data back and forth before and after transfers. The ehci and ohci controllers support scatter/gather as long as the buffer is contiguous in the virtual address space. For uhci the hardware cannot handle a physical address discontinuity within a USB packet, so it is necessary to copy small memory fragments at times. Notes: svn path=/head/; revision=158998
* NULL out ii->stdstart and ii->stdend when they are invalid. ThisIan Dowse2006-05-281-1/+10
| | | | | | | | is not necessary for correct operation but makes it clearer that freed transfer descriptors cannot be accessed. Notes: svn path=/head/; revision=158994
* Fix a harmless typo where the software pointer in the dummy QH forIan Dowse2006-05-281-1/+1
| | | | | | | control transfers did not match the hardware pointer. Notes: svn path=/head/; revision=158993
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* Save and restore the data toggle value when a pipe to an endpointIan Dowse2006-02-261-1/+2
| | | | | | | | | | | | | is closed and then reopened. This appears to be necessary now that we no longer clear endpoint stalls every time a pipe is opened. Previously we could assume an initial toggle value of zero because the clear-stall operation resets the device's toggle state. Reported by: Holger Kipp MFC after: 3 days Notes: svn path=/head/; revision=156016
* Set sc_dying to 1 when detaching. In NetBSD and OpenBSD this wasIan Dowse2006-01-151-0/+2
| | | | | | | | done by the DVACT_DEACTIVATE case in *hci_activate(), but we don't use that code in FreeBSD so it was never set. Notes: svn path=/head/; revision=154406
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-1/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* It was possible to have two threads concurrently aborting the sameIan Dowse2005-03-191-1/+28
| | | | | | | | | | | | | | | | | | | | | transfer, which lead to panics or page faults. For example if a transfer timed out, another thread could come along and attempt to abort the same transfer while the timeout task was sleeping in the *_abort_xfer() function. Add an "aborting" flag to the private transfer state in each host controller driver and use this to ensure that the abort is only executed once. Also prioritise normal abort requests over timeouts so that the callback is always given a status of USB_CANCELLED even if the timeout-initiated abort began first. The crashes caused by this bug were mainly reported in connection with lpd printing to a USB printer. PR: usb/78208, usb/78986 Notes: svn path=/head/; revision=143847
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Fix just the worst of the timeout race conditions that the previousIan Dowse2004-11-161-1/+2
| | | | | | | | | backed out commits were trying to address: when cancelling the timeout callout, also cancel the abort_task event, since it is possible that the timeout has already fired and set up an abort_task. Notes: svn path=/head/; revision=137759
* Back out my recent changes for timeout races, as there have beenIan Dowse2004-11-121-40/+16
| | | | | | | | | | reports of problems. The bug is probably that there are cases where `xfer->timeout && !sc->sc_bus.use_polling' is not a suitable test for an active timeout callout, so an explicit flag will be necessary. Apologies for the breakage. Notes: svn path=/head/; revision=137600
* Attempt to fix a number of race conditions in the handling ofIan Dowse2004-11-091-16/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | transfer timeouts that typically cause a transfer to be completed twice, resulting in panics and page faults: o A transfer completion interrupt could arrive while an abort_task event was set up, so the transfer would be aborted after it had completed. This is very easy to reproduce. Fix this by setting the transfer status to USBD_TIMEOUT before scheduling the abort_task so that the transfer completion code will ignore it. o The transfer completion code could execute concurrently with the timeout callout, leaving the callout blocked (e.g. waiting for Giant) while the transfer completion code runs. In this case, callout_stop() does not prevent the callout from running, so again the timeout code would run after the transfer was complete. Handle this case by checking the return value from callout_stop(), and ignoring the transfer if the callout could not be removed. o Finally, protect against a timeout callout occurring while a transfer is being aborted by another process. Here we arrange for the timeout processing to ignore the transfer, and use callout_drain() to ensure that the callout has really gone before completing the transfer. This was tested by repeatedly performing USB transfers with a timeout set to approximately the same as the normal transfer completion time. In the PR below, apparently this occurred by accident with a particular printer and the default timeout. PR: kern/71491 Notes: svn path=/head/; revision=137475
* Handle all types of interrupts when operating the uhci(4) controller inJohn Baldwin2004-10-281-2/+2
| | | | | | | | | | | polled mode. PR: kern/73000 Submitted by: Daan Vreeken <Danovitsch at Vitsch dot net> MFC after: 1 month Notes: svn path=/head/; revision=137027
* The macro for the function specifier inline is spelled '__inline'.Stefan Farfeleder2004-10-031-3/+3
| | | | Notes: svn path=/head/; revision=136095
* Reinstate a usb_transfer_complete() call that got lost in theIan Dowse2004-08-021-0/+1
| | | | | | | previous revision. Notes: svn path=/head/; revision=133037
* Make the USB subsystem unloadable and detachable, though currentlyIan Dowse2004-08-021-3/+14
| | | | | | | | a significant amount of memory may be leaked each time a host controller is detached. Notes: svn path=/head/; revision=133018
* Diff reduction to NetBSD.Lukas Ertl2004-07-191-2/+1
| | | | | | | | | | | ehci.c rev. 1.69, author: mycroft uhci.c rev. 1.179, author: mycroft hcpriv is not actually used here. Remove references to it. Obtained from: NetBSD Notes: svn path=/head/; revision=132415
* Diff reduction to NetBSD.Lukas Ertl2004-05-231-3/+5
| | | | | | | | | | | | | | | | MFNetBSD 1.177; author: toshii Use the correct wValue to get hub desriptors. Also, make wValue checks of root hub codes less strict. MFNetBSD 1.178: author: martin Interrupt descriptors might become invalid while being processed in uhci_check_intr - so remember their next pointer before calling it. Patch provided by Matthew Orgass in PR kern/24542. Obtained from: NetBSD Notes: svn path=/head/; revision=129606
* Fix a suspend/resume issue. My Compaq N400c works fine.Takeshi Shibagaki2004-01-121-0/+3
| | | | Notes: svn path=/head/; revision=124433
* MFNetBSD:Josef Karthauser2003-11-101-0/+10
| | | | | | | | | | revision 1.176 date: 2003/11/04 19:11:21; author: mycroft; Ignore a CRCTO error on a SETUP transaction in combination with STALLED or NAK. This fixes problems with the GL641. Notes: svn path=/head/; revision=122379
* MFNetBSD:Josef Karthauser2003-11-091-1/+2
| | | | | | | | date: 2003/09/12 16:18:08; author: mycroft; Tweak a debugging printf(). Notes: svn path=/head/; revision=122378
* Revise the NetBSD revision control strings.Josef Karthauser2003-11-091-10/+1
| | | | Notes: svn path=/head/; revision=122377
* MFNetBSD:Josef Karthauser2003-11-091-3/+3
| | | | | | | | | - remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD(). this mirrors the functionality of SLIST_REMOVE_HEAD() (the other singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD() Notes: svn path=/head/; revision=122376
* Use __FBSDID().David E. O'Brien2003-08-241-1/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* make usb bus_dma aware.John-Mark Gurney2003-07-151-3/+2
| | | | | | | Reviewed by: joe among others Notes: svn path=/head/; revision=117653
* MFNetBSD:Josef Karthauser2003-07-141-10/+11
| | | | | | | | | date: 2003/05/13 04:41:59; author: gson; Function names printed in debug messages did not always match the actual name of the function. Notes: svn path=/head/; revision=117576
* MFNetBSD: revision 1.172Josef Karthauser2003-07-141-1/+1
| | | | | | | | date: 2003/02/23 04:19:26; author: simonb; Remove unreachable break after return. Notes: svn path=/head/; revision=117575
* MFNetBSD: revision 1.170Josef Karthauser2003-07-141-1/+5
| | | | | | | | date: 2003/02/19 01:35:04; author: augustss; Bail out early in isoc_done if the ii is not on the interrupt list. Notes: svn path=/head/; revision=117574
* MFNetBSD: rev 1.169Josef Karthauser2003-07-141-6/+21
| | | | | | | | date: 2003/02/16 23:15:28; author: augustss; Don't take xfers off the interrupt list if they are not on it yet. Notes: svn path=/head/; revision=117573
* Make a note of which patches we already have incorporated from NetBSD.Josef Karthauser2003-07-141-1/+6
| | | | Notes: svn path=/head/; revision=117572
* MFNetBSD:Josef Karthauser2003-07-141-2/+6
| | | | | | | | date: 2003/02/08 03:32:51; author: ichiro; change URL pointers of USB[1,2] specification Notes: svn path=/head/; revision=117567
* MFNetBSD: rev 1.166Josef Karthauser2003-07-141-13/+99
| | | | | | | | | | | | | date: 2002/12/31 02:21:31; author: dsainty; Be somewhat more persuasive about enabling the port on a port reset. USB protocol dictates that the port enable must be implied by the port reset. To implement this on (at least) the VIA VT83C572 this means we need to wait around tweaking the chip state until the port actually transitions to enabled (or the device goes away). Likely fixes kern/11018. Notes: svn path=/head/; revision=117566
* MFNetBSD: 1.165Josef Karthauser2003-07-141-3/+8
| | | | | | | | date: 2002/12/31 02:04:49; author: dsainty; CONSTCOND away some lint warnings Notes: svn path=/head/; revision=117565
* remove \n at end of panic strings. They are added by the call to panic.John-Mark Gurney2003-07-041-7/+7
| | | | | | | | | This brings us more in line with Net/OpenBSD Obtained from: Net/OpenBSD Notes: svn path=/head/; revision=117243
* WARNING: white space diffJohn-Mark Gurney2003-07-041-4/+4
| | | | | | | | | This code reduces the number of trailing white space to be more in line w/ NetBSD. I don't regenerate usbdevs, saving that for when it really changes. Notes: svn path=/head/; revision=117213
* Make uhci_waitintr() robust to interrupts being enabled, even thoughIan Dowse2003-03-111-4/+3
| | | | | | | | | | | | it is expected that they will not be enabled at the time that it is called. This is reported to work around a problem in RELENG_4 where the kernel panics on boot if FAST_IPSEC and crypto support are enabled. Tested by: Scott Johnson <scottj@insane.com> Notes: svn path=/head/; revision=112084
* Implement outgoing interrupt pipes. It is part of the USB 1.1 spec.John Hay2003-02-281-3/+13
| | | | | | | The Lego Infrared Tower use it. Notes: svn path=/head/; revision=111680
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-2/+2
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-2/+2
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,Jens Schweikhardt2003-01-011-1/+1
| | | | | | | especially in troff files. Notes: svn path=/head/; revision=108533
* When resuming after a system suspend, re-issue the UHCI_CMD_MAXPIan Dowse2002-12-261-0/+1
| | | | | | | | | | | | | command in case this setting was not saved. Since bandwidth reclamation (-current only) often results in bus activity continuing to the end of every frame, most transfers would fail with IOERROR if this setting is missed. Reviewed by: n_hibma MFC after: 1 week Notes: svn path=/head/; revision=108285
* In rev 1.51 of usb_port.h I switched over to using the USB_USE_SOFTINTRJosef Karthauser2002-09-301-0/+6
| | | | | | | | | | | | | | | | | | code path to fix a bug in the non USB_USE_SOFTINTR path that caused the usb bus to hang and generally misbehave when devices were unplugged. In the process though it also reduced the throughput of usb devices because of a less than optimal implementation under FreeBSD. This commit fixes the non USB_USE_SOFTINTR code in uhci and ohci so that it works again, and switches back to using this code path. The uhci code has been tested, but the ohci code hasn't. It's essentially the same anyway and so I don't envisage any difficulties. Code for uhci submitted by: Maksim Yevmenkin <myevmenk@exodus.net> Notes: svn path=/head/; revision=104221