PATCH: ecng for 6.x and 7.x

From: Nate Lawson <nate_at_root.org>
Date: Thu, 06 Sep 2007 14:56:10 -0700
I've done some major rework on the EC driver.  This should help with
various problems, including timeouts while checking battery status or
temperature.  The attached patches are for 6.x and 7.x.  Please test and
let me know if you get any new errors on dmesg or if it fixes things for
you (especially HP/Compaq laptop owners).

If you still have problems, try setting each of these tunables
individually and then both together (i.e., in /boot/loader.conf).  Note
that this will be four (4) test runs total, so don't just set both and
say it doesn't work.

debug.acpi.ec.burst="1"
debug.acpi.ec.polled="1"

I've tested both patches on a Panasonic Y4 and UnnamedOEM laptop, no
problems in either regular or burst mode.


Commit message:
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 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 will be unreliable.  There's not
much more we can do about this until interrupts are enabled during boot.
- Hold the sx lock over the entire query handler, since the GPE handler
no longer grabs any lock
- 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 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)


-Nate

Received on Thu Sep 06 2007 - 20:23:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:17 UTC