2017-09-11 09:02:09 +03:00
|
|
|
/* $NetBSD: sysmonvar.h,v 1.50 2017/09/11 06:02:09 pgoyette Exp $ */
|
2000-06-24 04:37:19 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2000 Zembu Labs, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Jason R. Thorpe <thorpej@zembu.com>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Zembu Labs, Inc.
|
|
|
|
* 4. Neither the name of Zembu Labs nor the names of its employees may
|
|
|
|
* be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY ZEMBU LABS, INC. ``AS IS'' AND ANY EXPRESS
|
|
|
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR-
|
|
|
|
* RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
|
|
|
|
* CLAIMED. IN NO EVENT SHALL ZEMBU LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DEV_SYSMON_SYSMONVAR_H_
|
|
|
|
#define _DEV_SYSMON_SYSMONVAR_H_
|
|
|
|
|
2008-04-04 14:10:20 +04:00
|
|
|
#include <sys/param.h>
|
2000-06-24 04:37:19 +04:00
|
|
|
#include <sys/envsys.h>
|
2000-11-04 21:37:19 +03:00
|
|
|
#include <sys/wdog.h>
|
2003-04-18 05:31:34 +04:00
|
|
|
#include <sys/power.h>
|
2000-06-24 04:37:19 +04:00
|
|
|
#include <sys/queue.h>
|
2008-04-04 14:10:20 +04:00
|
|
|
#include <sys/callout.h>
|
2008-04-01 16:25:30 +04:00
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <sys/condvar.h>
|
2015-04-13 19:33:23 +03:00
|
|
|
#include <sys/rndsource.h>
|
2000-06-24 04:37:19 +04:00
|
|
|
|
2005-12-11 15:16:03 +03:00
|
|
|
struct lwp;
|
2003-04-10 22:04:20 +04:00
|
|
|
struct proc;
|
2003-04-18 05:31:34 +04:00
|
|
|
struct knote;
|
|
|
|
struct uio;
|
2008-04-01 16:25:30 +04:00
|
|
|
struct workqueue;
|
2003-04-10 22:04:20 +04:00
|
|
|
|
2000-11-05 07:06:13 +03:00
|
|
|
#define SYSMON_MINOR_ENVSYS 0
|
|
|
|
#define SYSMON_MINOR_WDOG 1
|
2003-04-18 05:31:34 +04:00
|
|
|
#define SYSMON_MINOR_POWER 2
|
2000-11-05 07:06:13 +03:00
|
|
|
|
2003-04-10 22:04:20 +04:00
|
|
|
/*****************************************************************************
|
|
|
|
* Environmental sensor support
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2010-02-28 23:04:04 +03:00
|
|
|
/*
|
|
|
|
* Thresholds/limits that are being monitored
|
|
|
|
*/
|
2012-12-11 19:39:06 +04:00
|
|
|
|
|
|
|
enum envsys_lims {
|
|
|
|
ENVSYS_LIM_CRITMAX,
|
|
|
|
ENVSYS_LIM_WARNMAX,
|
|
|
|
ENVSYS_LIM_WARNMIN,
|
|
|
|
ENVSYS_LIM_CRITMIN,
|
|
|
|
ENVSYS_LIM_LASTLIM
|
|
|
|
};
|
|
|
|
|
2010-02-28 23:04:04 +03:00
|
|
|
struct sysmon_envsys_lim {
|
2012-12-11 19:39:06 +04:00
|
|
|
int32_t critmax;
|
|
|
|
int32_t warnmax;
|
|
|
|
int32_t warnmin;
|
|
|
|
int32_t critmin;
|
2010-02-28 23:04:04 +03:00
|
|
|
};
|
|
|
|
|
2012-12-11 19:39:06 +04:00
|
|
|
typedef union {
|
|
|
|
int32_t sel_limit_list[ENVSYS_LIM_LASTLIM];
|
|
|
|
struct sysmon_envsys_lim sel_limits;
|
|
|
|
} sysmon_envsys_lim_t;
|
|
|
|
|
|
|
|
#define sel_critmax sel_limits.critmax
|
|
|
|
#define sel_warnmax sel_limits.warnmax
|
|
|
|
#define sel_warnmin sel_limits.warnmin
|
|
|
|
#define sel_critmin sel_limits.critmin
|
2010-02-28 23:04:04 +03:00
|
|
|
|
|
|
|
/* struct used by a sensor */
|
|
|
|
struct envsys_data {
|
|
|
|
TAILQ_ENTRY(envsys_data) sensors_head;
|
|
|
|
uint32_t sensor; /* sensor number */
|
|
|
|
uint32_t units; /* type of sensor */
|
|
|
|
uint32_t state; /* sensor state */
|
|
|
|
uint32_t flags; /* sensor flags */
|
|
|
|
uint32_t rpms; /* for fans, nominal RPMs */
|
|
|
|
int32_t rfact; /* for volts, factor x 10^4 */
|
|
|
|
int32_t value_cur; /* current value */
|
2012-07-16 17:55:01 +04:00
|
|
|
int32_t value_prev; /* previous value */
|
2010-02-28 23:04:04 +03:00
|
|
|
int32_t value_max; /* max value */
|
|
|
|
int32_t value_min; /* min value */
|
2011-06-04 17:24:33 +04:00
|
|
|
int32_t private; /* private data for drivers */
|
2010-02-28 23:04:04 +03:00
|
|
|
sysmon_envsys_lim_t limits; /* thresholds for monitoring */
|
2015-04-18 17:44:44 +03:00
|
|
|
uint32_t upropset; /* userland property set? */
|
2012-07-15 22:33:07 +04:00
|
|
|
krndsource_t rnd_src; /* source element for rnd(4) */
|
2010-02-28 23:04:04 +03:00
|
|
|
char desc[ENVSYS_DESCLEN]; /* sensor description */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct envsys_data envsys_data_t;
|
|
|
|
|
|
|
|
/* sensor flags */
|
|
|
|
#define ENVSYS_FPERCENT 0x00000001 /* sensor wants a percentage */
|
|
|
|
#define ENVSYS_FVALID_MAX 0x00000002 /* max value is ok */
|
|
|
|
#define ENVSYS_FVALID_MIN 0x00000004 /* min value is ok */
|
2011-06-04 17:24:33 +04:00
|
|
|
#define ENVSYS_F_OBSOLETE 0x00000008
|
2010-02-28 23:04:04 +03:00
|
|
|
#define ENVSYS_FCHANGERFACT 0x00000010 /* sensor can change rfact */
|
|
|
|
|
|
|
|
/* monitoring flags */
|
|
|
|
#define ENVSYS_FMONCRITICAL 0x00000020 /* monitor a critical state */
|
|
|
|
#define ENVSYS_FMONLIMITS 0x00000040 /* monitor limits/thresholds */
|
|
|
|
#define ENVSYS_FMONSTCHANGED 0x00000400 /* monitor a battery/drive state */
|
2010-03-14 21:03:15 +03:00
|
|
|
#define ENVSYS_FMONANY \
|
|
|
|
(ENVSYS_FMONCRITICAL | ENVSYS_FMONLIMITS | ENVSYS_FMONSTCHANGED)
|
2010-02-28 23:04:04 +03:00
|
|
|
#define ENVSYS_FMONNOTSUPP 0x00000800 /* monitoring not supported */
|
|
|
|
#define ENVSYS_FNEED_REFRESH 0x00001000 /* sensor needs refreshing */
|
2012-07-15 22:33:07 +04:00
|
|
|
#define ENVSYS_FHAS_ENTROPY 0x00002000 /* sensor provides entropy
|
|
|
|
for rnd(4) */
|
2010-02-28 23:04:04 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Properties that can be set in upropset (and in the event_limit's
|
|
|
|
* flags field)
|
|
|
|
*/
|
|
|
|
#define PROP_CRITMAX 0x0001
|
|
|
|
#define PROP_CRITMIN 0x0002
|
|
|
|
#define PROP_WARNMAX 0x0004
|
|
|
|
#define PROP_WARNMIN 0x0008
|
|
|
|
#define PROP_BATTCAP 0x0010
|
|
|
|
#define PROP_BATTWARN 0x0020
|
|
|
|
#define PROP_BATTHIGH 0x0040
|
|
|
|
#define PROP_BATTMAX 0x0080
|
|
|
|
#define PROP_DESC 0x0100
|
|
|
|
#define PROP_RFACT 0x0200
|
|
|
|
|
|
|
|
#define PROP_DRIVER_LIMITS 0x8000
|
|
|
|
#define PROP_CAP_LIMITS (PROP_BATTCAP | PROP_BATTWARN | \
|
|
|
|
PROP_BATTHIGH | PROP_BATTMAX)
|
|
|
|
#define PROP_VAL_LIMITS (PROP_CRITMAX | PROP_CRITMIN | \
|
|
|
|
PROP_WARNMAX | PROP_WARNMIN)
|
|
|
|
#define PROP_LIMITS (PROP_CAP_LIMITS | PROP_VAL_LIMITS)
|
2007-11-16 11:00:11 +03:00
|
|
|
struct sme_event;
|
2007-08-31 03:46:29 +04:00
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
struct sysmon_envsys {
|
2007-11-16 11:00:11 +03:00
|
|
|
const char *sme_name; /* envsys device name */
|
|
|
|
u_int sme_nsensors; /* sensors count, from driver */
|
|
|
|
u_int sme_fsensor; /* sensor index base, from sysmon */
|
|
|
|
#define SME_SENSOR_IDX(sme, idx) ((idx) - (sme)->sme_fsensor)
|
|
|
|
int sme_class; /* class of device */
|
2007-10-11 03:25:39 +04:00
|
|
|
#define SME_CLASS_BATTERY 1 /* device is a battery */
|
|
|
|
#define SME_CLASS_ACADAPTER 2 /* device is an AC adapter */
|
2007-11-16 11:00:11 +03:00
|
|
|
int sme_flags; /* additional flags */
|
|
|
|
#define SME_FLAG_BUSY 0x00000001 /* device busy */
|
|
|
|
#define SME_DISABLE_REFRESH 0x00000002 /* disable sme_refresh */
|
2008-03-23 19:09:41 +03:00
|
|
|
#define SME_INIT_REFRESH 0x00000008 /* call sme_refresh() after
|
|
|
|
interrupts are enabled in
|
|
|
|
the autoconf(9) process. */
|
2008-06-03 19:00:57 +04:00
|
|
|
#define SME_POLL_ONLY 0x00000010 /* only poll sme_refresh */
|
2007-10-11 03:25:39 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
void *sme_cookie; /* for ENVSYS back-end */
|
2000-06-24 04:37:19 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
/*
|
|
|
|
* Function callback to receive data from device.
|
|
|
|
*/
|
|
|
|
void (*sme_refresh)(struct sysmon_envsys *, envsys_data_t *);
|
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 11:36:39 +04:00
|
|
|
|
2009-06-13 20:08:25 +04:00
|
|
|
/*
|
|
|
|
* Function callbacks to exchange limit/threshold values
|
|
|
|
* with device
|
|
|
|
*/
|
2009-06-14 23:43:12 +04:00
|
|
|
void (*sme_set_limits)(struct sysmon_envsys *, envsys_data_t *,
|
2010-02-15 02:06:01 +03:00
|
|
|
sysmon_envsys_lim_t *, uint32_t *);
|
2009-06-14 23:43:12 +04:00
|
|
|
void (*sme_get_limits)(struct sysmon_envsys *, envsys_data_t *,
|
2010-02-15 02:06:01 +03:00
|
|
|
sysmon_envsys_lim_t *, uint32_t *);
|
2009-06-13 20:08:25 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
struct workqueue *sme_wq; /* the workqueue for the events */
|
|
|
|
struct callout sme_callout; /* for the events */
|
2017-09-11 09:02:09 +03:00
|
|
|
int sme_callout_state; /* state of the event's callout */
|
|
|
|
|
|
|
|
#define SME_CALLOUT_INVALID 0x0 /* callout is not initialized */
|
|
|
|
#define SME_CALLOUT_READY 0x1 /* callout is ready for use */
|
|
|
|
#define SME_CALLOUT_HALTED 0x2 /* callout can be destroyed */
|
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
uint64_t sme_events_timeout; /* the timeout used in the callout */
|
2007-10-11 03:25:39 +04:00
|
|
|
|
2007-08-31 03:46:29 +04:00
|
|
|
/*
|
2007-11-16 11:00:11 +03:00
|
|
|
* linked list for the sysmon envsys devices.
|
2007-08-31 03:46:29 +04:00
|
|
|
*/
|
2007-11-16 11:00:11 +03:00
|
|
|
LIST_ENTRY(sysmon_envsys) sme_list;
|
2000-06-24 04:37:19 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
/*
|
|
|
|
* linked list for the events that a device maintains.
|
|
|
|
*/
|
|
|
|
LIST_HEAD(, sme_event) sme_events_list;
|
2000-06-24 04:37:19 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
/*
|
|
|
|
* tailq for the sensors that a device maintains.
|
|
|
|
*/
|
|
|
|
TAILQ_HEAD(, envsys_data) sme_sensors_list;
|
2008-04-01 16:25:30 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Locking/synchronization.
|
|
|
|
*/
|
2015-03-14 12:52:49 +03:00
|
|
|
int sme_busy; /* number of items on workqueue,
|
|
|
|
sme_mtx or sme_work_mtx to read,
|
|
|
|
both to write */
|
2008-04-01 16:25:30 +04:00
|
|
|
kmutex_t sme_mtx;
|
2015-03-14 12:52:49 +03:00
|
|
|
kmutex_t sme_work_mtx;
|
2008-04-01 16:25:30 +04:00
|
|
|
kcondvar_t sme_condvar;
|
2000-06-24 04:37:19 +04:00
|
|
|
};
|
|
|
|
|
2005-12-11 15:16:03 +03:00
|
|
|
int sysmonopen_envsys(dev_t, int, int, struct lwp *);
|
|
|
|
int sysmonclose_envsys(dev_t, int, int, struct lwp *);
|
2007-03-04 08:59:00 +03:00
|
|
|
int sysmonioctl_envsys(dev_t, u_long, void *, int, struct lwp *);
|
2003-04-10 22:04:20 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
struct sysmon_envsys *sysmon_envsys_create(void);
|
|
|
|
void sysmon_envsys_destroy(struct sysmon_envsys *);
|
|
|
|
|
2003-04-10 22:04:20 +04:00
|
|
|
int sysmon_envsys_register(struct sysmon_envsys *);
|
|
|
|
void sysmon_envsys_unregister(struct sysmon_envsys *);
|
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 11:36:39 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
int sysmon_envsys_sensor_attach(struct sysmon_envsys *, envsys_data_t *);
|
|
|
|
int sysmon_envsys_sensor_detach(struct sysmon_envsys *, envsys_data_t *);
|
|
|
|
|
2010-02-01 00:36:38 +03:00
|
|
|
uint32_t sysmon_envsys_get_max_value(bool (*)(const envsys_data_t*), bool);
|
|
|
|
|
2010-03-19 05:19:13 +03:00
|
|
|
void sysmon_envsys_sensor_event(struct sysmon_envsys *, envsys_data_t *,
|
|
|
|
int);
|
|
|
|
|
2012-07-15 22:33:07 +04:00
|
|
|
void sysmon_envsys_refresh_sensor(struct sysmon_envsys *, envsys_data_t *);
|
|
|
|
|
2010-04-11 05:12:28 +04:00
|
|
|
typedef bool (*sysmon_envsys_callback_t)(const struct sysmon_envsys *,
|
|
|
|
const envsys_data_t *, void*);
|
|
|
|
|
|
|
|
void sysmon_envsys_foreach_sensor(sysmon_envsys_callback_t, void *, bool);
|
2010-03-26 23:31:06 +03:00
|
|
|
|
2010-04-01 16:16:14 +04:00
|
|
|
int sysmon_envsys_update_limits(struct sysmon_envsys *, envsys_data_t *);
|
|
|
|
|
2015-04-24 02:22:03 +03:00
|
|
|
int sysmon_envsys_init(void);
|
|
|
|
int sysmon_envsys_fini(void);
|
2003-04-10 22:04:20 +04:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Watchdog timer support
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2000-11-04 21:37:19 +03:00
|
|
|
struct sysmon_wdog {
|
|
|
|
const char *smw_name; /* watchdog device name */
|
|
|
|
|
|
|
|
LIST_ENTRY(sysmon_wdog) smw_list;
|
|
|
|
|
|
|
|
void *smw_cookie; /* for watchdog back-end */
|
|
|
|
int (*smw_setmode)(struct sysmon_wdog *);
|
|
|
|
int (*smw_tickle)(struct sysmon_wdog *);
|
|
|
|
u_int smw_period; /* timer period (in seconds) */
|
|
|
|
int smw_mode; /* timer mode */
|
|
|
|
u_int smw_refcnt; /* references */
|
|
|
|
pid_t smw_tickler; /* last process to tickle */
|
|
|
|
};
|
|
|
|
|
2005-12-11 15:16:03 +03:00
|
|
|
int sysmonopen_wdog(dev_t, int, int, struct lwp *);
|
|
|
|
int sysmonclose_wdog(dev_t, int, int, struct lwp *);
|
2007-03-04 08:59:00 +03:00
|
|
|
int sysmonioctl_wdog(dev_t, u_long, void *, int, struct lwp *);
|
2000-11-05 07:06:13 +03:00
|
|
|
|
2011-01-04 04:51:06 +03:00
|
|
|
int sysmon_wdog_setmode(struct sysmon_wdog *, int, u_int);
|
2005-12-11 15:16:03 +03:00
|
|
|
int sysmon_wdog_register(struct sysmon_wdog *);
|
2007-12-17 00:07:45 +03:00
|
|
|
int sysmon_wdog_unregister(struct sysmon_wdog *);
|
2000-11-04 21:37:19 +03:00
|
|
|
|
2015-04-24 02:22:03 +03:00
|
|
|
int sysmon_wdog_init(void);
|
|
|
|
int sysmon_wdog_fini(void);
|
2007-09-02 04:41:24 +04:00
|
|
|
|
2003-04-17 05:02:21 +04:00
|
|
|
/*****************************************************************************
|
|
|
|
* Power management support
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
struct sysmon_pswitch {
|
|
|
|
const char *smpsw_name; /* power switch name */
|
|
|
|
int smpsw_type; /* power switch type */
|
|
|
|
|
|
|
|
LIST_ENTRY(sysmon_pswitch) smpsw_list;
|
|
|
|
};
|
|
|
|
|
2005-12-11 15:16:03 +03:00
|
|
|
int sysmonopen_power(dev_t, int, int, struct lwp *);
|
|
|
|
int sysmonclose_power(dev_t, int, int, struct lwp *);
|
2003-04-18 05:31:34 +04:00
|
|
|
int sysmonread_power(dev_t, struct uio *, int);
|
2005-12-11 15:16:03 +03:00
|
|
|
int sysmonpoll_power(dev_t, int, struct lwp *);
|
2003-04-18 05:31:34 +04:00
|
|
|
int sysmonkqfilter_power(dev_t, struct knote *);
|
2007-03-04 08:59:00 +03:00
|
|
|
int sysmonioctl_power(dev_t, u_long, void *, int, struct lwp *);
|
2003-04-17 05:02:21 +04:00
|
|
|
|
2003-04-18 05:31:34 +04:00
|
|
|
void sysmon_power_settype(const char *);
|
2003-04-17 05:02:21 +04:00
|
|
|
|
|
|
|
int sysmon_pswitch_register(struct sysmon_pswitch *);
|
|
|
|
void sysmon_pswitch_unregister(struct sysmon_pswitch *);
|
|
|
|
|
|
|
|
void sysmon_pswitch_event(struct sysmon_pswitch *, int);
|
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 11:36:39 +04:00
|
|
|
void sysmon_penvsys_event(struct penvsys_state *, int);
|
|
|
|
|
2015-04-24 02:22:03 +03:00
|
|
|
int sysmon_power_init(void);
|
|
|
|
int sysmon_power_fini(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interface to sysmon common code used for autoloading
|
|
|
|
*/
|
|
|
|
struct sysmon_opvec {
|
|
|
|
int (*so_open)(dev_t, int, int, struct lwp*);
|
|
|
|
int (*so_close)(dev_t, int, int, struct lwp*);
|
|
|
|
int (*so_ioctl)(dev_t, u_long, void *, int, struct lwp*);
|
|
|
|
int (*so_read)(dev_t, struct uio*, int);
|
|
|
|
int (*so_poll)(dev_t, int, struct lwp*);
|
|
|
|
int (*so_filter)(dev_t, struct knote*);
|
|
|
|
};
|
|
|
|
|
|
|
|
int sysmon_init(void);
|
|
|
|
int sysmon_fini(void);
|
|
|
|
int sysmon_attach_minor(int, struct sysmon_opvec*);
|
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 11:36:39 +04:00
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
#endif /* _DEV_SYSMON_SYSMONVAR_H_ */
|