Commit Graph

18 Commits

Author SHA1 Message Date
Gerd Hoffmann 973002c114 uhci: fix irq routing
The multifunction ich9 ehci controller with uhci companions uses a
different interrupt pin for each function.  The three uhci devices
get pins A, B and C, whereas ehci uses pin D.  This way the guest
can assign different IRQ lines to each controller.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 5852d3bfe1 uhci: zap uhci_pre_save
Cancel transactions before saving vmstate is pretty pointless and just
causes disruptions.  We need to cancel them before *loading* vmstate,
but in that case uhci_reset() handles it already and no special action
is needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 40141d12de uhci: make bandwidth tunable
Add a property for the uhci bandwidth.  Can be used to make uhci
emulation run faster than real hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 9a16c5950d uhci: use bottom half
Schedule bottom half on completion of async packets instead of calling
uhci_process_frame directly.  This way we run uhci_process_frame only
once in case multiple packets finish in a row.  Also check whenever
there is bandwidth left before scheduling uhci_process_frame.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 4aed20e2d7 uhci: fix bandwidth management
uhci_process_frame() can be invoked multiple times per frame, so
accounting usb bandwith in a local variable doesn't fly, use a variable
in UHCIState instead.  Also check the limit more frequently.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann aba1f24283 usb-uhci: update irq line on reset
uhci_reset() clears irq mask and irq status registers, but doesn't
update the irq line.  Which may result in suspious IRQs after uhci
reset.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Gerd Hoffmann ee008ba626 usb-uhci: queuing fix
When we queue up usb packets we may happen to find a already queued
packet, which also might be finished at that point already.  We don't
want continue processing the packet at this point though, so lets
just signal back we've found a in-flight packet when in queuing mode.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-17 10:23:27 +02:00
Gerd Hoffmann 52b0fecdba usb-uhci: stop queue filling when we find a in-flight td
Not only QHs can form rings, but TDs too.  With the new
queuing/pipelining support we are following TD chains and
can actually walk in circles.  An assert() prevents us from
entering an endless loop then.

Fix is easy:  Just stop queuing when we figure the TD we are
about to queue up is in flight already.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-17 10:23:27 +02:00
Gerd Hoffmann 6c60134091 uhci: alloc can't fail, drop check.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 4efe4ef3b8 uhci: new uhci_handle_td return code for tds still in flight
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 0cd178ca2c uhci: renumber uhci_handle_td return codes
Step #2 (separate for better bisectability): renumber so the silly '-1'
goes away.  Pick a range which doesn't overlap the old values.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 60e1b2a6dd uhci: use enum for uhci_handle_td return codes
Step #1 (separate for better bisectability): replace numbers with names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 50dcc0f85d uhci: tracing support
Zap DPRINTF, add tracepoints instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann d9a528db7f uhci: cancel on schedule stop.
Cancel any in-flight transaction when the guest stops the uhci schedule.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 60f8afcb5d uhci: fix uhci_async_cancel_all
It should also free all queues.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann 16ce543ed1 uhci: pass addr to uhci_async_alloc
Also do async->td initialization in uhci_async_alloc now.
Prepares for adding tracepoints.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann afb9a60ecb usb: zap hw/ush-{ohic,uhci}.h + init wrappers
Remove the uhci and ohci init wrappers, which all wrapped a
pci_create_simple() one-liner.  Switch callsites to call
pci_create_simple directly.  Remove the header files where
the wrappers where declared.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00
Gerd Hoffmann f1ae32a1ec usb: the big rename
Reorganize usb source files.  Create a new hw/usb/ directory and move
all usb source code to that place.  Also make filenames a bit more
descriptive.  Host adapters are prefixed with "hch-" now, usb device
emulations are prefixed with "dev-".  Fixup paths Makefile and include
paths to make it compile.  No code changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-13 10:15:32 +01:00