battery was changed to another one. However, this is unreliable as many
vendors hardcode the serial number string in the DSDT. Thus, use the design
capacity and voltage instead; these are likely read from the battery itself.
readings during the sysmon_envsys(9) poll cycle. Some systems (notably,
Asus EeePC) have so badly implemented AML that reading the values via
envstat(8) alone can cause considerable delays.
"Do not queue functions via sysmon_taskq(9) in the pmf(9) resume hooks.
There is a small and unlikely race when the drivers are loaded as modules;
suspend, resume, queue a function, and immediately unload the module."
Queueing the checks in the resume hooks was observed to improve the resume
time by several seconds (!) on a system with poorly implemented AML code.
The observed race condition is a wider issue related to modules; things like
sysmon_taskq(9) should be modified to allow cancelling of queued functions.
initialization of sysmon_envsys(9), otherwise, if _STA does not return true
during the attachment of the driver, it is possible that a flag is never
set. This flaw has always been present, but it only got exposed after the
conversion to use the sysmon-limits.
Note, config whines about things like:
files.acpi:30: attaching undefined device `apm'
I intentionally was a lazy boy and didn't include a ton of dirt to
keep the hot napalm and riot blasts in the config thread rolling ;)
tested by jruoho (thanks!)
<dev/acpi/acpivar.h>. Ditto for <dev/sysmon/sysmonvar.h>, <sys/bus.h>,
<dev/pci/pcivar.h>, and <dev/isa/isavar.h>.
Also nuke a lot of unused and invalid headers. Some of these are audibly
provided by standard headers (namely <sys/param.h> and <sys/device.h>), some
have nothing to do with ACPI devices (e.g. <sys/syslog.h>), and some are
nonexistent local includes (e.g. "mpu_ym.h"). Moreoever, try to group the
includes into their respective blocks.
Tested with GENERIC and ALL (i386). No functional change.
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
is discharging; it might make sense when charging, but it doesn't
make sense if neither is the case -- remove a wrong assertion and
arrange the code to make this obvious
(actually, the ACPI spec says that the requirement is only for
rechargeable batteries)
* Remove ACPI_BAT_DEBUG.
* Reduce the amount of error reporting.
* Remove the internal bookkeeping flags.
* Remove the debugging functions used to print status and information
changes. This information is fully conveyed in the output of envstat(8).
* Always evaluate _STA. If it fails or the battery is not present, mark
all remaining sensors as invalid. This will eliminate the convoluted
update routine.
* Semantics.
Over 200 LOC was eliminated, but functional change should again be minimal.
ok jmcneill@, pgoyette@
* Provide proper definitions and use these.
* Clarify the evaluation of _STA.
* Mark the state of a sensor according to the return value from _STA.
* Share the basic object evaluation in _BIF and _BST.
* Verify the object types before using the objects.
* Be aware of bogus values from _BIF and _BST, as noted in the
specification.
Despite of the list, functional change should be minimal. Ok pgoyette@.
Workaround for firmware that doesn't report battery present status
immediately at boot and doesn't issue a subsequent notify when the
information becomes available.
we will get notified for changes there). Use SME_POLL_ONLY so applications
that use GTREDATA don't cause trouble, and don't use SME_INIT_REFRESH as it
appears to be completely broken.
* No need for sme_refresh callback; GPE handler will tell us when the
device status changed (otherwise we can refresh data up to once a second,
and that can take time!)
* Since sme_refresh callback is gone, mutex is no longer required to
synchronize GPE handlers and refresh thread, so nuke it.
* Don't do any more work in GPE handler than required; use AcpiOsExecute
to clear battery status/information in the sysmon_task_queue along with
the refresh.
With these changes running GNOME's battstat-applet-2 no longer causes
my mouse to stutter once a second, and significantly reduces its CPU usage.