diff options
| author | Nate Lawson <njl@FreeBSD.org> | 2004-06-28 20:41:30 +0000 |
|---|---|---|
| committer | Nate Lawson <njl@FreeBSD.org> | 2004-06-28 20:41:30 +0000 |
| commit | 636af3826fba684f832241c050e299136e44fe2a (patch) | |
| tree | 37e274dd7370f7a20eab5818c1c1b1ee395a74bc /sys/dev | |
| parent | 9174ca7ba352135f98a6430dc3b09a4740948bce (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/acpica/acpi_ec.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index d2605bc7228a0..4902eed715607 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -822,11 +822,18 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event) AcpiOsStall(1); /* + * If we're up and running, wait up to 1 ms. Otherwise, burn the entire + * timeout value with delays since msleep() is a no-op. + */ + period = 1000 / sc->ec_polldelay; + if (cold) + period *= ec_poll_timeout; + + /* * Poll the EC status register to detect completion of the last - * command. First, wait up to 1 ms in chunks of sc->ec_polldelay - * microseconds. + * command in chunks of ec_polldelay. */ - for (i = 0; i < 1000 / sc->ec_polldelay; i++) { + for (i = 0; i < period; i++) { EcStatus = EC_GET_CSR(sc); if (EVENT_READY(Event, EcStatus)) { Status = AE_OK; @@ -847,10 +854,10 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event) sc->ec_polldelay = 100; /* - * If we still don't have a response, wait up to ec_poll_timeout ms - * for completion, sleeping for chunks of 10 ms. + * If we still don't have a response and we're up and running, wait up + * to ec_poll_timeout ms for completion, sleeping for chunks of 10 ms. */ - if (Status != AE_OK) { + if (!cold && Status != AE_OK) { retval = -1; for (i = 0; i < ec_poll_timeout / 10; i++) { if (retval != 0) |
