Mark Kettenis wrote: > Index: dev/acpi/dsdt.c > =================================================================== > RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v > retrieving revision 1.243 > diff -u -p -r1.243 dsdt.c > --- dev/acpi/dsdt.c 19 Aug 2018 08:23:47 -0000 1.243 > +++ dev/acpi/dsdt.c 8 Jan 2019 18:55:14 -0000 > @@ -2905,29 +2905,33 @@ int > acpi_event_wait(struct aml_scope *scope, struct aml_value *evt, int timeout) > { > /* Wait for event to occur; do work in meantime */ > - evt->v_evt.state = 0; > - while (!evt->v_evt.state) { > - if (!acpi_dotask(acpi_softc) && !cold) > - tsleep(evt, PWAIT, "acpievt", 1); > - else > - delay(100); > + while (evt->v_evt.state == 0 && timeout >= 0) { > + if (acpi_dotask(acpi_softc)) > + continue; > + if (!cold) { > + if (rwsleep(evt, &acpi_softc->sc_lck, PWAIT, > + "acpievt", 1) == EWOULDBLOCK) { > + if (timeout < 0xffff) > + timeout -= (1000 / hz); > + } > + } else { > + delay(1000); > + if (timeout < 0xffff) > + timeout--; > + }
Does 0xffff come from ACPI? Can we give that a name? I thought sleeping for one tick is kinda weird, but I see what it's doing with the acpi_dotask loop. This feels precarious, but whatever.