Commit 96217e315d4ac38daf4a7b8cafa4a9cd13ad4126
1 parent
cfc3475a
Basic USB device resume (root hub only), by Lonnie Mendez.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2449 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
23 additions
and
0 deletions
hw/usb-uhci.c
... | ... | @@ -26,6 +26,8 @@ |
26 | 26 | //#define DEBUG |
27 | 27 | //#define DEBUG_PACKET |
28 | 28 | |
29 | +#define UHCI_CMD_FGR (1 << 4) | |
30 | +#define UHCI_CMD_EGSM (1 << 3) | |
29 | 31 | #define UHCI_CMD_GRESET (1 << 2) |
30 | 32 | #define UHCI_CMD_HCRESET (1 << 1) |
31 | 33 | #define UHCI_CMD_RS (1 << 0) |
... | ... | @@ -327,6 +329,21 @@ static uint32_t uhci_ioport_readl(void *opaque, uint32_t addr) |
327 | 329 | return val; |
328 | 330 | } |
329 | 331 | |
332 | +/* signal resume if controller suspended */ | |
333 | +static void uhci_resume (void *opaque) | |
334 | +{ | |
335 | + UHCIState *s = (UHCIState *)opaque; | |
336 | + | |
337 | + if (!s) | |
338 | + return; | |
339 | + | |
340 | + if (s->cmd & UHCI_CMD_EGSM) { | |
341 | + s->cmd |= UHCI_CMD_FGR; | |
342 | + s->status |= UHCI_STS_RD; | |
343 | + uhci_update_irq(s); | |
344 | + } | |
345 | +} | |
346 | + | |
330 | 347 | static void uhci_attach(USBPort *port1, USBDevice *dev) |
331 | 348 | { |
332 | 349 | UHCIState *s = port1->opaque; |
... | ... | @@ -344,6 +361,9 @@ static void uhci_attach(USBPort *port1, USBDevice *dev) |
344 | 361 | port->ctrl |= UHCI_PORT_LSDA; |
345 | 362 | else |
346 | 363 | port->ctrl &= ~UHCI_PORT_LSDA; |
364 | + | |
365 | + uhci_resume(s); | |
366 | + | |
347 | 367 | port->port.dev = dev; |
348 | 368 | /* send the attach message */ |
349 | 369 | usb_send_msg(dev, USB_MSG_ATTACH); |
... | ... | @@ -358,6 +378,9 @@ static void uhci_attach(USBPort *port1, USBDevice *dev) |
358 | 378 | port->ctrl &= ~UHCI_PORT_EN; |
359 | 379 | port->ctrl |= UHCI_PORT_ENC; |
360 | 380 | } |
381 | + | |
382 | + uhci_resume(s); | |
383 | + | |
361 | 384 | dev = port->port.dev; |
362 | 385 | if (dev) { |
363 | 386 | /* send the detach message */ | ... | ... |