Commit Graph

112 Commits

Author SHA1 Message Date
jruoho
4f0c2c3f04 Collect rnd(9) entropy from coretemp(4), acpibat(4), aibs(4), hpacel(4),
thinkpad(4), and aps(4).
2012-08-14 14:36:43 +00:00
jruoho
270b0c802b In revision 1.103 the serial number was used to determine whether the
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.
2011-07-13 09:58:53 +00:00
pgoyette
1281d34a15 Initialize battery capacity sensor value before registering. 2011-06-20 20:24:59 +00:00
jruoho
5f852a8424 Change the preprocessor defines around the module(9)'s modcmd() calls such
that the modules show in modstat(8) even though these are "builtin".
2011-02-16 09:05:12 +00:00
jruoho
3c51ce4b05 Upon request from jmcneill@, put the check back that prevents unnecessary
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.
2011-01-13 13:05:13 +00:00
jruoho
c40255f958 Print a message if ACPI 4.0 functionality is present (in which case the
driver should be updated).
2011-01-09 09:47:55 +00:00
jruoho
c96fe4ba5e Revert the changes made in the commit:
"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.
2011-01-04 05:48:48 +00:00
jruoho
70e14dc983 Bump WARNS to 4. 2010-10-25 07:48:03 +00:00
jruoho
7aa250c707 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.
2010-08-14 05:41:22 +00:00
jruoho
ab05d95b29 Only aprint*() the battery information if the battery has changed. Based on
suggestion from mrg@. The used serial number is hopefully unique enough as
an identifier. Should fix PR kern/43505 by David Demelier.
2010-06-30 15:38:27 +00:00
jruoho
f04ee53053 Use ACPICA's standard notify values from <actypes.h> and move the
device-specific notify constants to the device-specific files.
2010-04-27 05:57:43 +00:00
christos
b62024a026 fix dmesg printing. 2010-04-16 01:52:54 +00:00
jruoho
55052eca77 As discussed with jmcneill@, install a global "bus notification handler"
that receives all notifications and deliver notifications to drivers via it.
2010-04-15 07:02:24 +00:00
jruoho
fb53d8ceed No need to spread the ACPICA type system any more than is necessary:
UINT8 -> uint8_t and UINT32 -> uint32_t.
2010-04-14 19:27:28 +00:00
jruoho
7fe08819d5 Update the limits when a change from absent to present is detected. 2010-04-03 16:29:22 +00:00
pooka
54be9a9f62 Catch up with cosmetic changes to output from config(1) 2010-03-26 15:51:55 +00:00
pooka
929e108067 Convert to config_init/fini_component.
tested by jruoho
2010-03-26 05:59:26 +00:00
pgoyette
0c7008e9c3 Set the SME_INIT_REFRESH flag so that the sensors' values (including
charge's max_value) are available when the event monitors are created.
2010-03-24 12:18:54 +00:00
jruoho
dfc3a8d66a Fix the previous commit properly: we need to set all sensor-flags during the
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.
2010-03-22 15:08:35 +00:00
jruoho
72763cb4e7 Set the capacity flags already in the acpibat_get_info(),
instead of acpibat_get_status().
2010-03-22 09:31:24 +00:00
pooka
f3beefdb45 Convert acpibat to use ioconf instead of homerolled config glue.
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!)
2010-03-21 07:09:56 +00:00
jruoho
ef2b6dd20b Print also the so-called "granularity" values when the _BIF is evaluated.
These refer to the smallest increment in capacity that the battery is
capable of measuring.
2010-03-17 11:07:59 +00:00
jruoho
dce0020d0c Remove the technology "sensor" (a fixed constant). Report this information
in an improved output when the battery information changes (i.e. device
attachment or battery removal/insertion).
2010-03-17 09:21:50 +00:00
jruoho
febc76c6be Remove the timer-based check in the sensor refresh routine. We henceforth
trust that the sysmon_envsys(9)'s polling is functioning properly. Discussed
with drochner@, jmcneill@, and pgoyette@.
2010-03-17 08:07:27 +00:00
jruoho
88e4bfe590 Fix the testing of temporarily unknown values. 2010-03-17 07:48:18 +00:00
jruoho
73b3b3d393 Move the low and warning capacity sensors to the limits framework provided
by sysmon_envsys(9).
2010-03-17 07:40:34 +00:00
pgoyette
89bf6ebb9f Remove setting of edata->monitor since that member no longer exists. 2010-03-14 18:05:07 +00:00
jruoho
aa4b9b510c Use the predefined ACPI_STA_BATTERY_PRESENT instead of defining a local one. 2010-03-08 11:45:45 +00:00
jruoho
5a425210a3 Remove <dev/acpi/acpica.h> from all files. It is included from
<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.
2010-03-05 14:00:16 +00:00
jruoho
86c3014958 Introduce support for ACPI kernel modules.
Tested on couple of laptops.
2010-02-28 17:22:41 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
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.
2010-02-24 22:37:54 +00:00
jruoho
baf97f9356 Allocate the sensor structures dynamically. 2010-01-31 06:45:09 +00:00
jruoho
1aca5372db Add detachment routines. 2010-01-31 06:10:53 +00:00
drochner
30d27f4f07 the "Battery Present Rate" is only required to be valid if the battery
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)
2010-01-27 22:17:28 +00:00
jruoho
e6056a8df3 * Reintroduce a state variable. From njoly@.
* Always mark the charge state sensor as valid.
2010-01-24 11:32:13 +00:00
jruoho
3f1f18b1bd Cleanup:
* 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@
2010-01-23 15:06:47 +00:00
jruoho
791571cbd1 In preparation for upcoming changes:
* 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@.
2010-01-21 08:57:17 +00:00
dyoung
cd6e1fbf91 Expand PMF_FN_* macros. 2010-01-08 19:53:10 +00:00
jmcneill
5be9fd621d If the driver thinks a battery is not present, poll for present status.
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.
2009-09-29 21:41:38 +00:00
mlelstv
23ab96a36b Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.
2009-09-16 10:47:54 +00:00
jmcneill
80adfeb08d PR# kern/41179: Incorrect return values from AcpiOsExecute()
ACPICA functions return ACPI_STATUS instead of int, so use it for
consistency.
2009-08-25 10:34:08 +00:00
cegger
93dfc06da9 struct device * -> device_t, no functional changes intended. 2009-05-12 09:50:28 +00:00
cegger
e5339e11d4 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 09:29:46 +00:00
jmcneill
fc993c6a36 Reintroduce acpibat_refresh, only have it refresh battery status (not info,
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.
2008-06-03 15:02:31 +00:00
jmcneill
edd4ea5b7d Refresh battery info/status on resume. 2008-06-03 12:16:34 +00:00
jmcneill
daaa85a781 Simplify SME usage within acpibat:
* 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.
2008-06-03 01:11:18 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
xtraeme
6e9673dcb2 Use the SME_INIT_REFRESH flag to fetch sensor data once in the
autoconf(9) process.
2008-03-23 16:12:45 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad
598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00