xhci: add {get,set}_field macros & enum for pls

Add {get,set}_field macros (simliar to ehci) to read and update
some bits of a word.  Put them into use for updating pls (port
link state) values.  Also add a enum for pls values.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: s/xhci_update_port/xhci_port_update/

Rename the function for xhci_port_* naming scheme, also drop
the xhci parameter as port carries a pointer to xhci anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: add xhci_port_have_device

Factor out the code which checks whenever a usb device is attached
to the port in question.  No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: add xhci_port_notify

Create a function to notify the guest about port
status changes and put it into use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: add xhci_port_reset

Move port reset logic to its own function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: set pls in xhci_port_update & xhci_port_reset

Set the port link state to the correct values in xhci_port_update and
xhci_port_reset functions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: add port trace points

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xhci: allow address slot being called multiple times

win8 guests do that for some reason ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: parameterise the register region offsets

The capabilities register and operational register offsets can vary from one
EHCI implementation to the next. Parameterise accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: Abstract away PCI DMA API

Pull the DMAContext for the PCI DMA out at device init time and put it into
the device state. Use dma_memory_read/write() instead of pci specific versions.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: seperate out PCIisms

Seperate the PCI stuff from the EHCI components. Extracted the PCIDevice
out into a new wrapper struct to make EHCIState non-PCI-specific. Seperated
tho non PCI init component out into a seperate "common" init function.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: Guard definition of EHCI_DEBUG

Guard against re-definition of EHCI_DEBUG. Allows for turning on of debug info
from configure (using --qemu-extra-cflags="-DEHCI_DEBUG=1") rather than source
code hacking.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: split into multiple source files

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci: add sysbus variant

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
xilinx_zynq: add USB controllers

Add the two usb controllers in Zynq.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: dynamic type generation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: stick irq routing info into UHCIInfo too.

Kills the ugly "switch (device_id) { ... }" struct and makes it easier
to figure what the differences between the uhci variants are.

Need our own DeviceClass struct for that so we can allocate some space
to store UHCIInfo.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: add ich9 00:1a.* variants

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci-pci: dynamic type generation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb/ehci-pci: add ich9 00:1a.* variant

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>