Index: acpi_thermal.c =================================================================== RCS file: /home/ncvs/src/sys/dev/acpica/acpi_thermal.c,v retrieving revision 1.2 diff -u -r1.2 acpi_thermal.c --- acpi_thermal.c 2000/12/08 09:16:20 1.2 +++ acpi_thermal.c 2000/12/14 11:32:42 @@ -51,7 +51,7 @@ static int acpi_tz_probe(device_t dev); static int acpi_tz_attach(device_t dev); - +static void acpi_tz_check_tripping_point(void *context); static device_method_t acpi_tz_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_tz_probe), @@ -82,7 +82,38 @@ } return_VALUE(ENXIO); } +static void acpi_tz_check_tripping_point(void *context) +{ + device_t dev = context; + struct acpi_tz_softc *sc; + UINT32 param[4]; + ACPI_BUFFER b; + sc = device_get_softc(dev); + b.Pointer = ¶m[0]; + b.Length = sizeof(param); + if((AcpiEvaluateObject(sc->tz_handle,"_TMP",NULL,&b)) != AE_OK){ + device_printf(dev,"CANNOT FOUND _TMP\n"); + return; + } + + device_printf(dev,"%d.%d K\n",param[1]/10,param[1]%10); + return; +} +#define ACPI_TZ_STATUS_CHANGE 0x80 +#define ACPI_TZ_TRIPPOINT_CHANGE 0x81 +static void acpi_tz_notify_handler( ACPI_HANDLE h,UINT32 notify, void *context) +{ + device_t dev = context; + switch(notify){ + case ACPI_TZ_STATUS_CHANGE: + case ACPI_TZ_TRIPPOINT_CHANGE: + /*Check trip point*/ + AcpiOsQueueForExecution(OSD_PRIORITY_LO, + acpi_tz_check_tripping_point,context); + break; + } +} static int acpi_tz_attach(device_t dev) { @@ -109,6 +140,15 @@ return_VALUE(ENXIO); } device_printf(sc->tz_dev, "current temperature %d.%dC\n", TZ_KELVTOC(param[1])); - + + AcpiInstallNotifyHandler(sc->tz_handle,ACPI_DEVICE_NOTIFY, + acpi_tz_notify_handler,dev); return_VALUE(0); } + + + + + + + Index: acpiio.h =================================================================== RCS file: /home/ncvs/src/sys/dev/acpica/acpiio.h,v retrieving revision 1.2 diff -u -r1.2 acpiio.h --- acpiio.h 2000/12/08 09:16:20 1.2 +++ acpiio.h 2000/12/22 10:12:44 @@ -34,6 +34,30 @@ #define ACPIIO_DISABLE _IO('P', 2) #define ACPIIO_SETSLPSTATE _IOW('P', 3, int) +#define ACPI_CMBAT_MAXSTRLEN 32 +struct acpi_bif { + u_int32_t unit; /* 0 for mWh, 1 for mAh */ + u_int32_t dcap; /* Design Capacity */ + u_int32_t btech; /* Battery Technorogy */ + u_int32_t lfcap; /* Last Full capacity */ + u_int32_t dvol; /* Design voltage (mV) */ + u_int32_t wcap; /* WARN capacity */ + u_int32_t lcap; /* Low capacity */ + u_int32_t gra1; /* Granulity 1(Warn to Low) */ + u_int32_t gra2; /* Granulity 2(Full to Warn) */ + char model[ACPI_CMBAT_MAXSTRLEN]; /* model identifier */ + char serial[ACPI_CMBAT_MAXSTRLEN]; /* Serial number */ + char type[ACPI_CMBAT_MAXSTRLEN]; /* Type */ + char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM infomation */ +}; + +struct acpi_bst { + u_int32_t state; /* Battery State */ + u_int32_t rate; /* Present Rate */ + u_int32_t cap; /* Remaining Capacity */ + u_int32_t volt; /* Present Voltage */ +}; + #ifdef _KERNEL extern int acpi_register_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg), void *arg); extern void acpi_deregister_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg));