Commit Graph

300 Commits

Author SHA1 Message Date
pgoyette cc70ada49c Constify 2012-12-14 15:33:19 +00:00
pgoyette 40bcf0f0ee The sensor limit values were moved out of the event structure and into the
per-sensor structure a long time ago.  Garbage collect the old structure
member which is now unused.
2012-12-14 03:31:10 +00:00
pgoyette 76c350d10d Replace a couple of many-line #define with equivalent code loops.
No functional change intended, and atf tests (using swsensor(4)) still
pass 100%
2012-12-11 15:39:06 +00:00
msaitoh b9514938ff Remove trailing white space(s) from name of random source.
And also, changind space(s) in the middle with '-'.
PR#47232.
2012-11-29 10:29:45 +00:00
macallan 9414e51eaf in sme_battery_check():
- don't assume that all batteries have exactly one ENVSYS_INDICATOR
- check capacity and charge sensors for ENVSYS_SVALID before using them
now this works on macppc
2012-10-31 05:42:47 +00:00
macallan 5ea92e4d6e opt_envsys.h needs #ifdef _KERNEL_OPT
( thanks martin@ )
2012-09-06 12:59:00 +00:00
pgoyette 5b61c9d192 Remove (commented-out) definitions for debugging - thanks to macallan@
for defflagging these.
2012-09-06 12:21:40 +00:00
macallan 098292096f defflag debug #defines 2012-09-06 12:10:28 +00:00
pgoyette 9687fb7cf2 1. Enable use of FMONSTCHANGED events for INDICATOR sensors
2. Update handling of FMONCRITICAL event reporting.   The state
   transition does not require a corresponding change in value.

With these changes, you can now have an INDICATOR sensor that
reports the presence or absence of a device, and (if the device
is present) separately monitor it for proper functioning.

Should address the concerns expressed recently with the commit
of changes to wmi(4) BBU handling.
2012-08-27 21:42:04 +00:00
pgoyette 4525347a98 Add hw.swsensor.state variable for additional control capability. 2012-08-27 20:29:11 +00:00
pgoyette 2c133669b5 Fix indentation. No code change. 2012-08-27 14:15:52 +00:00
pgoyette 941f09b7a5 Simplify some logic - no functional change intended.
While here, clean up a couple of comments.
2012-08-27 14:08:36 +00:00
pgoyette 840097bfdf Make sure to re-add the sensor as an entropy source after user request
to reset (via envstat -S)
2012-07-19 13:31:06 +00:00
pgoyette 55a8dfa0ed If previously there was only a dummy event entry (to force refresh for
entropy gathering), allow it to be updated for the current request to
add a real entry.
2012-07-19 13:30:01 +00:00
pgoyette 8aacc86c66 Release the mutex before taking a quick exit. 2012-07-18 20:50:40 +00:00
pgoyette 063727a480 Extend previous changes so that even sensors which don't use a refresh()
callback to update the value can be polled to provide rnd(4) entropy.
2012-07-16 13:55:01 +00:00
pgoyette 87d1d2214b If a sensor is flagged as capable of providing rnd(4) with entropy,
hook the sensor into rnd subsystem, and make sure we periodically
refresh the sensor whether or not it is being actively monitored.
2012-07-15 18:33:07 +00:00
pgoyette 0bc91edaa9 When unregistering a sensor device, make sure we unregister and delete
all the associated events.
2012-07-15 17:41:39 +00:00
matt a621c8945e Don't export sysmon_envsys_list as a common. 2012-02-18 01:08:00 +00:00
tls 7b0b7dedd9 Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.
2012-02-02 19:42:57 +00:00
mbalmer 631d5867a0 According to the Oxford Dictionary of Etymology, a wether is a male sheep
or ram.
2011-08-01 12:28:53 +00:00
jakllsch ce87c7ef94 Ensure events come off the list in the same order they went on.
Hotkey press/release events now happen in the correct order.
2011-07-22 14:21:40 +00:00
pgoyette 3dbac3b2ec Use {...} to prevent premature exit from initialization function - this
lets the atf tests run again.

Move validation of current value vs min/max into the refresh routine
where it will get checked every time, not just at initialization.

While here, do a little more housekeeping:
  - Retrieve numeric property value once
  - Ensure that a numeric-specified sensor type is valid
  - printout any unrecognized properties (DEBUG only)
2011-06-19 15:52:48 +00:00
martin b2ead544fd Instead of crashing, print a usable error message when a driver eroneously
does not properly initialize sensor state.
2011-06-19 11:40:26 +00:00
nonaka e191e46afa Pass table_id to sme_find_table(). 2011-06-19 05:26:31 +00:00
nonaka fa7cbdd70b fix typo. 2011-06-19 05:17:38 +00:00
christos 3cc7694381 simplify and don't deref NULL. 2011-06-19 04:23:18 +00:00
pgoyette 13580ba5b6 Use correct routine to retrieve string value from prop-dictionary 2011-06-19 04:08:48 +00:00
pgoyette eff7c483c3 Rather than requiring the user to know the internal encoding of sensor
types, allow the user to specify the type using the units description.

XXX Numeric specification is still permitted but will be removed soon.
2011-06-19 03:12:31 +00:00
pgoyette 3b3fd97442 Add routine to lookup description tables by description instead of by
type.
2011-06-19 03:09:43 +00:00
pgoyette 5960b5e520 Previous fix broke the setting of current value for Indicator and
Battery-Charge sensors.  Fix this.
2011-06-15 13:34:13 +00:00
pgoyette 35a3b0e4a6 Factor out some duplicated code to simplify maintenance. Reduces
the source file by ~100 lines, and amd64 object file shrinks by
~650 bytes.

No functional change intended.
2011-06-08 18:22:24 +00:00
pgoyette 67461ad93e Restrict limit monitoring for Indicator sensors as well as for
Battery-charge sensors.
2011-06-08 16:14:57 +00:00
pgoyette 41f31ea216 Remove ability to the value_avg since it no longer exists 2011-06-04 13:26:51 +00:00
pgoyette 77b2e2fc09 Since nothing actually records or maintains an average sensor value,
remove value_avg from the prop_dict.  We can't completely remove it
because there's one driver that uses this field for its own private
purposes, so for now we just rename the member.
2011-06-04 13:24:33 +00:00
pgoyette 40ef889e08 Enable creation of value_{max,min,avg} entries via the proplist, as well
as setting the ENVSYS_FPERCENT flag
2011-06-04 02:02:55 +00:00
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