summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-11-08 11:43:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-11-12 09:29:33 +0100
commit7ce2bc5345772a22c675f510234a9b9b2c83c329 (patch)
treea412fb7b5bee5962e06c83705c96968104941a18
parentffcc3fa2de9501331732a285a3d0d169c017d65a (diff)
usb: handle suspend in xhci
The OS can ask the xhci controller to save and restore its internal state, which is used by the OS when the system is suspended and resumed. This patch handles writes to the save + restore bits in the command register. Only thing it does is updating the restore error bit in the status register to signal an error on restore. The guest OS should do a full reinitialization after resume then. This is the minimal patch which gets S3 going with xhci. Implementing full save/restore support is TBD. https://bugzilla.redhat.com/show_bug.cgi?id=1012365 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/hcd-xhci.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 835f65ed8..d84d51031 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3016,6 +3016,14 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
} else if (!(val & USBCMD_RS) && (xhci->usbcmd & USBCMD_RS)) {
xhci_stop(xhci);
}
+ if (val & USBCMD_CSS) {
+ /* save state */
+ xhci->usbsts &= ~USBSTS_SRE;
+ }
+ if (val & USBCMD_CRS) {
+ /* restore state */
+ xhci->usbsts |= USBSTS_SRE;
+ }
xhci->usbcmd = val & 0xc0f;
xhci_mfwrap_update(xhci);
if (val & USBCMD_HCRST) {