]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/commitdiff
usb-uchi: post-merge: Revert asynchronous completion changes
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 27 Oct 2008 15:32:19 +0000 (15:32 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 27 Oct 2008 15:32:57 +0000 (15:32 +0000)
Previously, during the merge, I resolved the changeset
  2cfc40201be5562a942615452fc2c4ee45d1165c
  usb-uhci: correctly deal with interrupt in asynchronous completion
which came from xen-unstable
  changeset:   12775:60bbcf799384d779c2a561b9d9ba30f28e31d970
  date:        Thu Dec 07 11:52:26 2006 +0000
  files:       tools/ioemu/hw/usb-hid.c tools/ioemu/hw/usb-uhci.c
  description:
  [HVM] qemu mouse: Adds support for USB mouse/tablet status check and
  ...
  And UHC should leave a TD active when receiving NAK and execute this
  incompleted TD in a subseqent frame. UHC only generates an interrupt
  on complete after the TD with ICO bit is completed.
  ...
Signed-off-by: Xinmei Huang <xinmei.huang@intel.com>
with the new uhci controller in upstream qemu.

However, in the context of the new uhci controller this is a broken
change; it causes the polling of the usb tablet (for example) to cease
after the first two polls.

So I'm reverting it.

hw/usb-uhci.c

index efa6b5231186e866e0085caba9f936e0b3c0af68..b90cf78c11169a42e39d21fc42c8a46bd8369e39 100644 (file)
@@ -687,6 +687,9 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_
 
     ret = async->packet.len;
 
+    if (td->ctrl & TD_CTRL_IOC)
+        *int_mask |= 0x01;
+
     if (td->ctrl & TD_CTRL_IOS)
         td->ctrl &= ~TD_CTRL_ACTIVE;
 
@@ -717,36 +720,31 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_
             *int_mask |= 0x02;
             /* short packet: do not update QH */
             dprintf("uhci: short packet. td 0x%x token 0x%x\n", async->td, async->token);
-            ret = 1;
-           goto out_update_ioc;
+            return 1;
         }
     }
 
     /* success */
-    ret = 0;
-    goto out_update_ioc;
+    return 0;
 
 out:
     switch(ret) {
     case USB_RET_STALL:
         td->ctrl |= TD_CTRL_STALL;
         td->ctrl &= ~TD_CTRL_ACTIVE;
-        ret = 1;
-        goto out_update_ioc;
+        return 1;
 
     case USB_RET_BABBLE:
         td->ctrl |= TD_CTRL_BABBLE | TD_CTRL_STALL;
         td->ctrl &= ~TD_CTRL_ACTIVE;
         /* frame interrupted */
-        ret = -1;
-        goto out_update_ioc;
+        return -1;
 
     case USB_RET_NAK:
         td->ctrl |= TD_CTRL_NAK;
         if (pid == USB_TOKEN_SETUP)
             break;
-       ret = 1;
-        goto out_update_ioc;
+       return 1;
 
     case USB_RET_NODEV:
     default:
@@ -767,12 +765,7 @@ out:
     }
     td->ctrl = (td->ctrl & ~(3 << TD_CTRL_ERROR_SHIFT)) |
         (err << TD_CTRL_ERROR_SHIFT);
-    ret = 1;
-
- out_update_ioc:
-    if ((td->ctrl & TD_CTRL_IOC) && !(td->ctrl &= ~TD_CTRL_ACTIVE))
-        *int_mask |= 0x01;
-    return ret;
+    return 1;
 }
 
 static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask)