xhci: allow disabling interrupters
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 24 Oct 2012 07:38:08 +0000 (09:38 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 25 Oct 2012 12:35:55 +0000 (14:35 +0200)
For secondary interrupters this is explicitly allowed in the specs.
For the primary interrupter behavior is undefined, lets be friendly
and allow disabling too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci.c

index d8d1226a5ba1fcc8c7520b064dfb11e704a9a112..bd8d4a5b395a669055f742838b4775f8c40231ab 100644 (file)
@@ -964,6 +964,12 @@ static void xhci_er_reset(XHCIState *xhci, int v)
     XHCIInterrupter *intr = &xhci->intr[v];
     XHCIEvRingSeg seg;
 
+    if (intr->erstsz == 0) {
+        /* disabled */
+        intr->er_start = 0;
+        intr->er_size = 0;
+        return;
+    }
     /* cache the (sole) event ring segment location */
     if (intr->erstsz != 1) {
         fprintf(stderr, "xhci: invalid value for ERSTSZ: %d\n", intr->erstsz);