freebsd-skq/sys/modules/acpi
njl b50224d3f9 Rewrite the EC driver event model. The main goal is to avoid
polling/interrupt-driven fallback and instead use polling only during
boot and pure interrupt-driven mode after boot.  Polled mode could be
relegated completely to a legacy role if we could enable interrupts
during boot.  Polled mode can be forced after boot by setting
debug.acpi.ec.polled="1", i.e. if there are timeouts.

- Use polling only during boot, shutdown, or if requested by the user.
  Otherwise, use a generation count of GPEs, incremented atomically.  This
  prevents an old status value from being used if the EC is really slow
  and the same condition (i.e. multiple IBEs for a write transaction) is
  being checked.
- Check for and run the query handler directly if the SCI bit is set in
  the status register during boot.  Previously, the query handler wouldn't
  run until interrupts were finally enabled late in boot.
- During boot and after starting a command, check if the event appears
  to already have occurred before we even start waiting.  If so, it's
  possible the EC is very slow and we might accept an old status value.
  Print a warning in this case.  Once we've booted, interrupt-driven mode
  should work just fine but polled mode could be unreliable.  There's not
  much more we can do about this until interrupts are enabled during boot.
- In the above case, we also do one final check if the interrupt-driven
  mode gets a timeout.  If the status is complete, it will force the
  system back into polled mode since interrupt mode doesn't work.  For
  polled mode during boot, if the status appears to be already complete
  before beginning the check loop, it waits 10 us before actually checking
  the status, just in case the EC is really slow and hasn't gotten to work
  on the new request yet.
- Use upper-case hex for the _Qxx method
- Use device_printf for errors, don't hide them under verbose
- Increase default total timeout to 750 ms and decrease polling interval
  to 5 us.
- Don't pass the status value via the softc.  Just read it directly.
- Remove the mutex. We use the sx lock for transaction serialization
  with the query handler.
- Remove the Intel copyright notice as no code of theirs was ever
  present in this file (verified against rev 1.1)
- Allow KTR module-only builds for ease of testing

Thanks to jkim and Alexey Starikovskiy for helpful discussions and testing.

Approved by:	re
MFC after:	2 weeks
2007-09-24 16:59:06 +00:00
..
acpi Rewrite the EC driver event model. The main goal is to avoid 2007-09-24 16:59:06 +00:00
acpi_aiboost Driver for some ASUS desktop motherboard extras. 2006-10-30 05:38:48 +00:00
acpi_asus Dike out WARNS from kernel module makefiles. Kernels and modules 2006-05-30 09:38:54 +00:00
acpi_dock
acpi_fujitsu
acpi_ibm
acpi_panasonic Dike out WARNS from kernel module makefiles. Kernels and modules 2006-05-30 09:38:54 +00:00
acpi_sony
acpi_toshiba Dike out WARNS from kernel module makefiles. Kernels and modules 2006-05-30 09:38:54 +00:00
acpi_video Make acpica include path relative, not absolute. 2007-06-24 20:36:51 +00:00
Makefile Catch up with ACPI-CA 20070320 import. 2007-03-22 18:16:43 +00:00
Makefile.inc