acpiio.h revision 142753
167761Smsmith/*- 2119097Stakawata * Copyright (c) 1999 Takanori Watanabe <takawata@jp.freebsd.org> 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 142753 2005-02-28 05:39:34Z njl $ 2867761Smsmith */ 2967761Smsmith 30142753Snjl#ifndef _ACPIIO_H_ 31142753Snjl#define _ACPIIO_H_ 32142753Snjl 3369744Smsmith/* 3469744Smsmith * Core ACPI subsystem ioctls 3569744Smsmith */ 3667761Smsmith#define ACPIIO_SETSLPSTATE _IOW('P', 3, int) 3767761Smsmith 3878662Siwasakistruct acpi_battdesc { 39119529Snjl int type; /* battery type: e.g. CMBAT */ 40119529Snjl int phys_unit; /* physical unit of devclass */ 4178662Siwasaki}; 4278662Siwasaki 4378662Siwasaki#define ACPI_BATT_TYPE_CMBAT 0x0000 4478662Siwasaki#define ACPI_BATT_TYPE_SMBAT 0x0001 4578662Siwasaki 4678662Siwasakistruct acpi_battinfo { 47119529Snjl int cap; /* percent */ 48130914Sbrueffer int min; /* remaining time */ 49119529Snjl int state; /* battery state */ 5078662Siwasaki}; 5178662Siwasaki 5270271Stakawata#define ACPI_CMBAT_MAXSTRLEN 32 5370271Stakawatastruct acpi_bif { 54120036Snjl u_int32_t units; /* 0 for mWh, 1 for mAh */ 55119529Snjl u_int32_t dcap; /* Design Capacity */ 56119529Snjl u_int32_t lfcap; /* Last Full capacity */ 57120036Snjl u_int32_t btech; /* Battery Technology */ 58119529Snjl u_int32_t dvol; /* Design voltage (mV) */ 59119529Snjl u_int32_t wcap; /* WARN capacity */ 60119529Snjl u_int32_t lcap; /* Low capacity */ 61130914Sbrueffer u_int32_t gra1; /* Granularity 1 (Warn to Low) */ 62130914Sbrueffer u_int32_t gra2; /* Granularity 2 (Full to Warn) */ 63119529Snjl char model[ACPI_CMBAT_MAXSTRLEN]; /* model identifier */ 64119529Snjl char serial[ACPI_CMBAT_MAXSTRLEN]; /* Serial number */ 65119529Snjl char type[ACPI_CMBAT_MAXSTRLEN]; /* Type */ 66119529Snjl char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM infomation */ 6770271Stakawata}; 6870271Stakawata 6970271Stakawatastruct acpi_bst { 70119529Snjl u_int32_t state; /* Battery State */ 71119529Snjl u_int32_t rate; /* Present Rate */ 72119529Snjl u_int32_t cap; /* Remaining Capacity */ 73119529Snjl u_int32_t volt; /* Present Voltage */ 7470271Stakawata}; 7570271Stakawata 7678662Siwasaki#define ACPI_BATT_STAT_DISCHARG 0x0001 7778662Siwasaki#define ACPI_BATT_STAT_CHARGING 0x0002 7878662Siwasaki#define ACPI_BATT_STAT_CRITICAL 0x0004 7978662Siwasaki#define ACPI_BATT_STAT_NOT_PRESENT 0x0007 8078662Siwasaki#define ACPI_BATT_STAT_MAX 0x0007 8178662Siwasaki 8278662Siwasakiunion acpi_battery_ioctl_arg { 83119529Snjl int unit; /* argument: logical unit (-1 = overall) */ 8478662Siwasaki 85119529Snjl struct acpi_battdesc battdesc; 86119529Snjl struct acpi_battinfo battinfo; 8778662Siwasaki 88119529Snjl struct acpi_bif bif; /* for acpi_cmbat */ 89119529Snjl struct acpi_bst bst; /* for acpi_cmbat */ 9070340Siwasaki}; 9170340Siwasaki 9278662Siwasaki/* Common battery ioctl */ 93119529Snjl#define ACPIIO_BATT_GET_UNITS _IOR('B', 0x01, int) 94119529Snjl#define ACPIIO_BATT_GET_TYPE _IOR('B', 0x02, union acpi_battery_ioctl_arg) 9578662Siwasaki#define ACPIIO_BATT_GET_BATTINFO _IOWR('B', 0x03, union acpi_battery_ioctl_arg) 9678662Siwasaki#define ACPIIO_BATT_GET_BATTDESC _IOWR('B', 0x04, union acpi_battery_ioctl_arg) 9770340Siwasaki 9878662Siwasaki/* Cotrol Method battery ioctl */ 99119529Snjl#define ACPIIO_CMBAT_GET_BIF _IOWR('B', 0x10, union acpi_battery_ioctl_arg) 100119529Snjl#define ACPIIO_CMBAT_GET_BST _IOWR('B', 0x11, union acpi_battery_ioctl_arg) 10178662Siwasaki 102142753Snjl/* Get AC adapter status. */ 103119529Snjl#define ACPIIO_ACAD_GET_STATUS _IOR('A', 1, int) 10470340Siwasaki 10569744Smsmith#ifdef _KERNEL 106119529Snjltypedef int (*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg); 107119529Snjlextern int acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg); 108119529Snjlextern void acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn); 10969744Smsmith#endif 110142753Snjl 111142753Snjl#endif /* !_ACPIIO_H_ */ 112