Commit Graph

264 Commits

Author SHA1 Message Date
matt
833bb81cc5 add support for autostarting watchdogs (wdog was started by firmware
and can't be disabled).  Add critical pool hooks for kernel tickled
watchdogs.
2011-01-04 01:51:06 +00:00
pgoyette
59fe847ec9 When the user updates the sensor device's refresh timer, reset the
callout immediately rather than waiting for the previous timer to
expire.
2010-12-30 03:59:59 +00:00
pooka
5b13bc43b2 use aprint 2010-12-17 13:37:37 +00:00
njoly
608cbb3a81 Be sure to always initialize props variable to a sensible value.
Fix a problem with envstat -S call which was installing bogus/random
limits.

ok pgoyette.
2010-12-16 16:08:57 +00:00
pgoyette
5c690f069b Also allow specification of sensor's initial value when it is loaded,
using "-i value=<value>".

Suggested by njoly@
2010-12-16 14:33:30 +00:00
pgoyette
e76f489b1b Extract searching of description tables into a single function, rather
than duplicating the code every time.  Minor reduction in code size
(about 1200 bytes on amd64), no change in functionality.
2010-12-15 17:17:16 +00:00
pgoyette
73ddb4f5d6 Handle removal of limit properties correctly, even for sensors that
provide their own internal limit(s).
2010-12-11 15:17:15 +00:00
pgoyette
cedd9a0b1c Enhance the swsensor(4) pseudo-device's capabilities to emulate more
sensor types
2010-12-11 04:13:03 +00:00
pgoyette
9179849b5d When removing properties (as in envstat -S), clear the flags that track
whether the properties actually exist.

When setting new limit values, don't complain/ignore about duplicate
values if the associated flag bits (indicating that the limit is valid)
are not set.

These two fixes together should fix a problem reported in private Email
by njoly@ a couple months ago.  Issue replicated and solution tested
using my recent swsensor pseudo-device running inside qemu world!
2010-12-08 00:09:14 +00:00
pgoyette
0139c9e7c5 Make this compile when "options ENVSYS_OBJECTS_DEBUG" is defined. 2010-12-06 23:26:44 +00:00
pooka
13aff34b56 Apparently swwdog reboot hasn't worked in several years since it
tried to cpu_reboot() from a callout.  Make it reboot from a workq
instead.

problem made manifest
by atf test
rumpfs unmount flush
caused issue to un-shush

tested: rump kernel (tests/dev/sysmon) and qemu
2010-11-11 21:55:04 +00:00
pooka
1b3fe95df5 Revert 1.2 apart from incorrect comment. the devattach() routine
is of course still used by kernel&config pseudodev.

pointed out by jakllsch
2010-10-23 11:24:16 +00:00
pooka
41dc37e6d7 Set sensor state to valid upon refresh to make things generally work.
pgoyette ok
2010-10-20 19:21:04 +00:00
pooka
f4fd6656e3 remove unused routine (per comment) 2010-10-20 18:50:46 +00:00
pgoyette
3ae668c1c8 Add a new software-only sensor device. This is intended for use as a
kernel module, and can be helpful to generate sysmon_envsys events
when creating/modifying powerd scripts.  This will also be used in an
upcoming series of atf tests for sysmon_envsys itself.
2010-10-19 11:55:38 +00:00
pgoyette
c5da67f0a2 1. Don't try to call the driver's get_limits routine if it doesn't have
one.  Fixes a panic reported by njoly@ in private Email

2. Acquire the device before checking whether or not the get_limits
   routine exists.

XXX There's still a bug in here somewhere that prevents setting of
XXX limit values after using 'envstat -S'
2010-09-22 00:13:55 +00:00
pooka
c3884c5c41 * fix logic inversion in swwdog_reboot (and the sysctl).
* attach sysctl in constructor instead of as a link set to give it
  a chance to work in a module
* teardown sysctl when driver is detached to avoid dangling pointer
2010-08-06 16:02:56 +00:00
pgoyette
01497b95ec Convert swwdog(4) from a simple defpseudo device to a defpseudodev so
that we can attach a power management handler.  The handler prevents
a suspend if the watchdog is active, to be consistent with other
watchdog drivers.

As discussed on tech-kern.
2010-07-22 14:10:14 +00:00
pgoyette
730da12998 Use a typedef to define the prototype of the per-sensor callback.
Update manpage for the prototype, and fix a fubar'd Cross-reference.
2010-04-11 01:12:28 +00:00
pgoyette
d8f35b6e65 When removing sensor properties with envstat -S, ensure that drivers
which could have modified hardware state are informed so that original
state can be restored.

Welcome to 5.99.27
2010-04-10 19:01:00 +00:00
pgoyette
cae66ef7cc When unregistering a device, in addition to reducing the global count
of sensors, we need to adjust the sme_fsensor values for some devices.
Failure to do this leaves a sparesly-populated number-space and can
subsequently result in overlapping sensors number assignments.  (This
only affects the compatability-mode API, but still needs to be fixed.)
2010-04-03 13:55:09 +00:00
pgoyette
6d6a30996f Permit creation of an event-monitor for alarm limits even if the limits
are not currently set (and, in case of battery capacity sensors, if there
is no value_max).  Ensure that such an event-monitor does not trigger the
delivery of any actual events.

Provide a mechanism for sensors to set their limits at time other than
system startup (for example, when a battery is inserted).

This allows us to boot a system with a battery missing, install the
battery some time later, and automatically monitor it without requiring
any user intervention to create the event-monitor.  (The actual changes
for battery sensors to use this new capability will come later.)
2010-04-01 12:16:14 +00:00
pgoyette
aae23aaf98 Constify the args to sysmon_envsys_foreach_sensor()'s callback function. 2010-03-27 13:34:16 +00:00
pgoyette
5dbc4fad52 Fix the locking protocol in sysmon_envsys_foreach_sensor(), and add an
additional argument to control whether or not the sensors are refreshed
before invoking the callback routine.
2010-03-27 13:23:18 +00:00
pgoyette
6c1f2c419a Make this work the way the preceeding comment blocks says it works, and
break out of the while{ } when the callback returns false, not when it
returns true!
2010-03-26 21:06:25 +00:00
pgoyette
1de3adb5f4 Add a routine to iterate over all the sensors on the system. This will
be needed to update acpiapm_get_powstat() which is currently slightly
broken due to recent rearrangement of acpi_bat(4)'s sensors.  (This
approach is in lieu of exporting proplists between kernel entities, and
avoids exposing some internal sysmon_envsys details.)
2010-03-26 20:31:06 +00:00
pgoyette
e235f1e850 Export the sensor device's class. 2010-03-26 12:36:59 +00:00
njoly
3e46e29198 Fix ENVSYS_DEBUG build. 2010-03-24 19:15:00 +00:00
pgoyette
7e351badfc In sysmon_envsys_sensor_event(), permit delivery of all events for the
sensor if no event type is specified.
2010-03-24 13:11:41 +00:00
pgoyette
f8d161b1f5 Do the initial refresh before creating the event monitors, in case the
event monitors require some of the data loaded by the refresh.  For
example, the initial refresh might load sensor limits and max_value in
addition to the cur_value.
2010-03-24 12:15:54 +00:00
pgoyette
bc480daf7a Additional info in DPRINTF to help debugging efforts 2010-03-23 16:52:02 +00:00
pgoyette
3a92a7609d Modify previous commit. The routine to deliver events is intended to be
exported to device drivers, so rename it and move the declaration to
<dev/sysmon/sysmonvar.h>
2010-03-19 02:19:13 +00:00
pgoyette
4e3cadf247 Separate event delivery from polling and limit evaluation in
sme_events_worker().

