aboutsummaryrefslogtreecommitdiffstats
path: root/hw/usb-ehci.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-14usb-ehci: fix offset writeback in ehci_buffer_rwGerd Hoffmann1-2/+2
Two bugs at once: First the mask is backwards, so the it used to keeps the offset and clears the page address, which is not what we need when we update the offset. Second the offset calculation is wrong in case head isn't page aligned. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: multiqueue supportGerd Hoffmann1-32/+139
This patch adds support for keeping multiple queues going at the same time. One slow device will not affect other devices any more. The patch adds code to manage EHCIQueue structs. It also does a number of changes to the state machine: * The state machine will never ever stop in EXECUTING any more. Instead it will continue with the next queue (aka HORIZONTALQH) when the usb device returns USB_RET_ASYNC. * The state machine will stop processing when it figures it walks in circles (easy to figure now that we have a EHCIQueue struct for each QH we've processed). The bailout logic should not be needed any more. For now it is still in, but will assert() in case it triggers. * The state machine will just skip queues with a async USBPacket in flight. * The state machine will resume processing as soon as the async USBPacket is finished. The patch also takes care to flush the QH struct back to guest memory when needed, so we don't get stale data when (re-)loading it from guest memory in FETCHQH state. It also makes the writeback code to not touch the first three dwords of the QH struct as the EHCI must not write them. This actually fixes a bug where QH chaining changes (next ptr) by the linux ehci driver where overwritten by the emulated EHCI. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: add queue data structGerd Hoffmann1-229/+257
Add EHCIQueue struct, move the fields needed to track the queue state into that struct. Pass the new struct instead of ehci state down to functions which handle the queue state. Lot of variable references have changed due to that without an actual functional change. Replace fetch_addr with two variables, one for async and one for periodic schedule. Add functions to get and set the fetch address. Use EHCIQueue->usb_status (old name: EHCIState->exec_status) directly in ehci_execute_complete instead of passing around the status using a parameters and the return value. ehci_state_fetchqh returns a EHCIQueue struct now. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: trace buffer copyGerd Hoffmann1-7/+1
Add a trace point for buffer copies and drop the DPRINTF's. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: improve mmio tracingGerd Hoffmann1-10/+6
Add a separate tracepoint to log how register values change in response to a mmio write. Especially useful for registers which have read-only or clear-on-write bits in them. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: trace port stateGerd Hoffmann1-6/+4
Trace usb port operations (attach, detach, reset), drop a few obsolete DPRINTF's. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: trace state machine changesGerd Hoffmann1-137/+170
Add functions to get and set the current state of the state machine, add tracepoints there to trace state transitions. Add support for traceing the queue heads and transfer descriptors as we look at them. Drop a few DPRINTFs and all DPRINTF_ST lines, they are obsolete now. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14usb-ehci: trace mmio and usbstsGerd Hoffmann1-73/+83
This patch starts adding trace support to ehci. It traces updates of the status register (USBSTS), mmio access and controller reset. It also adds functions to set and clear status register bits and puts them in use everywhere. Some DPRINTF's are dropped in favor of the new tracepoints. No change in behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: add ehci adapterGerd Hoffmann1-0/+2037
This patch finally merges the EHCI host adapter aka USB 2.0 support. Based on the ehci bits collected @ git://git.kiszka.org/qemu.git ehci EHCI has a long out-of-tree history. Project was started by Mark Burkley, with contributions by Niels de Vos. David S. Ahern continued working on it. Kevin Wolf, Jan Kiszka and Vincent Palatin contributed bugfixes. /me (Gerd Hoffmann) picked it up where it left off, prepared the code for merge, fixed a few bugs and added basic user docs. Cc: David S. Ahern <daahern@cisco.com> Cc: Jan Kiszka <jan.kiszka@web.de> Cc: Kevin Wolf <mail@kevin-wolf.de> Cc: Vincent Palatin <vincent.palatin_qemu@m4x.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>