bb8e671373
(Part 2: drivers) * 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).
74 lines
2.3 KiB
C
74 lines
2.3 KiB
C
/* $NetBSD: ugvar.h,v 1.2 2007/07/01 08:29:48 xtraeme Exp $ */
|
|
|
|
/*
|
|
* Copyright (c) 2007 Mihai Chelaru <kefren@netbsd.ro>
|
|
* All rights reserved.
|
|
*
|
|
* 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. The name of the author may not be used to endorse or promote products
|
|
* derived from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
* IN NO EVENT SHALL THE AUTHOR 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 _UGVAR_H_
|
|
#define _UGVAR_H_
|
|
|
|
struct ug_softc {
|
|
struct device sc_dev;
|
|
|
|
bus_space_tag_t sc_iot;
|
|
bus_space_handle_t sc_ioh;
|
|
|
|
struct sysmon_envsys sc_sysmon;
|
|
envsys_data_t sc_data[UG_MAX_SENSORS];
|
|
uint8_t version;
|
|
void *mbsens;
|
|
};
|
|
|
|
struct ug2_sensor_info {
|
|
const char *name;
|
|
int port;
|
|
int type;
|
|
int multiplier;
|
|
int divisor;
|
|
int offset;
|
|
};
|
|
|
|
struct ug2_motherboard_info {
|
|
uint16_t id;
|
|
const char *name;
|
|
struct ug2_sensor_info sensors[UG2_MAX_NO_SENSORS + 1];
|
|
};
|
|
|
|
/* driver internal functions */
|
|
int ug_reset(struct ug_softc *);
|
|
uint8_t ug_read(struct ug_softc *, unsigned short);
|
|
int ug_waitfor(struct ug_softc *, uint16_t, uint8_t);
|
|
void ug_setup_sensors(struct ug_softc *);
|
|
void ug2_attach(struct ug_softc *);
|
|
int ug2_wait_ready(struct ug_softc *);
|
|
int ug2_wait_readable(struct ug_softc *);
|
|
int ug2_sync(struct ug_softc *);
|
|
int ug2_read(struct ug_softc *, uint8_t, uint8_t, uint8_t, uint8_t*);
|
|
|
|
/* Envsys */
|
|
int ug_gtredata(struct sysmon_envsys *, envsys_data_t *);
|
|
int ug2_gtredata(struct sysmon_envsys *, envsys_data_t *);
|
|
|
|
#endif /* _UGVAR_H_ */
|