If the EC fails to go into burst mode for whatever reason, the Burst
Acknowledge byte will not be there to read, which means the status
won't have EC_STAT_OBF, which means acpiec_wait will spin forever,
hanging the machine.

This at least gets us moving again, ignoring the failure to enter
burst mode.


diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c
index a7627b8..c280410 100644
--- a/sys/dev/acpi/acpiec.c
+++ b/sys/dev/acpi/acpiec.c
@@ -130,6 +130,7 @@ acpiec_write_cmd(struct acpiec_softc *sc, u_int8_t val)
        acpiec_wait(sc, EC_STAT_IBF, 0);
        dnprintf(40, "acpiec: write_cmd -- %d\n", (int)val);
        bus_space_write_1(sc->sc_cmd_bt, sc->sc_cmd_bh, 0, val);
+       acpiec_wait(sc, EC_STAT_IBF, 0);
 }
 
 u_int8_t
@@ -196,7 +197,10 @@ void
 acpiec_burst_enable(struct acpiec_softc *sc)
 {
        acpiec_write_cmd(sc, EC_CMD_BE);
-       acpiec_read_data(sc);
+       if (acpiec_status(sc) & (EC_STAT_BURST|EC_STAT_OBF))
+               acpiec_read_data(sc);
+       else
+               dnprintf(10, "%s: failed to enter burst mode\n", DEVNAME(sc));
 }
 
 void

Reply via email to