diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2011-09-08 08:57:33 -0500 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-09-08 08:57:33 -0500 |
| commit | a60fce0bcc193c37c92972b8217341d81f7a9860 (patch) | |
| tree | 57f7977faa534d05d969d5e4a23154d8381866ae /hw/usb-uhci.c | |
| parent | 63236c15e93e18d37ce657171a42af1f809d0aa6 (diff) | |
| parent | 5b1cdb4ead0b3d2190492fce0a17e809ef915f26 (diff) | |
| download | focaccia-qemu-a60fce0bcc193c37c92972b8217341d81f7a9860.tar.gz focaccia-qemu-a60fce0bcc193c37c92972b8217341d81f7a9860.zip | |
Merge remote-tracking branch 'kraxel/usb.26' into staging
Diffstat (limited to 'hw/usb-uhci.c')
| -rw-r--r-- | hw/usb-uhci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c index 6ca7ca81eb..64f7b36c00 100644 --- a/hw/usb-uhci.c +++ b/hw/usb-uhci.c @@ -340,8 +340,8 @@ static void uhci_reset(void *opaque) for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; port->ctrl = 0x0080; - if (port->port.dev) { - usb_attach(&port->port, port->port.dev); + if (port->port.dev && port->port.dev->attached) { + usb_attach(&port->port); } } @@ -446,7 +446,7 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; dev = port->port.dev; - if (dev) { + if (dev && dev->attached) { usb_send_msg(dev, USB_MSG_RESET); } } @@ -486,7 +486,7 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) return; port = &s->ports[n]; dev = port->port.dev; - if (dev) { + if (dev && dev->attached) { /* port reset */ if ( (val & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { @@ -660,8 +660,9 @@ static int uhci_broadcast_packet(UHCIState *s, USBPacket *p) UHCIPort *port = &s->ports[i]; USBDevice *dev = port->port.dev; - if (dev && (port->ctrl & UHCI_PORT_EN)) + if (dev && dev->attached && (port->ctrl & UHCI_PORT_EN)) { ret = usb_handle_packet(dev, p); + } } DPRINTF("uhci: packet exit. ret %d len %zd\n", ret, p->iov.size); |