Commit Graph

54 Commits

Author SHA1 Message Date
xtraeme bf4558f8cf Imported envsys 2, a brief description of the new features:
(Part 1: API)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
  and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
  sysmon_power(9) and powerd(8), that means there is no 32 bytes event
  size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 07:36:39 +00:00
xtraeme e31adb2d42 Use aprint_debug rather than printf for the annoying message
"WARNING: Callback scheduled before sysmon task queue thread present.".
2007-06-27 13:04:15 +00:00
xtraeme b6336505dc Remove duplicate sysmonioctl_envsys() prototype. 2007-05-08 20:04:42 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad 3a91cc8a3b Back out previous for now. There isn't currently an easy way to set up
shared state before these get attached or used.

From xtraeme@.
2007-02-19 06:08:37 +00:00
xtraeme 0bb6833f55 Replace SYSMON_ENVSYS_{LOCK,UNLOCK} with mutex_{enter,exit}. 2007-02-19 00:36:12 +00:00
xtraeme bf63a83084 * sysmon_wdog_mtx needs to run at IPL_SOFTCLOCK.
* replace SYSMON_WDOG_{LOCK,UNLOCK} macros with mutex_{enter,exit}

reminded by ad@.
2007-02-19 00:25:30 +00:00
xtraeme 406b5ff314 * Replace simple_locks and exclusive locks with adaptive mutexes.
* Replace ltsleep/wakeup pairs with condition variables
  (cv_init/cv_wait/cv_broadcast).

Reviewed by ad@.
2007-02-18 23:38:11 +00:00
xtraeme 840604a1a8 Replace simple_locks with mutexes, reviewed by ad@. 2007-02-18 23:34:55 +00:00
hubertf eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
smb 4612e5b3e5 Handle new gcc properly 2006-12-19 21:17:17 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos 05bd5641dd add missing initializers 2006-09-03 06:41:38 +00:00
christos 3c00d4c7e1 expose the ioctl internal function now used by the acpi_apm code. 2006-07-08 20:26:06 +00:00
freza a88dd66a11 Advance queue indices properly instead of silently rewriting
sysmon_power_event_queue[0] all the time.

OK by thorpej@
2006-06-08 04:23:34 +00:00
lukem 35f57c3fc9 Don't attempt to call (*sme->sme_gtredata)() or (*sme->sme_streinfo)()
if those members are NULL.
As discussed on tech-kern in October/November 2005.
2006-03-20 03:23:35 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
simonb 94e3e9f7f5 Spinkle some KNF. 2005-10-17 03:08:24 +00:00
christos 2c91ca8bd0 - add const
- avoid variable shadowing.
2005-05-29 22:18:25 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
drochner 3ad43282d2 apply an "& WDOG_MODE_MASK" so that user mode watchdogs started with "-A"
are terminated properly
2005-01-12 16:14:35 +00:00
smb ddd2ade252 Add a software watchdog timer facility. Because this slightly
changes the "tickle" model of wdogctl(8), it was modified as well;
while I was in there, I cleaned up the argument parsing.

The code was reviewed by simonb@.
2005-01-09 22:51:32 +00:00
cube c271a0dea6 According to acpi_acad.c and powerd(8), PRESSED event for AC adapter device
means it gets connected.  It feels odd to be told the AC adapter went
offline right after plugging it in.
2004-05-22 11:32:50 +00:00
kochi 1bc204dbcc Add AC adapter event type. 2004-05-03 07:43:37 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
christos 5d43dc85d6 Rename the thread command name so that it fits on top's display. 2003-09-06 23:28:30 +00:00
yamt 44d0d57217 do wakeup() only when someone is waiting for us. 2003-08-11 15:07:14 +00:00
yamt 104f2a80df introduce SME_FLAG_BUSY and set it during operations
instead of keeping sysmon_envsys_list_slock spinlock held
because some drivers might sleep in sysmon_envsys ops,

XXX sysmon_envsys_lock is now redundant
2003-08-11 14:24:41 +00:00
lukem 365cbd9428 add missing __KERNEL_RCSID() 2003-07-14 15:47:00 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
kochi 620bc11015 Fix a locking problem, which closes kern/21607.
ok'd by Jason Thorpe.
2003-05-19 23:24:55 +00:00
fvdl beed0b1c91 Fix format / number of argument mismatch for a printf. 2003-05-11 18:52:39 +00:00
thorpej 4bbda47b54 Add a "reset button" type. 2003-04-20 20:48:27 +00:00
thorpej d14efd22d1 Generic "task queue" for sysmon back-ends. This provides a thread
context for callbacks that require it in order to handle sysmon-related
events.

Adapted from the "OsdSchedule" bits of the ACPI code.
2003-04-20 20:20:35 +00:00
thorpej 5a20f4be3c * Add a generic power management event API, defined in <sys/power.h>.
Right now, only power switch state change events are supported.  This
  is a work-in-progress.
* Add support to sysmon for delivering power mangement events to userland.
  Add poll, kqueue, and read entry points to sysmon.
* Adapt ACPI to use the new generic <sys/power.h> event types.

This provides the kernel support for a forthcoming powerd(8) which can
do nice things like gracefully shut the system down when an ACPI power
button is pressed.
2003-04-18 01:31:34 +00:00
thorpej b0f79c65ce Start at a power management framework for sysmon. Right now we just
provide some VERY basic support for power/sleep buttons and lid switches;
if someone presses the power button, shut down the system semi-gracefully.

Eventually, we will send events for all types of button/lid events down
to a userland power management daemon, which will be able to define a
separate policy for each button/switch.
2003-04-17 01:02:21 +00:00
thorpej a5bb7e6494 Group things in this file a bit more logically. 2003-04-10 18:04:20 +00:00
thorpej 89ef67a28c Nothing cares about NSYSMON anymore; delete it. 2002-12-31 22:47:48 +00:00
explorer 59e0238f99 add envsys support to acpi A/C adapter and batteries. This is still a work
in progress, much like the rest of ACPI.
2002-12-31 05:26:56 +00:00
explorer 89f72704d1 remove redundant defines 2002-12-30 06:16:10 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
kristerw d509ae30db Correct possible return of uninitialized error variable. 2002-10-06 09:48:29 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
simonb 10f735a013 Fix WDOGIOC_GTICKLER for userland ticklers. 2002-07-31 06:48:58 +00:00
thorpej 20ddfbf4c1 Move sysmon configuration definitions to dev/sysmon/files.sysmon. 2002-04-16 21:00:27 +00:00
jdolecek 57b53bc9a8 The device close routine is called when _last_ descriptor to the
device file is closed, rather on every descriptor close. Instead of
getting the exclusive lock on open and releasing on close, get
the lock only when needed in sysmonioctl_envsys().
Fixes kern/14368 by Anthony Mallet. Okayed by Jason Thorpe.

While here, also inline sysmon_envsys_init() to sysmonopen_envsys(),
and g/c sysmonioctl_wdog() prototype.
2002-01-03 22:35:53 +00:00
lukem 640249d1e9 add RCSIDs 2001-11-13 06:28:55 +00:00
thorpej 4e7ff09e27 Make sure to clear sysmon_armed_wdog once the watchdog timer
is disarmed.
2001-01-30 22:24:31 +00:00