|
Lines 254-259
Link Here
|
| 254 |
static void uhci_dump_td __P((uhci_soft_td_t *)); |
254 |
static void uhci_dump_td __P((uhci_soft_td_t *)); |
| 255 |
#endif |
255 |
#endif |
| 256 |
|
256 |
|
|
|
257 |
#define UWRITE1(sc, r, x) bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)) |
| 257 |
#define UWRITE2(sc, r, x) bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)) |
258 |
#define UWRITE2(sc, r, x) bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)) |
| 258 |
#define UWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)) |
259 |
#define UWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)) |
| 259 |
#define UREAD1(sc, r) bus_space_read_1((sc)->iot, (sc)->ioh, (r)) |
260 |
#define UREAD1(sc, r) bus_space_read_1((sc)->iot, (sc)->ioh, (r)) |
|
Lines 584-600
Link Here
|
| 584 |
sc->sc_has_timo->timo_handle); |
585 |
sc->sc_has_timo->timo_handle); |
| 585 |
sc->sc_bus.use_polling++; |
586 |
sc->sc_bus.use_polling++; |
| 586 |
uhci_run(sc, 0); /* stop the controller */ |
587 |
uhci_run(sc, 0); /* stop the controller */ |
|
|
588 |
|
| 589 |
/* save some state if BIOS doesn't */ |
| 590 |
sc->sc_saved_frnum = UREAD2(sc, UHCI_FRNUM); |
| 591 |
sc->sc_saved_sof = UREAD1(sc, UHCI_SOF); |
| 592 |
|
| 587 |
UHCICMD(sc, cmd | UHCI_CMD_EGSM); /* enter global suspend */ |
593 |
UHCICMD(sc, cmd | UHCI_CMD_EGSM); /* enter global suspend */ |
| 588 |
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT); |
594 |
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT); |
| 589 |
sc->sc_suspend = why; |
595 |
sc->sc_suspend = why; |
| 590 |
sc->sc_bus.use_polling--; |
596 |
sc->sc_bus.use_polling--; |
| 591 |
DPRINTF(("uhci_power: cmd=0x%x\n", UREAD2(sc, UHCI_CMD))); |
597 |
DPRINTF(("uhci_power: cmd=0x%x\n", UREAD2(sc, UHCI_CMD))); |
| 592 |
} else { |
598 |
} else { |
| 593 |
/* |
|
|
| 594 |
* XXX We should really do much more here in case the |
| 595 |
* controller registers have been lost and BIOS has |
| 596 |
* not restored them. |
| 597 |
*/ |
| 598 |
#ifdef DIAGNOSTIC |
599 |
#ifdef DIAGNOSTIC |
| 599 |
if (sc->sc_suspend == PWR_RESUME) |
600 |
if (sc->sc_suspend == PWR_RESUME) |
| 600 |
printf("uhci_power: weird, resume without suspend.\n"); |
601 |
printf("uhci_power: weird, resume without suspend.\n"); |
|
Lines 603-608
Link Here
|
| 603 |
sc->sc_suspend = why; |
604 |
sc->sc_suspend = why; |
| 604 |
if (cmd & UHCI_CMD_RS) |
605 |
if (cmd & UHCI_CMD_RS) |
| 605 |
uhci_run(sc, 0); /* in case BIOS has started it */ |
606 |
uhci_run(sc, 0); /* in case BIOS has started it */ |
|
|
607 |
|
| 608 |
/* restore saved state */ |
| 609 |
UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0)); |
| 610 |
UWRITE2(sc, UHCI_FRNUM, sc->sc_saved_frnum); |
| 611 |
UWRITE1(sc, UHCI_SOF, sc->sc_saved_sof); |
| 612 |
|
| 606 |
UHCICMD(sc, cmd | UHCI_CMD_FGR); /* force global resume */ |
613 |
UHCICMD(sc, cmd | UHCI_CMD_FGR); /* force global resume */ |
| 607 |
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY); |
614 |
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY); |
| 608 |
UHCICMD(sc, cmd & ~UHCI_CMD_EGSM); /* back to normal */ |
615 |
UHCICMD(sc, cmd & ~UHCI_CMD_EGSM); /* back to normal */ |