NetBSD Problem Report #36852
From khorben@defora.org Mon Aug 27 22:36:53 2007
Return-Path: <khorben@defora.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 482B163B8D8
for <gnats-bugs@gnats.NetBSD.org>; Mon, 27 Aug 2007 22:36:53 +0000 (UTC)
Message-Id: <20070827223700.1A24BFC61@syn.defora.rom>
Date: Tue, 28 Aug 2007 00:37:00 +0200 (CEST)
From: Pierre Pronchery <khorben@defora.org>
Reply-To:
To: gnats-bugs@NetBSD.org
Subject: Port of the aps driver from OpenBSD
X-Send-Pr-Version: 3.95
>Number: 36852
>Category: port-i386
>Synopsis: Port of the aps driver from OpenBSD
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: xtraeme
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 27 22:40:02 +0000 2007
>Closed-Date: Tue Sep 11 21:50:08 +0000 2007
>Last-Modified: Tue Sep 11 22:00:08 +0000 2007
>Originator: Pierre Pronchery
>Release: NetBSD 4.99.26
>Organization:
>Environment:
Architecture: x86_64
Machine: amd64
>Description:
Please find a port of the aps driver from OpenBSD here. It supports the accel-o-meter device found on ThinkPads laptops for a while now.
This was tested only on amd64, within the jmcneill-pm branch. Modifications to make it compile with -current should be trivial if necessary.
I could only test the results with envstat so far, and observe that at least the keyboard activity detection was functional. wmhdaps may be an interesting application to port to test the results, but please tell if you know of any other.
Hope this helps.
>How-To-Repeat:
n/a
>Fix:
Add this to sys/dev/isa/files.isa:
device aps
attach aps at isa with aps_isa
file dev/isa/aps.c aps
Add this to your kernel configuration:
aps* at isa? port 0x1600
And this is sys/dev/isa/aps.c:
/* $NetBSD$ */
/* $OpenBSD: aps.c,v 1.15 2007/05/19 19:14:11 tedu Exp $ */
/*
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* A driver for the ThinkPad Active Protection System based on notes from
* http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/envsys.h>
#include <sys/callout.h>
#include <machine/bus.h>
#include <dev/sysmon/sysmonvar.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#if defined(APSDEBUG)
#define DPRINTF(x) do { printf x; } while (0)
#else
#define DPRINTF(x)
#endif
#define APS_ACCEL_STATE 0x04
#define APS_INIT 0x10
#define APS_STATE 0x11
#define APS_XACCEL 0x12
#define APS_YACCEL 0x14
#define APS_TEMP 0x16
#define APS_XVAR 0x17
#define APS_YVAR 0x19
#define APS_TEMP2 0x1b
#define APS_UNKNOWN 0x1c
#define APS_INPUT 0x1d
#define APS_CMD 0x1f
#define APS_STATE_NEWDATA 0x50
#define APS_CMD_START 0x01
#define APS_INPUT_KB (1 << 5)
#define APS_INPUT_MS (1 << 6)
#define APS_INPUT_LIDOPEN (1 << 7)
#define APS_ADDR_SIZE 0x1f
struct sensor_rec {
u_int8_t state;
u_int16_t x_accel;
u_int16_t y_accel;
u_int8_t temp1;
u_int16_t x_var;
u_int16_t y_var;
u_int8_t temp2;
u_int8_t unk;
u_int8_t input;
};
#define APS_NUM_SENSORS 9
#define APS_SENSOR_XACCEL 0
#define APS_SENSOR_YACCEL 1
#define APS_SENSOR_XVAR 2
#define APS_SENSOR_YVAR 3
#define APS_SENSOR_TEMP1 4
#define APS_SENSOR_TEMP2 5
#define APS_SENSOR_KBACT 6
#define APS_SENSOR_MSACT 7
#define APS_SENSOR_LIDOPEN 8
struct aps_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[APS_NUM_SENSORS];
struct callout sc_callout;
void (*refresh_sensor_data)(struct aps_softc *);
struct sensor_rec aps_data;
void * sc_powerhook;
};
int aps_match(struct device *, struct cfdata *, void *);
void aps_attach(struct device *, struct device *, void *);
int aps_init(bus_space_tag_t, bus_space_handle_t);
u_int8_t aps_mem_read_1(bus_space_tag_t, bus_space_handle_t, int, u_int8_t);
int aps_read_data(struct sysmon_envsys *, struct envsys_data *edata);
void aps_refresh_sensor_data(struct aps_softc *sc);
void aps_refresh(void *);
void aps_power(int, void *);
CFATTACH_DECL(aps_isa, sizeof(struct aps_softc),
aps_match, aps_attach, NULL, NULL);
int
aps_match(struct device *parent, struct cfdata *match, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_tag_t iot;
bus_space_handle_t ioh;
int iobase, i;
u_int8_t cr;
/* Must supply an address */
if (ia->ia_nio < 1)
return 0;
if (ISA_DIRECT_CONFIG(ia))
return 0;
if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
return 0;
iot = ia->ia_iot;
iobase = ia->ia_io[0].ir_addr;
if (bus_space_map(iot, iobase, APS_ADDR_SIZE, 0, &ioh)) {
printf("aps: can't map i/o space\n");
return 0;
}
/* See if this machine has APS */
bus_space_write_1(iot, ioh, APS_INIT, 0x13);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
/* ask again as the X40 is slightly deaf in one ear */
bus_space_read_1(iot, ioh, APS_CMD);
bus_space_write_1(iot, ioh, APS_INIT, 0x13);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_CMD, 0x00)) {
bus_space_unmap(iot, ioh, APS_ADDR_SIZE);
return 0;
}
/*
* Observed values from Linux driver:
* 0x01: T42
* 0x02: chip already initialised
* 0x03: T41
*/
for (i = 0; i < 10; i++) {
cr = bus_space_read_1(iot, ioh, APS_STATE);
if (cr > 0 && cr < 6)
break;
delay(5 * 1000);
}
bus_space_unmap(iot, ioh, APS_ADDR_SIZE);
printf("aps: state register 0x%x\n", cr);
if (cr < 1 || cr > 5) {
printf("aps0: unsupported state %d\n", cr);
return 0;
}
ia->ia_nio = 1;
ia->ia_io[0].ir_size = APS_ADDR_SIZE;
ia->ia_niomem = 0;
ia->ia_nirq = 0;
ia->ia_ndrq = 0;
return 1;
}
void
aps_attach(struct device *parent, struct device *self, void *aux)
{
struct aps_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
int iobase, i;
bus_space_tag_t iot;
bus_space_handle_t ioh;
iot = sc->sc_iot = ia->ia_iot;
iobase = ia->ia_io[0].ir_addr;
if (bus_space_map(iot, iobase, APS_ADDR_SIZE, 0, &sc->sc_ioh)) {
printf(": can't map i/o space\n");
return;
}
ioh = sc->sc_ioh;
printf("\n");
if (!aps_init(iot, ioh))
goto out;
/* Initialize sensors */
for (i = 0; i < APS_NUM_SENSORS; ++i) {
sc->sc_data[i].sensor = i;
sc->sc_data[i].state = ENVSYS_SVALID;
}
sc->sc_data[APS_SENSOR_XACCEL].units = ENVSYS_INTEGER;
snprintf(sc->sc_data[APS_SENSOR_XACCEL].desc,
sizeof(sc->sc_data[APS_SENSOR_XACCEL].desc), "%s %s",
sc->sc_dev.dv_xname, "X_ACCEL");
sc->sc_data[APS_SENSOR_YACCEL].units = ENVSYS_INTEGER;
snprintf(sc->sc_data[APS_SENSOR_YACCEL].desc,
sizeof(sc->sc_data[APS_SENSOR_YACCEL].desc), "%s %s",
sc->sc_dev.dv_xname, "Y_ACCEL");
sc->sc_data[APS_SENSOR_TEMP1].units = ENVSYS_STEMP;
snprintf(sc->sc_data[APS_SENSOR_TEMP1].desc,
sizeof(sc->sc_data[APS_SENSOR_TEMP1].desc), "%s %s",
sc->sc_dev.dv_xname, "TEMP_1");
sc->sc_data[APS_SENSOR_TEMP2].units = ENVSYS_STEMP;
snprintf(sc->sc_data[APS_SENSOR_TEMP2].desc,
sizeof(sc->sc_data[APS_SENSOR_TEMP2].desc), "%s %s",
sc->sc_dev.dv_xname, "TEMP_2");
sc->sc_data[APS_SENSOR_XVAR].units = ENVSYS_INTEGER;
snprintf(sc->sc_data[APS_SENSOR_XVAR].desc,
sizeof(sc->sc_data[APS_SENSOR_XVAR].desc), "%s %s",
sc->sc_dev.dv_xname, "X_VAR");
sc->sc_data[APS_SENSOR_YVAR].units = ENVSYS_INTEGER;
snprintf(sc->sc_data[APS_SENSOR_YVAR].desc,
sizeof(sc->sc_data[APS_SENSOR_YVAR].desc), "%s %s",
sc->sc_dev.dv_xname, "Y_VAR");
sc->sc_data[APS_SENSOR_KBACT].units = ENVSYS_INDICATOR;
snprintf(sc->sc_data[APS_SENSOR_KBACT].desc,
sizeof(sc->sc_data[APS_SENSOR_KBACT].desc), "Keyboard Active");
sc->sc_data[APS_SENSOR_MSACT].units = ENVSYS_INDICATOR;
snprintf(sc->sc_data[APS_SENSOR_MSACT].desc,
sizeof(sc->sc_data[APS_SENSOR_MSACT].desc), "Mouse Active");
sc->sc_data[APS_SENSOR_LIDOPEN].units = ENVSYS_INDICATOR;
snprintf(sc->sc_data[APS_SENSOR_LIDOPEN].desc,
sizeof(sc->sc_data[APS_SENSOR_LIDOPEN].desc), "Lid Open");
/* stop hiding and report to the authorities */
sc->sc_sysmon.sme_name = sc->sc_dev.dv_xname;
sc->sc_sysmon.sme_sensor_data = sc->sc_data;
sc->sc_sysmon.sme_cookie = sc;
sc->sc_sysmon.sme_gtredata = aps_read_data;
sc->sc_sysmon.sme_nsensors = APS_NUM_SENSORS;
if ((i = sysmon_envsys_register(&sc->sc_sysmon)))
printf("%s: unable to register with sysmon (%d)\n",
sc->sc_dev.dv_xname, i);
sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, aps_power,
sc);
if(sc->sc_powerhook == NULL)
printf("%s: can't establish powerhook\n",
sc->sc_dev.dv_xname);
/* Refresh sensor data every 0.5 seconds */
callout_init(&sc->sc_callout, 0);
callout_setfunc(&sc->sc_callout, aps_refresh, sc);
callout_schedule(&sc->sc_callout, (hz) / 2);
return;
out:
printf("%s: failed to initialise\n", sc->sc_dev.dv_xname);
return;
}
int
aps_init(bus_space_tag_t iot, bus_space_handle_t ioh)
{
bus_space_write_1(iot, ioh, APS_INIT, 0x17);
bus_space_write_1(iot, ioh, APS_STATE, 0x81);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_CMD, 0x00))
return (0);
if (!aps_mem_read_1(iot, ioh, APS_STATE, 0x00))
return (0);
if (!aps_mem_read_1(iot, ioh, APS_XACCEL, 0x60))
return (0);
if (!aps_mem_read_1(iot, ioh, APS_XACCEL + 1, 0x00))
return (0);
bus_space_write_1(iot, ioh, APS_INIT, 0x14);
bus_space_write_1(iot, ioh, APS_STATE, 0x01);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_CMD, 0x00))
return (0);
bus_space_write_1(iot, ioh, APS_INIT, 0x10);
bus_space_write_1(iot, ioh, APS_STATE, 0xc8);
bus_space_write_1(iot, ioh, APS_XACCEL, 0x00);
bus_space_write_1(iot, ioh, APS_XACCEL + 1, 0x02);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_CMD, 0x00))
return (0);
/* refresh data */
bus_space_write_1(iot, ioh, APS_INIT, 0x11);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_ACCEL_STATE, 0x50))
return (0);
if (!aps_mem_read_1(iot, ioh, APS_STATE, 0x00))
return (0);
return (1);
}
u_int8_t
aps_mem_read_1(bus_space_tag_t iot, bus_space_handle_t ioh, int reg,
u_int8_t val)
{
int i;
u_int8_t cr;
/* should take no longer than 50 microseconds */
for (i = 0; i < 10; i++) {
cr = bus_space_read_1(iot, ioh, reg);
if (cr == val)
return (1);
delay(5 * 1000);
}
printf("aps: reg 0x%x not val 0x%x!\n", reg, val);
return (0);
}
int
aps_read_data(struct sysmon_envsys *sme, struct envsys_data *edata)
{
struct aps_softc *sc = sme->sme_cookie;
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
sc->aps_data.state = bus_space_read_1(iot, ioh, APS_STATE);
sc->aps_data.x_accel = bus_space_read_2(iot, ioh, APS_XACCEL);
sc->aps_data.y_accel = bus_space_read_2(iot, ioh, APS_YACCEL);
sc->aps_data.temp1 = bus_space_read_1(iot, ioh, APS_TEMP);
sc->aps_data.x_var = bus_space_read_2(iot, ioh, APS_XVAR);
sc->aps_data.y_var = bus_space_read_2(iot, ioh, APS_YVAR);
sc->aps_data.temp2 = bus_space_read_1(iot, ioh, APS_TEMP2);
sc->aps_data.input = bus_space_read_1(iot, ioh, APS_INPUT);
return (0);
}
void
aps_refresh_sensor_data(struct aps_softc *sc)
{
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
int64_t temp;
int i;
/* ask for new data */
bus_space_write_1(iot, ioh, APS_INIT, 0x11);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (!aps_mem_read_1(iot, ioh, APS_ACCEL_STATE, 0x50))
return;
aps_read_data(&sc->sc_sysmon, NULL);
bus_space_write_1(iot, ioh, APS_INIT, 0x11);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
/* tell accelerometer we're done reading from it */
bus_space_read_1(iot, ioh, APS_CMD);
bus_space_read_1(iot, ioh, APS_ACCEL_STATE);
for (i = 0; i < APS_NUM_SENSORS; i++) {
sc->sc_data[i].flags &= ~ENVSYS_FNOTVALID;
}
sc->sc_data[APS_SENSOR_XACCEL].value_cur = sc->aps_data.x_accel;
sc->sc_data[APS_SENSOR_YACCEL].value_cur = sc->aps_data.y_accel;
/* convert to micro (mu) degrees */
temp = sc->aps_data.temp1 * 1000000;
/* convert to kelvin */
temp += 273150000;
sc->sc_data[APS_SENSOR_TEMP1].value_cur = temp;
/* convert to micro (mu) degrees */
temp = sc->aps_data.temp2 * 1000000;
/* convert to kelvin */
temp += 273150000;
sc->sc_data[APS_SENSOR_TEMP2].value_cur = temp;
sc->sc_data[APS_SENSOR_XVAR].value_cur = sc->aps_data.x_var;
sc->sc_data[APS_SENSOR_YVAR].value_cur = sc->aps_data.y_var;
sc->sc_data[APS_SENSOR_KBACT].value_cur =
(sc->aps_data.input & APS_INPUT_KB) ? 1 : 0;
sc->sc_data[APS_SENSOR_MSACT].value_cur =
(sc->aps_data.input & APS_INPUT_MS) ? 1 : 0;
sc->sc_data[APS_SENSOR_LIDOPEN].value_cur =
(sc->aps_data.input & APS_INPUT_LIDOPEN) ? 1 : 0;
}
void
aps_refresh(void *arg)
{
struct aps_softc *sc = (struct aps_softc *)arg;
aps_refresh_sensor_data(sc);
callout_schedule(&sc->sc_callout, (hz) / 2);
}
void
aps_power(int why, void *arg)
{
struct aps_softc *sc = (struct aps_softc *)arg;
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
if (why != PWR_RESUME) {
callout_stop(&sc->sc_callout);
} else {
/*
* Redo the init sequence on resume, because APS is
* as forgetful as it is deaf.
*/
bus_space_write_1(iot, ioh, APS_INIT, 0x13);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
bus_space_read_1(iot, ioh, APS_CMD);
bus_space_write_1(iot, ioh, APS_INIT, 0x13);
bus_space_write_1(iot, ioh, APS_CMD, 0x01);
if (aps_mem_read_1(iot, ioh, APS_CMD, 0x00) &&
aps_init(iot, ioh))
callout_schedule(&sc->sc_callout, (hz) / 2);
else
printf("aps: failed to wake up\n");
}
}
>Release-Note:
>Audit-Trail:
From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-i386/36852: Port of the aps driver from OpenBSD
Date: Mon, 27 Aug 2007 20:24:52 -0400 (EDT)
On Mon, 27 Aug 2007, Pierre Pronchery wrote:
> Add this to sys/dev/isa/files.isa:
> device aps
> attach aps at isa with aps_isa
> file dev/isa/aps.c aps
>
> Add this to your kernel configuration:
> aps* at isa? port 0x1600
Is there any way we can use something other than isabus to attach this
device? A quick glance at my T61's DSDT shows that the PNP0C02 ("Plug
and Play motherboard register resources") claims this IO port range, but I
don't see any identifier for it...
Cheers,
Jared
Responsible-Changed-From-To: port-i386-maintainer->xtraeme
Responsible-Changed-By: xtraeme@netbsd.org
Responsible-Changed-When: Thu, 30 Aug 2007 18:47:22 +0000
Responsible-Changed-Why:
I'm coordinating this with the submitter.
From: Pierre Pronchery <khorben@defora.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-i386/36852: Port of the aps driver from OpenBSD
Date: Mon, 03 Sep 2007 22:12:37 +0200
This is a multi-part message in MIME format.
--------------010201020900010205040708
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hi,
Juan RP wrote:
> On Mon, 27 Aug 2007 22:40:02 +0000 (UTC)
> Pierre Pronchery <khorben@defora.org> wrote:
>
>>> Description:
>> Please find a port of the aps driver from OpenBSD here. It supports the
>> accel-o-meter device found on ThinkPads laptops for a while now.
>
> Thanks for your port. I've modified it a bit, I made the following changes:
>
> - Use sme_flags = SME_DISABLE_GTREDATA; because the driver refreshes the
> sensors by itself, so there's no need to use the gtredata function
> (see sysmon_envsys(9) for more info).
> - use aprint(9) for autoconf messages.
> - some KNF.
> - Change private driver functions to be static.
> - Invalid use of ENVSYS_FNOTVALID.
>
> Please test and let me know if it works as before and then I'll commit.
It does indeed. Feel free to commit if appropriate.
I attach here a copy of my dmesg and envstat as with the patch.
There is a spurious "aps: can't map i/o space" line from the kernel, but
I also had it before. I could not figure why this happens so far.
I still don't know if the movement values represent what should actually
be obtained, but they seem to be updated coherently when I move the laptop.
> Also, you should provide a manpage for new drivers.
Is it ok to import the page from the OpenBSD project?
Thanks again,
--
khorben
--------------010201020900010205040708
Content-Type: text/plain;
name="dmesg-aps.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dmesg-aps.txt"
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 4.99.30 (GENERIC.MP) #3: Mon Sep 3 20:01:22 CEST 2007
khorben@syn.defora.rom:/usr/obj/sys/arch/amd64/compile/GENERIC.MP
total memory = 2046 MB
avail memory = 1954 MB
timecounter: Timecounters tick every 10.000 msec
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
mainbus0 (root)
cpu0 at mainbus0 apid 0: (boot processor)
cpu0: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz, 1995.11 MHz
cpu0: features: bffbfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features: bffbfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,B20,DS,ACPI,MMX>
cpu0: features: bffbfbff<FXSR,SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2: e3bd<SSE3,MONITOR,DS-CPL,VMX,EST,TM2,xTPR,PDCM>
cpu0: features3: bffbfbff<SYSCALL/SYSRET,XD,EM64T>
cpu0: L2 cache 4 MB 64B/line 16-way
cpu0: Enhanced SpeedStep (1324 mV) 2000 MHz
cpu0: unknown Enhanced SpeedStep CPU.
cpu0: Enhanced SpeedStep frequencies available (MHz): 2000 1833 1667 1500 1333 1167 1000
cpu0: calibrating local timer
cpu0: apic clock running at 166 MHz
cpu0: 64 page colors
cpu1 at mainbus0 apid 1: (application processor)
cpu1: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz, 1995.00 MHz
cpu1: features: bffbfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu1: features: bffbfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,B20,DS,ACPI,MMX>
cpu1: features: bffbfbff<FXSR,SSE,SSE2,SS,HTT,TM,SBF>
cpu1: features2: e3bd<SSE3,MONITOR,DS-CPL,VMX,EST,TM2,xTPR,PDCM>
cpu1: features3: bffbfbff<SYSCALL/SYSRET,XD,EM64T>
cpu1: L2 cache 4 MB 64B/line 16-way
ioapic0 at mainbus0 apid 1
ioapic0: pa 0xfec00000, version 20, 24 pins
ioapic0: misconfigured as apic 2
ioapic0: remapped to apic 1
acpi0 at mainbus0: Advanced Configuration and Power Interface
acpi0: using Intel ACPI CA subsystem version 20060217
acpi0: X/RSDT: OemId <LENOVO,TP-79 ,00002110>, AslId < LTP,00000000>
acpi0: found ECDT, GPE 28
acpi0: SCI interrupting at int 9
acpi0: fixed-feature power button present
timecounter: Timecounter "ACPI-Fast" frequency 3579545 Hz quality 1000
ACPI-Fast 24-bit timer
CPU0 (ACPI Object Type 'Processor' [0x0c]) at acpi0 not configured
CPU1 (ACPI Object Type 'Processor' [0x0c]) at acpi0 not configured
LNKA (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKB (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKC (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKD (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKE (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKF (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKG (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
LNKH (PNP0C0F) [PCI interrupt link device] at acpi0 not configured
MEM (PNP0C01) [System Board] at acpi0 not configured
acpilid0 at acpi0 (LID, PNP0C0D): ACPI Lid Switch
acpibut0 at acpi0 (SLPB, PNP0C0E): ACPI Sleep Button
PCI0 (PNP0A08) [PCI Express/PCI-X Mode-2 Host Bridge] at acpi0 not configured
SIO (PNP0C02) [Plug and Play motherboard register resources] at acpi0 not configured
PIC (PNP0000) [AT Interrupt Controller] at acpi0 not configured
attimer1 at acpi0 (TIMR, PNP0100): AT Timer
attimer1: io 0x40-0x43 irq 0
HPET (PNP0103) [HPET Timer] at acpi0 not configured
DMAC (PNP0200) [AT DMA Controller] at acpi0 not configured
pcppi1 at acpi0 (SPKR, PNP0800)
pcppi1: io 0x61
midi0 at pcppi1: PC speaker (CPU-intensive output)
sysbeep0 at pcppi1
FPU (PNP0C04) [Math Coprocessor] at acpi0 not configured
RTC (PNP0B00) [AT Real-Time Clock] at acpi0 not configured
pckbc1 at acpi0 (KBD, PNP0303): kbd port
pckbc1: io 0x60,0x64 irq 1
pckbc2 at acpi0 (MOU, IBM0057): aux port
pckbc2: irq 12
com2 at acpi0 (FIR, IBM0071)
com2: io 0x2f8-0x2ff irq 3 drq 3
com2: ns16550a, working fifo
TPM (ATM1200) at acpi0 not configured
acpiec0 at acpi0 (EC, PNP0C09-0): ACPI Embedded Controller
acpiec0: io 0x62,0x66
PUBS (ACPI Object Type 'Power' [0x0b]) at acpi0 not configured
acpibat0 at acpi0 (BAT0, PNP0C0A-0): ACPI Battery (Control Method)
acpibat1 at acpi0 (BAT1, PNP0C0A-1): ACPI Battery (Control Method)
acpiacad0 at acpi0 (AC, ACPI0003-0): ACPI AC Adapter
HKEY (IBM0068) at acpi0 not configured
acpitz0 at acpi0 (THM0): ACPI Thermal Zone
acpitz0: unable to get polling interval; using default of 30.0s
acpitz0: passive cooling mode only
acpitz0: critical 127.0C
acpitz1 at acpi0 (THM1): ACPI Thermal Zone
acpitz1: unable to get polling interval; using default of 30.0s
acpitz1: critical 99.0C passive 61.0C
pcppi1: attached to attimer1
pckbd0 at pckbc1 (kbd slot)
pckbc1: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pms0 at pckbc1 (aux slot)
pckbc1: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82945GM/PM/GMS Host Bridge (rev. 0x03)
agp at pchb0 not configured
ppb0 at pci0 dev 1 function 0: Intel product 0x27a1 (rev. 0x03)
pci1 at ppb0 bus 1
pci1: i/o space, memory space enabled, rd/line, wr/inv ok
vga0 at pci1 dev 0 function 0: ATI Technologies product 0x7145 (rev. 0x00)
wsdisplay0 at vga0 kbdmux 1: console (80x25, vt100 emulation), using wskbd0
wsmux1: connecting to wsdisplay0
direct rendering for vga0 unsupported
azalia0 at pci0 dev 27 function 0: Generic High Definition Audio Controller
azalia0: interrupting at ioapic0 pin 17 (irq 11)
azalia0: host: Intel 82801GB/GR High Definition Audio Controller (rev. 2)
azalia0: host: High Definition Audio rev. 1.0
ppb1 at pci0 dev 28 function 0: Intel 82801GB/GR PCI Express Port #1 (rev. 0x02)
pci2 at ppb1 bus 2
pci2: i/o space, memory space enabled, rd/line, wr/inv ok
wm0 at pci2 dev 0 function 0: Intel i82573L Gigabit Ethernet, rev. 0
wm0: interrupting at ioapic0 pin 16 (irq 11)
wm0: PCI-Express bus
wm0: 256 word (8 address bits) SPI EEPROM
wm0: Ethernet address 00:xx:xx:xx:xx:xx
makphy0 at wm0 phy 1: Marvell 88E1111 Gigabit PHY, rev. 2
makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
ppb2 at pci0 dev 28 function 1: Intel 82801GB/GR PCI Express Port #2 (rev. 0x02)
pci3 at ppb2 bus 3
pci3: i/o space, memory space enabled, rd/line, wr/inv ok
wpi0 at pci3 dev 0 function 0: Intel PRO/Wireless LAN 3945ABG Mini-PCI Adapter (rev. 0x02)
wpi0: interrupting at ioapic0 pin 17 (irq 11)
, MoW2, address 00:xx:xx:xx:xx:xx
wpi0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wpi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wpi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
ppb3 at pci0 dev 28 function 2: Intel 82801GB/GR PCI Express Port #3 (rev. 0x02)
pci4 at ppb3 bus 4
pci4: i/o space, memory space enabled, rd/line, wr/inv ok
ppb4 at pci0 dev 28 function 3: Intel 82801GB/GR PCI Express Port #4 (rev. 0x02)
pci5 at ppb4 bus 12
pci5: i/o space, memory space enabled, rd/line, wr/inv ok
uhci0 at pci0 dev 29 function 0: Intel 82801GB/GR USB UHCI Controller (rev. 0x02)
uhci0: interrupting at ioapic0 pin 16 (irq 11)
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1 at pci0 dev 29 function 1: Intel 82801GB/GR USB UHCI Controller (rev. 0x02)
uhci1: interrupting at ioapic0 pin 17 (irq 11)
usb1 at uhci1: USB revision 1.0
uhub1 at usb1
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2 at pci0 dev 29 function 2: Intel 82801GB/GR USB UHCI Controller (rev. 0x02)
uhci2: interrupting at ioapic0 pin 18 (irq 11)
usb2 at uhci2: USB revision 1.0
uhub2 at usb2
uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhci3 at pci0 dev 29 function 3: Intel 82801GB/GR USB UHCI Controller (rev. 0x02)
uhci3: interrupting at ioapic0 pin 19 (irq 11)
usb3 at uhci3: USB revision 1.0
uhub3 at usb3
uhub3: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
ehci0 at pci0 dev 29 function 7: Intel 82801GB/GR USB EHCI Controller (rev. 0x02)
ehci0: interrupting at ioapic0 pin 19 (irq 11)
ehci0: BIOS has given up ownership
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2 uhci3
usb4 at ehci0: USB revision 2.0
uhub4 at usb4
uhub4: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub4: 8 ports with 8 removable, self powered
ppb5 at pci0 dev 30 function 0: Intel 82801BAM Hub-PCI Bridge (rev. 0xe2)
pci6 at ppb5 bus 21
pci6: i/o space enabled
cbb0 at pci6 dev 0 function 0: Texas Instruments PCI1510 PCI-CardBus Bridge (rev. 0x00)
cbb0: can't map socket base address 0xe4300000
pci_io_find: expected type i/o, found mem
cbb0: can't map socket base address 0xe4300000: io mode
cbb0: interrupting at ioapic0 pin 16 (irq 11)
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 22
pcmcia0 at cardslot0
pcib0 at pci0 dev 31 function 0
pcib0: Intel 82801GBM LPC Interface Bridge (rev. 0x02)
piixide0 at pci0 dev 31 function 1
piixide0: Intel 82801GB/GR IDE Controller (ICH7) (rev. 0x02)
piixide0: bus-master DMA support present
piixide0: primary channel configured to compatibility mode
piixide0: primary channel interrupting at ioapic0 pin 14 (irq 14)
atabus0 at piixide0 channel 0
piixide0: secondary channel configured to compatibility mode
piixide0: secondary channel ignored (disabled)
ahcisata0 at pci0 dev 31 function 2: Intel 82801GBM AHCI SATA Controller
ahcisata0: interrupting at ioapic0 pin 16 (irq 11)
ahcisata0: AHCI revision 1.1, 4 ports, 32 command slots, features 0xc710e000
atabus1 at ahcisata0 channel 0
ichsmb0 at pci0 dev 31 function 3: Intel 82801GB/GR SMBus Controller (rev. 0x02)
ichsmb0: interrupting at ioapic0 pin 23 (irq 11)
iic0 at ichsmb0: I2C bus
iic0: devices at 0x44 0x54 0x55 0x56 0x5c
isa0 at pcib0
aps: state register 0x1
aps0 at isa0 port 0x1600-0x161e
aps: can't map i/o space
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
azalia0: codec[0]: Analog Devices AD1981HD (rev. 2.0)
azalia0: codec[0]: High Definition Audio rev. 1.0
azalia0: playback: max channels=2, encodings=1<PCM>
azalia0: playback: PCM formats=e007f<24bit,20bit,16bit,48kHz,44.1kHz,32kHz,22.05kHz,16kHz,11.025kHz,8kHz>
azalia0: recording: max channels=2, encodings=1<PCM>
azalia0: recording: PCM formats=6007f<20bit,16bit,48kHz,44.1kHz,32kHz,22.05kHz,16kHz,11.025kHz,8kHz>
azalia0: codec[1]: 0x14f1/0x2bfa (rev. 0.0)
azalia0: codec[1]: High Definition Audio rev. 0.9
azalia0: codec[1]: No support for modem function groups
azalia0: codec[1] has no audio function groups
audio0 at azalia0: full duplex, independent
Kernelized RAIDframe activated
ahcisata0 port 0: device present, speed: 1.5Gb/s
wd0 at atabus1 drive 0: <HTS721010G9SA00>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 95396 MB, 193821 cyl, 16 head, 63 sec, 512 bytes/sect x 195371568 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(ahcisata0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100) (using DMA)
uhidev0 at uhub2 port 1 configuration 1 interface 0boot device: wd0
root on wd0a dumps on wd0b
uhidev0: Logitech USB-PS/2 Optical Mouse, rev 2.00/20.00, addr 2, iclass 3/1
ums0 at uhidev0: 3 buttons and Z dir.
wsmouse1 at ums0 mux 0
root file system type: ffs
ugen0 at uhub3 port 2
ugen0: STMicroelectronics Biometric Coprocessor, rev 1.00/0.01, addr 2
acpibat1: battery info: SONY, LiP, 40Y6790 1193
acpibat0: battery info: SANYO, LION, 42T4504 695
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)
Accounting started
uhidev0: at uhub2 port 1 (addr 2) disconnected
wsmouse1 detached
ums0 detached
uhidev0 detached
--------------010201020900010205040708
Content-Type: text/plain;
name="envstat-aps.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="envstat-aps.txt"
acpiacad0 connected: ON
acpibat0 present: ON
acpibat0 design cap: 56.160 Wh
acpibat0 last full cap: 55.210 Wh
acpibat0 technology: 1
acpibat0 design voltage: 10.800 V
acpibat0 warn cap: 2.760 Wh ( 5.00%)
acpibat0 low cap: 0.200 Wh ( 0.36%)
acpibat0 voltage: 12.497 V
acpibat0 charge rate: N/A
acpibat0 discharge rate: N/A
acpibat0 charge: 55.210 Wh (100.00%)
acpibat0 charging: OFF
acpibat0 charge state: NORMAL
acpibat1 present: ON
acpibat1 design cap: 29.160 Wh
acpibat1 last full cap: 29.160 Wh
acpibat1 technology: 1
acpibat1 design voltage: 10.800 V
acpibat1 warn cap: 1.458 Wh ( 5.00%)
acpibat1 low cap: 0.200 Wh ( 0.69%)
acpibat1 voltage: 12.406 V
acpibat1 charge rate: N/A
acpibat1 discharge rate: N/A
acpibat1 charge: 28.860 Wh (98.97%)
acpibat1 charging: OFF
acpibat1 charge state: NORMAL
acpitz0 temperature: 47.000 degC
acpitz1 temperature: 46.000 degC
aps0 X_ACCEL: 465
aps0 Y_ACCEL: 492
aps0 X_VAR: 465
aps0 Y_VAR: 492
aps0 TEMP_1: 38.000 degC
aps0 TEMP_2: 38.000 degC
aps0 Keyboard Active: ON
aps0 Mouse Active: OFF
aps0 Lid Open: ON
--------------010201020900010205040708--
State-Changed-From-To: open->closed
State-Changed-By: xtraeme@netbsd.org
State-Changed-When: Tue, 11 Sep 2007 21:50:08 +0000
State-Changed-Why:
Driver was imported to HEAD. The LKM is also available,
thanks for your contribution... let me know if you have
any problem.
From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/36852 CVS commit: src
Date: Tue, 11 Sep 2007 21:46:53 +0000 (UTC)
Module Name: src
Committed By: xtraeme
Date: Tue Sep 11 21:46:53 UTC 2007
Modified Files:
src/doc: CHANGES
src/share/man/man4: Makefile
src/sys/arch/i386/conf: GENERIC
src/sys/lkm/dev/isa: Makefile
Added Files:
src/share/man/man4: aps.4
src/sys/dev/isa: aps.c
src/sys/lkm/dev/isa/aps: Makefile
Log Message:
New aps(4) driver for IBM Thinkpad Active Protection System.
Exports some sensors through the envsys(4) framework available
in some Thinkpad laptops.
Ported by Pierre Pronchery from OpenBSD, via PR port-i386/36852.
Tweaks, LKM and misc improvements by me. Added into i386/GENERIC
commented out.
To generate a diff of this commit:
cvs rdiff -r1.925 -r1.926 src/doc/CHANGES
cvs rdiff -r1.440 -r1.441 src/share/man/man4/Makefile
cvs rdiff -r0 -r1.1 src/share/man/man4/aps.4
cvs rdiff -r1.848 -r1.849 src/sys/arch/i386/conf/GENERIC
cvs rdiff -r0 -r1.1 src/sys/dev/isa/aps.c
cvs rdiff -r1.2 -r1.3 src/sys/lkm/dev/isa/Makefile
cvs rdiff -r0 -r1.1 src/sys/lkm/dev/isa/aps/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.