summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-06-28 20:41:30 +0000
committernjl <njl@FreeBSD.org>2004-06-28 20:41:30 +0000
commitbd2a2aff397a5df81c5e8074164fd897ba252411 (patch)
tree37e274dd7370f7a20eab5818c1c1b1ee395a74bc /sys/dev/acpica
parent16dc5859f2d4aa081638361152c428cad5042baa (diff)
downloadFreeBSD-src-bd2a2aff397a5df81c5e8074164fd897ba252411.zip
FreeBSD-src-bd2a2aff397a5df81c5e8074164fd897ba252411.tar.gz
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
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_ec.c19
1 files changed, 13 insertions, 6 deletions
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)
OpenPOWER on IntegriCloud