Provide a wrapper that can be called from sensor drivers' interrupt
routines to find and deliver a specific event.

XXX Actually updating sensor drivers (and their parent devices) to
XXX have interrupts is a future enhancement.  This is simply an
XXX enabler.
2010-03-19 01:16:44 +00:00
pgoyette
d5f3dc8bdd Retire the 'monitor' member of the envsys_data_t. It was only used in
one place, and functioned as a logical OR of the ENVSYS_FMON* flag bits.
2010-03-14 18:03:15 +00:00
jruoho
77c099394c Fix comment typos (mangement, managmenet). 2010-03-11 13:51:01 +00:00
pgoyette
06d81b8ad2 Move definitions of internal data structures and flag bits to avoid
exposing them to user-land.
2010-02-28 20:04:04 +00:00
pgoyette
f2b6b76565 If we're going to valdate things, at least do it correctly. 2010-02-18 12:30:53 +00:00
pgoyette
8844275b30 For symmetry, allow warning and critical upper-limits for capacity
sensors.
2010-02-15 22:32:04 +00:00
pgoyette
de08bb89f2 Replace large amount of replicated code with a macro to improve readability. 2010-02-14 23:30:52 +00:00
pgoyette
9150436462 Remove the flags member of the limits structure. Its value was only
meaningful for a few limited function calls;  all persitent storage
of limit-present flags is maintained in the edata->upropset member.
2010-02-14 23:06:01 +00:00
pgoyette
f84d320712 Correct one more instance of checking flags in the wrong place. 2010-02-14 16:22:09 +00:00
pgoyette
7bd93168ee When checking current sensor value vs limits, check the correct set of
flags to determine which limits are present.
2010-02-13 19:34:14 +00:00
jruoho
7ed7fa0c2a Fix a typo in one DPRINTF (s/edata->des/edata->desc/). 2010-02-05 19:22:25 +00:00
pgoyette
1fe73d6688 One more callback of sme_refresh() routine needs to check first that
there is a routine to be called!
2010-02-05 17:44:27 +00:00
pgoyette
4c60416219 If the AC adapter is flagged with SME_DISABLE_REFRESH, don't try to call
its refresh() callback.  Just assume that its value has been properly
updated by other means.
2010-02-04 18:06:53 +00:00
martin
2a2c96609a Fix an outdated comment, noticed by Paul Goyette. 2010-01-31 22:53:56 +00:00
martin
889f82dd49 Add a convenience function to find the maximum value currently reported
by a set (selected via a passed callback predicate) of sensors.
This provides an easy way to query the current temperature of a thermal
zone, for example, from within the kernel - assuming the caller knows
the topology.
2010-01-31 21:36:38 +00:00
pooka
fdca8d1743 print newline after timer expiry message 2010-01-31 02:54:56 +00:00
pooka
f510198e1c Make swwdog use no-needs-count. As the manpage says, there can be only one. 2010-01-30 21:55:28 +00:00
pgoyette
aaabf34dde Validate limit-based monitoring in one place, so we can apply the
constraints to both driver-requested and user-requested monitoring.

While here, clean up some of the debugging DPRINTFs.
2010-01-30 02:46:52 +00:00