Remove aiboost(4) as obsolete and redundant since the introduction of aibs(4).
http://mail-index.netbsd.org/tech-kern/2010/03/06/msg007458.html Reviewed by <pgoyette>, <cegger>, <jruoho>, <tech-kern>.
This commit is contained in:
parent
03645b1cba
commit
deaf16ef51
@ -1,11 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.511 2010/03/11 10:38:37 enami Exp $
|
||||
# $NetBSD: Makefile,v 1.512 2010/03/19 04:04:27 cnst Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 acpidalb.4 \
|
||||
adbbt.4 adbkbd.4 adbms.4 \
|
||||
adc.4 admtemp.4 adv.4 adw.4 age.4 agp.4 agr.4 ahb.4 ahc.4 \
|
||||
ahcisata.4 ahd.4 \
|
||||
aiboost.4 aibs.4 ale.4 alipm.4 altmem.4 amdpm.4 amdtemp.4 amhphy.4 \
|
||||
aibs.4 ale.4 alipm.4 altmem.4 amdpm.4 amdtemp.4 amhphy.4 \
|
||||
amr.4 aps.4 \
|
||||
an.4 arcmsr.4 aria.4 artsata.4 ata.4 atalk.4 ataraid.4 \
|
||||
ath.4 atphy.4 atppc.4 attimer.4 atw.4 \
|
||||
@ -144,6 +144,7 @@ MLINKS+=drm.4 tdfxdrm.4
|
||||
MLINKS+=drm.4 viadrm.4
|
||||
|
||||
MLINKS+=acpiec.4 acpiecdt.4
|
||||
MLINKS+=aibs.4 aiboost.4
|
||||
MLINKS+=ata.4 atabus.4
|
||||
MLINKS+=audio.4 audioctl.4
|
||||
MLINKS+=audio.4 mixer.4
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: acpi.4,v 1.42 2010/03/06 06:25:51 jruoho Exp $
|
||||
.\" $NetBSD: acpi.4,v 1.43 2010/03/19 04:04:27 cnst Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -41,7 +41,6 @@
|
||||
.Cd "acpilid* at acpi?"
|
||||
.Cd "acpismbus* at acpi?"
|
||||
.Cd "acpitz* at acpi?"
|
||||
.Cd "aiboost* at acpi?"
|
||||
.Cd "aibs* at acpi?"
|
||||
.Cd "asus* at acpi?"
|
||||
.Cd "attimer* at acpi?"
|
||||
@ -200,8 +199,6 @@ SMBus via Control Method Interface.
|
||||
.It acpitz
|
||||
.Tn ACPI
|
||||
thermal zones.
|
||||
.It aiboost
|
||||
ASUS AI Booster Hardware monitor.
|
||||
.It aibs
|
||||
ASUSTeK AI Booster ACPI ATK0110 voltage, temperature and fan sensor.
|
||||
.It asus
|
||||
@ -394,7 +391,6 @@ variable is always specified with the prefix
|
||||
.Xr acpilid 4 ,
|
||||
.Xr acpismbus 4 ,
|
||||
.Xr acpitz 4 ,
|
||||
.Xr aiboost 4 ,
|
||||
.Xr aibs 4 ,
|
||||
.Xr apm 4 ,
|
||||
.Xr attimer 4 ,
|
||||
|
@ -1,84 +0,0 @@
|
||||
.\" $NetBSD: aiboost.4,v 1.2 2007/03/14 07:10:51 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Juan Romero Pardines
|
||||
.\" 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. 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.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd March 14, 2007
|
||||
.Dt AIBOOST 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm aiboost
|
||||
.Nd ASUS AI Booster hardware monitor
|
||||
.Sh SYNOPSIS
|
||||
.Cd "aiboost* at acpi?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for monitoring the hardware sensors in recent
|
||||
.Tn ASUS
|
||||
motherboards.
|
||||
The driver uses ACPI as the backend to fetch sensor values and
|
||||
descriptions and provides its data via the
|
||||
.Xr envsys 4
|
||||
interface.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
driver typically has 7 sensors, depending on the motherboard and
|
||||
chipset:
|
||||
.Bl -column "Sensor" "Units" "Typical" -offset indent
|
||||
.It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
|
||||
.It Li "CPU" Ta "uK" Ta "CPU Temperature"
|
||||
.It Li "MB" Ta "uK" Ta "MB Temperature"
|
||||
.It Li "VCC" Ta "uV DC" Ta "Core Voltage"
|
||||
.It Li "+3.3V" Ta "uV DC" Ta "+3.3 Voltage"
|
||||
.It Li "+5V" Ta "uV DC" Ta "+5 Voltage"
|
||||
.It Li "+12V" Ta "uV DC" Ta "+12 Voltage"
|
||||
.It Li "CPU" Ta "RPM" Ta "CPU Fan"
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr envsys 4 ,
|
||||
.Xr envstat 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Fx
|
||||
and then it was ported to
|
||||
.Nx 5.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Takanori Watanabe
|
||||
and
|
||||
.An Juan Romero Pardines ,
|
||||
who adapted the code for
|
||||
.Nx .
|
||||
.Sh BUGS
|
||||
It's possible to modify voltages via the ACPI methods in the DSDT,
|
||||
but for now the driver only reports the sensors' values.
|
||||
CPU Q-Fan is another thing that is typically specified in the ACPI
|
||||
namespace, and in the future we should handle this feature (to
|
||||
enable or disable automatic/manual fan mode).
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: ALL,v 1.249 2010/03/06 21:12:04 plunky Exp $
|
||||
# $NetBSD: ALL,v 1.250 2010/03/19 04:04:27 cnst Exp $
|
||||
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
|
||||
#
|
||||
# ALL machine description file
|
||||
@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "ALL-$Revision: 1.249 $"
|
||||
#ident "ALL-$Revision: 1.250 $"
|
||||
|
||||
maxusers 64 # estimated number of users
|
||||
|
||||
@ -374,7 +374,6 @@ acpitz* at acpi? # ACPI Thermal Zone
|
||||
acpiwmi* at acpi? # ACPI WMI Mapper
|
||||
|
||||
# Mainboard devices
|
||||
aiboost* at acpi? # ASUS AI Booster Hardware Monitor
|
||||
aibs* at acpi? # ASUSTeK AI Booster hardware monitor
|
||||
asus* at acpi? # ASUS hotkeys
|
||||
attimer* at acpi? # AT Timer
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: DEVNAMES,v 1.258 2010/03/11 10:38:37 enami Exp $
|
||||
# $NetBSD: DEVNAMES,v 1.259 2010/03/19 04:04:27 cnst Exp $
|
||||
#
|
||||
# This file contains all used device names and defined attributes in
|
||||
# alphabetical order. New devices added to the system somewhere should first
|
||||
@ -61,7 +61,6 @@ ahd MI
|
||||
ahsc amiga
|
||||
ahsc amigappc
|
||||
ai MI
|
||||
aiboost MI
|
||||
aibs MI
|
||||
aic MI
|
||||
akbd mac68k
|
||||
|
@ -1,450 +0,0 @@
|
||||
/* $NetBSD: aiboost.c,v 1.30 2010/03/05 14:00:17 jruoho Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Juan Romero Pardines
|
||||
* Copyright (c) 2006 Takanori Watanabe
|
||||
* 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. 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.30 2010/03/05 14:00:17 jruoho Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/acpi/acpireg.h>
|
||||
#include <dev/acpi/acpivar.h>
|
||||
|
||||
#define _COMPONENT ACPI_RESOURCE_COMPONENT
|
||||
ACPI_MODULE_NAME ("aiboost")
|
||||
|
||||
#ifdef AIBOOST_DEBUG
|
||||
#define DPRINTF(x) do { printf x; } while (/* CONSTCOND */ 0)
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
struct aiboost_elem {
|
||||
ACPI_HANDLE h;
|
||||
UINT32 id;
|
||||
char desc[256];
|
||||
};
|
||||
|
||||
struct aiboost_comp {
|
||||
unsigned int num;
|
||||
struct aiboost_elem elem[1];
|
||||
};
|
||||
|
||||
struct aiboost_softc {
|
||||
struct acpi_devnode *sc_node; /* ACPI devnode */
|
||||
struct aiboost_comp *sc_aitemp, *sc_aivolt, *sc_aifan;
|
||||
struct sysmon_envsys *sc_sme;
|
||||
envsys_data_t *sc_sensor;
|
||||
kmutex_t sc_mtx;
|
||||
};
|
||||
|
||||
static ACPI_STATUS aiboost_getcomp(ACPI_HANDLE *,
|
||||
const char *,
|
||||
struct aiboost_comp **);
|
||||
static int aiboost_get_value(ACPI_HANDLE, const char *, UINT32);
|
||||
|
||||
/* sysmon_envsys(9) glue */
|
||||
static void aiboost_setup_sensors(struct aiboost_softc *);
|
||||
static void aiboost_refresh_sensors(struct sysmon_envsys *,
|
||||
envsys_data_t *);
|
||||
|
||||
/* autoconf(9) glue */
|
||||
static int aiboost_acpi_match(device_t, cfdata_t, void *);
|
||||
static void aiboost_acpi_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL_NEW(aiboost, sizeof(struct aiboost_softc), aiboost_acpi_match,
|
||||
aiboost_acpi_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Supported device IDs
|
||||
*/
|
||||
|
||||
static const char * const aiboost_acpi_ids[] = {
|
||||
"ATK0110",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
aiboost_acpi_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
|
||||
return 0;
|
||||
|
||||
return acpi_match_hid(aa->aa_node->ad_devinfo, aiboost_acpi_ids);
|
||||
}
|
||||
|
||||
static void
|
||||
aiboost_acpi_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct aiboost_softc *sc = device_private(self);
|
||||
struct acpi_attach_args *aa = aux;
|
||||
ACPI_HANDLE *handl;
|
||||
int i, maxsens, error = 0;
|
||||
size_t len;
|
||||
|
||||
sc->sc_node = aa->aa_node;
|
||||
handl = sc->sc_node->ad_handle;
|
||||
|
||||
aprint_naive("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
aprint_normal_dev(self, "ASUS AI Boost Hardware monitor\n");
|
||||
|
||||
if (ACPI_FAILURE(aiboost_getcomp(handl, "TSIF", &sc->sc_aitemp)))
|
||||
return;
|
||||
|
||||
if (ACPI_FAILURE(aiboost_getcomp(handl, "VSIF", &sc->sc_aivolt)))
|
||||
return;
|
||||
|
||||
if (ACPI_FAILURE(aiboost_getcomp(handl, "FSIF", &sc->sc_aifan)))
|
||||
return;
|
||||
|
||||
mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE);
|
||||
/* Initialize sensors */
|
||||
maxsens = sc->sc_aivolt->num + sc->sc_aitemp->num + sc->sc_aifan->num;
|
||||
DPRINTF(("%s: maxsens=%d\n", __func__, maxsens));
|
||||
|
||||
sc->sc_sme = sysmon_envsys_create();
|
||||
len = sizeof(envsys_data_t) * maxsens;
|
||||
sc->sc_sensor = kmem_zalloc(len, KM_NOSLEEP);
|
||||
if (!sc->sc_sensor)
|
||||
goto bad2;
|
||||
|
||||
/*
|
||||
* Set properties in sensors.
|
||||
*/
|
||||
aiboost_setup_sensors(sc);
|
||||
|
||||
/*
|
||||
* Add the sensors into the sysmon_envsys device.
|
||||
*/
|
||||
for (i = 0; i < maxsens; i++) {
|
||||
if (sysmon_envsys_sensor_attach(sc->sc_sme,
|
||||
&sc->sc_sensor[i]))
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the sysmon_envsys device.
|
||||
*/
|
||||
sc->sc_sme->sme_name = device_xname(self);
|
||||
sc->sc_sme->sme_cookie = sc;
|
||||
sc->sc_sme->sme_refresh = aiboost_refresh_sensors;
|
||||
|
||||
if ((error = sysmon_envsys_register(sc->sc_sme))) {
|
||||
aprint_error_dev(self, "unable to register with sysmon "
|
||||
"(error=%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!pmf_device_register(self, NULL, NULL))
|
||||
aprint_error_dev(self, "couldn't establish power handler\n");
|
||||
|
||||
return;
|
||||
|
||||
bad:
|
||||
kmem_free(sc->sc_sensor, len);
|
||||
bad2:
|
||||
sysmon_envsys_destroy(sc->sc_sme);
|
||||
mutex_destroy(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
#define COPYDESCR(x, y) \
|
||||
do { \
|
||||
strlcpy((x), (y), sizeof(x)); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
static void
|
||||
aiboost_setup_sensors(struct aiboost_softc *sc)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
/* Temperatures */
|
||||
for (i = 0; i < sc->sc_aitemp->num; i++) {
|
||||
sc->sc_sensor[i].units = ENVSYS_STEMP;
|
||||
COPYDESCR(sc->sc_sensor[i].desc, sc->sc_aitemp->elem[i].desc);
|
||||
DPRINTF(("%s: data[%d].desc=%s elem[%d].desc=%s\n", __func__,
|
||||
i, sc->sc_sensor[i].desc, i, sc->sc_aitemp->elem[i].desc));
|
||||
}
|
||||
|
||||
/* skip temperatures */
|
||||
j = sc->sc_aitemp->num;
|
||||
|
||||
/* Voltages */
|
||||
for (i = 0; i < sc->sc_aivolt->num; i++, j++) {
|
||||
sc->sc_sensor[j].units = ENVSYS_SVOLTS_DC;
|
||||
COPYDESCR(sc->sc_sensor[j].desc, sc->sc_aivolt->elem[i].desc);
|
||||
DPRINTF(("%s: data[%d].desc=%s elem[%d].desc=%s\n", __func__,
|
||||
j, sc->sc_sensor[j].desc, i, sc->sc_aivolt->elem[i].desc));
|
||||
}
|
||||
|
||||
/* skip voltages */
|
||||
j = sc->sc_aitemp->num + sc->sc_aivolt->num;
|
||||
|
||||
/* Fans */
|
||||
for (i = 0; i < sc->sc_aifan->num; i++, j++) {
|
||||
sc->sc_sensor[j].units = ENVSYS_SFANRPM;
|
||||
COPYDESCR(sc->sc_sensor[j].desc, sc->sc_aifan->elem[i].desc);
|
||||
DPRINTF(("%s: data[%d].desc=%s elem[%d].desc=%s\n", __func__,
|
||||
j, sc->sc_sensor[j].desc, i, sc->sc_aifan->elem[i].desc));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
aiboost_refresh_sensors(struct sysmon_envsys *sme, envsys_data_t *edata)
|
||||
{
|
||||
struct aiboost_softc *sc = sme->sme_cookie;
|
||||
ACPI_HANDLE *h = sc->sc_node->ad_handle;
|
||||
int i, j, val;
|
||||
|
||||
mutex_enter(&sc->sc_mtx);
|
||||
j = 0;
|
||||
i = edata->sensor; /* sensor number */
|
||||
|
||||
#define AIBOOST_INVALIDATE_SENSOR() \
|
||||
do { \
|
||||
if (val == -1 || val == 0) { \
|
||||
edata->state = ENVSYS_SINVALID; \
|
||||
goto out; \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
switch (edata->units) {
|
||||
case ENVSYS_STEMP:
|
||||
/* Temperatures */
|
||||
val = aiboost_get_value(h, "RTMP", sc->sc_aitemp->elem[i].id);
|
||||
AIBOOST_INVALIDATE_SENSOR();
|
||||
/* envsys(4) wants uK... convert from Celsius. */
|
||||
edata->value_cur = val * 100000 + 273150000;
|
||||
DPRINTF(("%s: temp[%d] value_cur=%d val=%d j=%d\n", __func__,
|
||||
i, edata->value_cur, val, j));
|
||||
break;
|
||||
case ENVSYS_SVOLTS_DC:
|
||||
/* Voltages */
|
||||
j = i - sc->sc_aitemp->num;
|
||||
val = aiboost_get_value(h, "RVLT", sc->sc_aivolt->elem[j].id);
|
||||
AIBOOST_INVALIDATE_SENSOR();
|
||||
/* envsys(4) wants mV... */
|
||||
edata->value_cur = val * 10000;
|
||||
edata->value_cur /= 10;
|
||||
DPRINTF(("%s: volt[%d] value_cur=%d val=%d j=%d\n", __func__,
|
||||
i, edata->value_cur, val, j));
|
||||
break;
|
||||
case ENVSYS_SFANRPM:
|
||||
/* Fans */
|
||||
j = i - (sc->sc_aitemp->num + sc->sc_aivolt->num);
|
||||
val = aiboost_get_value(h, "RFAN", sc->sc_aifan->elem[j].id);
|
||||
AIBOOST_INVALIDATE_SENSOR();
|
||||
edata->value_cur = val;
|
||||
DPRINTF(("%s: fan[%d] val=%d j=%d\n", __func__, i, val, j));
|
||||
break;
|
||||
}
|
||||
|
||||
edata->state = ENVSYS_SVALID;
|
||||
out:
|
||||
mutex_exit(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
static int
|
||||
aiboost_get_value(ACPI_HANDLE handle, const char *path, UINT32 number)
|
||||
{
|
||||
ACPI_OBJECT arg1, *ret;
|
||||
ACPI_OBJECT_LIST args;
|
||||
ACPI_BUFFER buf;
|
||||
int val;
|
||||
buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
buf.Pointer = 0;
|
||||
|
||||
arg1.Type = ACPI_TYPE_INTEGER;
|
||||
arg1.Integer.Value = number;
|
||||
args.Count = 1;
|
||||
args.Pointer = &arg1;
|
||||
|
||||
if (ACPI_FAILURE(AcpiEvaluateObject(handle, path, &args, &buf)))
|
||||
return -1;
|
||||
|
||||
ret = buf.Pointer;
|
||||
val = (ret->Type == ACPI_TYPE_INTEGER) ? ret->Integer.Value : -1;
|
||||
|
||||
ACPI_FREE(buf.Pointer);
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
static ACPI_STATUS
|
||||
aiboost_getcomp(ACPI_HANDLE *h, const char *name, struct aiboost_comp **comp)
|
||||
{
|
||||
ACPI_BUFFER buf, buf2;
|
||||
ACPI_OBJECT *o, *elem, *subobj, *myobj;
|
||||
ACPI_STATUS status;
|
||||
ACPI_HANDLE h1;
|
||||
struct aiboost_comp *c = NULL;
|
||||
int i, num;
|
||||
const char *str = NULL;
|
||||
size_t length, clen = 0;
|
||||
|
||||
status = AcpiGetHandle(h, name, &h1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DPRINTF(("%s: AcpiGetHandle: %s\n", __func__,
|
||||
AcpiFormatException(status) ));
|
||||
return status;
|
||||
}
|
||||
|
||||
status = acpi_eval_struct(h1, NULL, &buf);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DPRINTF(("%s: acpi_eval_struct: %s\n", __func__,
|
||||
AcpiFormatException(status) ));
|
||||
return status;
|
||||
}
|
||||
|
||||
o = buf.Pointer;
|
||||
if (o->Type != ACPI_TYPE_PACKAGE) {
|
||||
DPRINTF(("%s: o->Type != ACPI_TYPE_PACKAGE\n", __func__));
|
||||
goto error;
|
||||
}
|
||||
|
||||
elem = o->Package.Elements;
|
||||
if (elem->Type != ACPI_TYPE_INTEGER) {
|
||||
DPRINTF(("%s: elem->Type != ACPI_TYPE_INTEGER\n", __func__));
|
||||
goto error;
|
||||
}
|
||||
num = (int)elem[0].Integer.Value;
|
||||
if (num != o->Package.Count - 1) {
|
||||
DPRINTF(("%s: bad Package.Count/element[0].value\n", __func__));
|
||||
}
|
||||
|
||||
clen = sizeof(struct aiboost_comp) + sizeof(struct aiboost_elem) * num;
|
||||
c = kmem_zalloc(clen, KM_NOSLEEP);
|
||||
if (!c)
|
||||
goto error;
|
||||
|
||||
*comp = c;
|
||||
c->num = num;
|
||||
|
||||
DPRINTF(("%s, %d subitems\n", acpi_name(h1), num));
|
||||
#ifdef AIBOOST_DEBUG
|
||||
for (i = 0; i < num; i++) {
|
||||
elem = &o->Package.Elements[i+1];
|
||||
DPRINTF(("elem[%d]->Type = %x\n", i+1, elem->Type));
|
||||
if (elem->Type == ACPI_TYPE_PACKAGE &&
|
||||
elem->Package.Elements[0].Type == ACPI_TYPE_INTEGER) {
|
||||
DPRINTF((" subelem->Type = %x, %"PRIu64"\n",
|
||||
elem->Package.Elements[0].Type,
|
||||
elem->Package.Elements[0].Integer.Value));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++) {
|
||||
elem = &o->Package.Elements[i+1];
|
||||
if (elem->Type == ACPI_TYPE_PACKAGE) {
|
||||
/* information provided directly in package */
|
||||
subobj = elem;
|
||||
buf2.Pointer = NULL;
|
||||
} else if (elem->Type == ACPI_TYPE_LOCAL_REFERENCE) {
|
||||
/* information provided indirectly. request package */
|
||||
c->elem[i].h = elem->Reference.Handle;
|
||||
status = acpi_eval_struct(c->elem[i].h, NULL, &buf2);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DPRINTF(("%s: fetching object in buf2: %s\n",
|
||||
__func__, AcpiFormatException(status) ));
|
||||
goto error;
|
||||
}
|
||||
subobj = buf2.Pointer;
|
||||
if (subobj->Type != ACPI_TYPE_PACKAGE) {
|
||||
DPRINTF(("%s: fetched type cannot processed\n",
|
||||
__func__));
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
DPRINTF(("%s: elem->Type cannot be processed\n",
|
||||
__func__));
|
||||
goto error;
|
||||
}
|
||||
|
||||
myobj = &subobj->Package.Elements[0];
|
||||
|
||||
/* Get UID */
|
||||
if (myobj == NULL || myobj->Type != ACPI_TYPE_INTEGER) {
|
||||
DPRINTF(("%s: wrong type for element %d\n", __func__,
|
||||
i + 1));
|
||||
goto error;
|
||||
}
|
||||
|
||||
c->elem[i].id = myobj->Integer.Value;
|
||||
|
||||
/* Get string */
|
||||
myobj = &subobj->Package.Elements[1];
|
||||
if (myobj == NULL) {
|
||||
DPRINTF(("%s: myobj is NULL\n", __func__));
|
||||
goto error;
|
||||
}
|
||||
|
||||
switch (myobj->Type) {
|
||||
case ACPI_TYPE_STRING:
|
||||
str = myobj->String.Pointer;
|
||||
length = myobj->String.Length;
|
||||
break;
|
||||
case ACPI_TYPE_BUFFER:
|
||||
str = myobj->Buffer.Pointer;
|
||||
length = myobj->Buffer.Length;
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
DPRINTF(("%s: id=%d str=%s\n", __func__,
|
||||
c->elem[i].id, str));
|
||||
|
||||
(void)memcpy(c->elem[i].desc, str, length);
|
||||
|
||||
if (buf2.Pointer)
|
||||
ACPI_FREE(buf2.Pointer);
|
||||
}
|
||||
|
||||
if (buf.Pointer)
|
||||
ACPI_FREE(buf.Pointer);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (buf.Pointer)
|
||||
ACPI_FREE(buf.Pointer);
|
||||
if (buf2.Pointer)
|
||||
ACPI_FREE(buf2.Pointer);
|
||||
if (c)
|
||||
kmem_free(c, clen);
|
||||
|
||||
return AE_BAD_DATA;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.acpi,v 1.67 2010/02/09 03:19:51 cnst Exp $
|
||||
# $NetBSD: files.acpi,v 1.68 2010/03/19 04:04:28 cnst Exp $
|
||||
|
||||
include "dev/acpi/acpica/files.acpica"
|
||||
|
||||
@ -109,11 +109,6 @@ file dev/acpi/ym_acpi.c ym_acpi
|
||||
attach hpet at acpinodebus with hpet_acpi
|
||||
file dev/acpi/hpet_acpi.c hpet_acpi
|
||||
|
||||
# ASUS AI Booster Hardware monitor
|
||||
device aiboost: sysmon_envsys
|
||||
attach aiboost at acpinodebus
|
||||
file dev/acpi/aiboost.c aiboost
|
||||
|
||||
# ASUS hotkey device
|
||||
device asus: sysmon_envsys, sysmon_power
|
||||
attach asus at acpinodebus
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: envstat.8,v 1.55 2010/02/15 22:38:28 pgoyette Exp $
|
||||
.\" $NetBSD: envstat.8,v 1.56 2010/03/19 04:04:28 cnst Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000, 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -177,7 +177,6 @@ invalid states every second:
|
||||
.Xr acpibat 4 ,
|
||||
.Xr acpitz 4 ,
|
||||
.Xr admtemp 4 ,
|
||||
.Xr aiboost 4 ,
|
||||
.Xr aibs 4 ,
|
||||
.Xr amdtemp 4 ,
|
||||
.Xr aps 4 ,
|
||||
|
Loading…
Reference in New Issue
Block a user