From bd2a2aff397a5df81c5e8074164fd897ba252411 Mon Sep 17 00:00:00 2001 From: njl Date: Mon, 28 Jun 2004 20:41:30 +0000 Subject: While booting, use DELAY() for waiting for the EC to respond instead of msleep(). Until we're finally up, msleep is a no-op. Explained by: peter --- sys/dev/acpica/acpi_ec.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'sys/dev/acpica') diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index d2605bc..4902eed 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) -- cgit v1.1