Commit Graph

246 Commits

Author SHA1 Message Date
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
pgoyette af4bab2a6f Move the limits out of the event structure and into the main sensor.
Use the limits_flags only for calls to the {get,set}_limits() callbacks
and merge the results into upropset, rather than trying to maintain both
values (error prone).
2010-01-26 14:22:00 +00:00
pgoyette 299ee01345 If no limits are exceeded, make sure we set state to SVALID 2010-01-18 21:48:15 +00:00
pgoyette 4e1c0f753c Flags for existence of limit values need to be propagated to the
event data.  Otherwise, they're not processed.

XXX This needs to be rethought.  While fixing it this way makes things
XXX "work", we really shouldn't need to replicate these flags.  The
XXX limits and their flags should be kept as part of the sensor data,
XXX and not part of the event-monitor data.  I'll work on this in the
XXX near future.
2010-01-02 19:02:39 +00:00
pgoyette 801c007d68 Don't infer a sensor driver's ability to handle limit checking itself. 2010-01-01 15:41:25 +00:00
pgoyette 160a805c1d Check for value exceeding crit-max limit before checking against warn-max
limit.  Otherwise we'll never notice if we exceed crit-max (assuming that
crit-max is at least as large as warn-max).
2009-12-23 18:31:00 +00:00
jakllsch d50bb58a85 Fix POWER_IOC_GET_TYPE.
The longest string in use with this seems to have been "acpi",
so size_t covered that, but on 32-bit ports omited the NUL.
2009-11-06 18:28:10 +00:00
pgoyette d36ea2afc5 Document usage of PROP_DRIVER_LIMITS flag and set it correctly.
Use flag bits to determine validity of limit values, rather than
assuming that invalid/not-present values are set to zero.
2009-07-10 15:27:33 +00:00
pgoyette 0fab9769e4 Remove some code (bracketed by #ifdef NOTYET / #endif) that should not
have been committed in the first place.
2009-07-10 13:09:09 +00:00
pgoyette e17701cfef Remove driver name from debug message. Not all drivers have set this
early enough, and we can easily figure out the driver name from some
subsequent debug messages.
2009-07-08 17:54:27 +00:00
pgoyette c7ba8d5428 Initialize lims.sel_flags before using it. Prevents spurious limit
events being created for devices that don't provide internal limits.

Thanks to Mattias for finding this.
2009-07-08 17:28:53 +00:00
pgoyette e65558aef1 Clean up a couple of debug statements that got missed previously. 2009-07-08 13:34:11 +00:00
pgoyette 45f4717820 Ooops - {get,set}_limits() need to be sensor-specific. Pass an extra
argument to them to identify the individual sensor being processed.
2009-06-14 19:43:12 +00:00
pgoyette c235777756 Add capability to send sensor limit values to the driver so they can
be programmed into device registers.  This way we can let the hardware
help us out instead of having to always compare the value against each
limit.  (Driver updates for some sensors to take advantage of this
capability will be forthcoming.)
2009-06-13 16:08:25 +00:00
pgoyette 260b6fd907 Correct typo in last so we can #undef the correct macro. 2009-06-08 13:06:33 +00:00
pgoyette f7ad703892 General clean-up and some restructuring of event handling. This is a
precursor to letting sensor drivers actually exchange limits/thresholds
with user-land.
2009-06-08 00:55:35 +00:00
pgoyette 677e91afbc Don't allocate the private list-threading structure unless we're going
to use it.  Otherwise we end up leaking little bits of memory for each
sensor that is not monitored at time of initial registration.
2009-06-03 11:43:15 +00:00
pgoyette 5a84f3060e Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits.  Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
2009-06-01 20:08:44 +00:00
dyoung 3afac3e189 Fix spelling: mak -> make. 2009-04-07 21:49:36 +00:00