summaryrefslogtreecommitdiff
path: root/sys/dev/usb/ohci.c
AgeCommit message (Collapse)Author
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2014-12-19Use <sys/endian.h> instead of <machine/endian.h>Philip Guenther
ok dlg@ mpi@ bcook@ millert@ miod@
2014-12-08Do not report underruns as bus data errors, as suggested by sectionMartin Pieuchot
13.2.3, and let the stack set the status to USBD_SHORT_XFER if appropriate. From David Higgs.
2014-10-05Do not re-establish the default pipe twice for every controller. MoveMartin Pieuchot
this hack in the drivers that need it. Tested by many, thanks! ok pirofti@, kettenis@
2014-08-10Since USB xfer pools are accessed in interrupt context, initialize themMartin Pieuchot
with the correct ipl to prevent your CPU from locking against itself.
2014-08-10Set and check for XFER_BUSY in the common methods instead of doing itMartin Pieuchot
in every HC driver.
2014-08-05Only check if the abort transfer is the interrupt one if the pipe isMartin Pieuchot
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@
2014-07-12Protect the freelists of transfer descriptors with the appropriate splMartin Pieuchot
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@
2014-07-10Do not set the bus dying flag during DVACT_DEACTIVATE otherwise theMartin Pieuchot
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).
2014-07-09Adds an optional bus function to set the address of a new device andMartin Pieuchot
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@
2014-06-04Clearing the data toggle bit only makes sense for endpoints that use it,Martin Pieuchot
since this function is optional get rid of the no-op ones. ok ratchov@
2014-06-04Use C99 initializers for pipe and bus methods.Martin Pieuchot
Apart from improving readability, this will help us reduce the number of no-op functions now that some of them are optional. ok ratchov@
2014-05-30Remove unused fields from the pipes.Martin Pieuchot
2014-05-16There is no need to remember which usb(4) device is the child of an USBMartin Pieuchot
host controller because autoconf(9) already does it.
2014-05-09Plug an xfer leak when detaching root hubs.Martin Pieuchot
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.
2014-05-04Make use of usbd_xfer_isread() instead of rerolling it everywhere.Martin Pieuchot
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.
2014-04-29Get rid of the per-softc freelist of transfer descriptors and use aMartin Pieuchot
per-driver pool(9) instead.
2014-04-29Finally plug the public xfer leak #1 in our USB stack.Martin Pieuchot
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.
2014-04-27Start de-obfuscating the HC drivers.Martin Pieuchot
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.
2014-03-25Instead of matching root hubs with a custom address, that only worksMartin Pieuchot
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.
2014-03-15Unify the *hci_timeout() functions, there should be no functional change.Martin Pieuchot
2014-03-11Kill dead links.Martin Pieuchot
2014-03-07Transfer descriptors already have a back pointer to the USB deviceMartin Pieuchot
descriptor they are linked to, so no need to dereference their pipe pointer. Simplify a lot of affectations, no functional change. ok pirofti@
2014-03-07We already have three identical copies of the *hci_str() function,Martin Pieuchot
so merge them into usbd_str() to not introduce other copies with the upcoming HC drivers.
2014-01-15Remove a hack to update the address and packet length for every deviceMartin Pieuchot
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".
2013-12-09Mark a few functions with __unused.Brad Smith
ohci.c:193:1: error: unused function 'OREAD1' [-Werror,-Wunused-function] ohci.c:200:1: error: unused function 'OREAD2' [-Werror,-Wunused-function] uhci.c:256:1: error: unused function 'UREAD4' [-Werror,-Wunused-function] ok deraadt@
2013-12-06Add a DVACT_WAKEUP op to the *_activate() API. This is called after theTheo de Raadt
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
2013-11-09In our USB world, timeouts are in milliseconds, so use timeout_add_msec()Martin Pieuchot
coherently through all our controller drivers and kill the mstohz() macro. ok pirofti@
2013-11-01Move the abort_task storage to the generic USB xfer structure insteadMartin Pieuchot
of defining it in every controller specific structure.
2013-06-25Bring ohci(4) and uhci(4) in sync with ehci(4) by ensuring that aMartin Pieuchot
transfer is submitted when a zero-length bulk or interrupt transfer is requested. This is the missing part of FreeBSD's svn r159024 that should have been committed with ehci's r1.57. ok uebayasi@
2013-05-30Enforce ca_activate tree-walks over the entire heirarchy for all events,Theo de Raadt
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
2013-05-20Remove `abort_task' from usb task queue before recycling a `structYASUOKA Masahiko
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
2013-04-19Remove allocm() and freem() from the USB bus interface now that theyMartin Pieuchot
are only used as wrappers around usb_{alloc,free}mem(). ok deraadt@, mglocker@
2013-04-16Merge ohci_hash_rem_td() into ohci_free_std() to reduce differences withMartin Pieuchot
uhci(4). No functional change. ok mglocker@
2013-04-15Get rid of various 'typedef struct' definitions and use plain structureMarcus Glocker
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@
2013-03-28proc.h is way too much header for usb to handle.Ted Unangst
2013-03-02Decide whether to use polling or not only upon `sc_bus.use_polling', regardlessMiod Vallat
of the value of `cold'. This is similar to what the other hci drivers do, and has not caused any regressions on the few systems this has been tested on. Commited now to have a change to expose ohci-specific regressions (if any).
2012-08-07Make all *_device_*_start() functions (e.g. ohci_device_intr_start())Kenneth R Westerback
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.
2011-09-18Set pointer to NULL not 0. From Michael Knudsen (several times).Kenneth R Westerback
2011-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
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
2010-12-14use the dying flag in struct usbd_bus instead of a private dying flagJacob Meuser
in *hci_softc ok miod@, krw@
2010-12-06* if we got an undercoverable error, set the dying flagJacob Meuser
* check the dying flag in timeout and interrupt handlers fixes crash when disconnecting cardbus usb adapters
2010-10-28improve look of ;; in a for loopTheo de Raadt
2010-10-23create another kthread to run xfer abort tasks. xfer abort tasks cannotJacob Meuser
be run from the generic task kthread, because xfers that need to be aborted block newly queued tasks from running (i.e. the xfer to be aborted blocks the abort of that task). as there are now three types of usb tasks, add an argument to usb_init_task() and another member to struct usb_task to specify the task type. fixes boot hangs that are showing up because we now use usb tasks to attach/detach usb devices.
2010-09-07remove the powerhook code. All architectures now use the ca_activate treeTheo de Raadt
traversal code to suspend/resume ok oga kettenis blambert
2010-08-31sort DVACT_ actions in order of useTheo de Raadt
2010-08-30Change powerhooks into activate functions, and provide stub powerhookTheo de Raadt
functions ok kettenis
2010-08-27kill PWR_STANDBY (apm can use PWR_SUSPEND instead). While here, renumberTheo de Raadt
PWR_{SUSPEND,RESUME} so that they match the values of DAVCT_{SUSPEND,RESUME} so that we can eventually (many more steps...) kill the powerhook garbage and use the activate mechanism. no objections
2010-05-01put the read macros into functions so gcc4 doesn't whinge.Jonathan Gray
ok marco@ oga@ miod@
2009-11-26Call the existing power functions with our activate function forTheo de Raadt
the suspend and resume operations ok kettenis