acpiio.h revision 78662
167761Smsmith/*- 267761Smsmith * Copyright (c) 1999 Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp> 367761Smsmith * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 467761Smsmith * All rights reserved. 567761Smsmith * 667761Smsmith * Redistribution and use in source and binary forms, with or without 767761Smsmith * modification, are permitted provided that the following conditions 867761Smsmith * are met: 967761Smsmith * 1. Redistributions of source code must retain the above copyright 1067761Smsmith * notice, this list of conditions and the following disclaimer. 1167761Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1267761Smsmith * notice, this list of conditions and the following disclaimer in the 1367761Smsmith * documentation and/or other materials provided with the distribution. 1467761Smsmith * 1567761Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1667761Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1767761Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1867761Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1967761Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2067761Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2167761Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2267761Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2367761Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2467761Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2567761Smsmith * SUCH DAMAGE. 2667761Smsmith * 2767761Smsmith * $FreeBSD: head/sys/dev/acpica/acpiio.h 78662 2001-06-23 10:38:25Z iwasaki $ 2867761Smsmith */ 2967761Smsmith 3069744Smsmith/* 3169744Smsmith * Core ACPI subsystem ioctls 3269744Smsmith */ 3367761Smsmith#define ACPIIO_ENABLE _IO('P', 1) 3467761Smsmith#define ACPIIO_DISABLE _IO('P', 2) 3567761Smsmith#define ACPIIO_SETSLPSTATE _IOW('P', 3, int) 3667761Smsmith 3778662Siwasakistruct acpi_battdesc { 3878662Siwasaki int type; /* battery type: e.g. CMBAT */ 3978662Siwasaki int phys_unit; /* physical unit of devclass */ 4078662Siwasaki}; 4178662Siwasaki 4278662Siwasaki#define ACPI_BATT_TYPE_CMBAT 0x0000 4378662Siwasaki#define ACPI_BATT_TYPE_SMBAT 0x0001 4478662Siwasaki 4578662Siwasakistruct acpi_battinfo { 4678662Siwasaki int cap; /* percent */ 4778662Siwasaki int min; /* remianing time */ 4878662Siwasaki int state; /* battery state */ 4978662Siwasaki}; 5078662Siwasaki 5170271Stakawata#define ACPI_CMBAT_MAXSTRLEN 32 5270271Stakawatastruct acpi_bif { 5370271Stakawata u_int32_t unit; /* 0 for mWh, 1 for mAh */ 5470271Stakawata u_int32_t dcap; /* Design Capacity */ 5570271Stakawata u_int32_t btech; /* Battery Technorogy */ 5670271Stakawata u_int32_t lfcap; /* Last Full capacity */ 5770271Stakawata u_int32_t dvol; /* Design voltage (mV) */ 5870271Stakawata u_int32_t wcap; /* WARN capacity */ 5970271Stakawata u_int32_t lcap; /* Low capacity */ 6070271Stakawata u_int32_t gra1; /* Granulity 1(Warn to Low) */ 6170271Stakawata u_int32_t gra2; /* Granulity 2(Full to Warn) */ 6270271Stakawata char model[ACPI_CMBAT_MAXSTRLEN]; /* model identifier */ 6370271Stakawata char serial[ACPI_CMBAT_MAXSTRLEN]; /* Serial number */ 6470271Stakawata char type[ACPI_CMBAT_MAXSTRLEN]; /* Type */ 6570271Stakawata char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM infomation */ 6670271Stakawata}; 6770271Stakawata 6870271Stakawatastruct acpi_bst { 6970271Stakawata u_int32_t state; /* Battery State */ 7070271Stakawata u_int32_t rate; /* Present Rate */ 7170271Stakawata u_int32_t cap; /* Remaining Capacity */ 7270271Stakawata u_int32_t volt; /* Present Voltage */ 7370271Stakawata}; 7470271Stakawata 7578662Siwasaki#define ACPI_BATT_STAT_DISCHARG 0x0001 7678662Siwasaki#define ACPI_BATT_STAT_CHARGING 0x0002 7778662Siwasaki#define ACPI_BATT_STAT_CRITICAL 0x0004 7878662Siwasaki#define ACPI_BATT_STAT_NOT_PRESENT 0x0007 7978662Siwasaki#define ACPI_BATT_STAT_MAX 0x0007 8078662Siwasaki 8178662Siwasakiunion acpi_battery_ioctl_arg { 8278662Siwasaki int unit; /* argument: logical unit (-1 = overall) */ 8378662Siwasaki 8478662Siwasaki struct acpi_battdesc battdesc; 8578662Siwasaki struct acpi_battinfo battinfo; 8678662Siwasaki 8778662Siwasaki struct acpi_bif bif; /* for acpi_cmbat */ 8878662Siwasaki struct acpi_bst bst; /* for acpi_cmbat */ 8970340Siwasaki}; 9070340Siwasaki 9178662Siwasaki/* Common battery ioctl */ 9278662Siwasaki#define ACPIIO_BATT_GET_UNITS _IOR('B', 0x01, int) 9378662Siwasaki#define ACPIIO_BATT_GET_TYPE _IOR('B', 0x02, union acpi_battery_ioctl_arg) 9478662Siwasaki#define ACPIIO_BATT_GET_BATTINFO _IOWR('B', 0x03, union acpi_battery_ioctl_arg) 9578662Siwasaki#define ACPIIO_BATT_GET_BATTDESC _IOWR('B', 0x04, union acpi_battery_ioctl_arg) 9670340Siwasaki 9778662Siwasaki/* Cotrol Method battery ioctl */ 9878662Siwasaki#define ACPIIO_CMBAT_GET_BIF _IOWR('B', 0x10, union acpi_battery_ioctl_arg) 9978662Siwasaki#define ACPIIO_CMBAT_GET_BST _IOWR('B', 0x11, union acpi_battery_ioctl_arg) 10078662Siwasaki 10170340Siwasaki#define ACPIIO_ACAD_GET_STATUS _IOR('A', 1, int) 10270340Siwasaki 10369744Smsmith#ifdef _KERNEL 10469744Smsmithextern int acpi_register_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg), void *arg); 10569744Smsmithextern void acpi_deregister_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg)); 10669744Smsmith#endif 107