| 1 | /*	$NetBSD: apmbios.h,v 1.7 2012/09/30 21:36:20 dsl Exp $	*/ |
| 2 | /*- |
| 3 | * Copyright (c) 1995 The NetBSD Foundation, Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * This code is derived from software contributed to The NetBSD Foundation |
| 7 | * by John Kohl. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| 19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
| 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | #ifndef _DEV_APM_APMBIOS_H_ |
| 31 | #define _DEV_APM_APMBIOS_H_ |
| 32 | |
| 33 | /* |
| 34 | * These definitions were those for the i386 'APM' (which predates ACPI), |
| 35 | * but have been hijacked for all sorts of uses. |
| 36 | * The APM specific values were removed when APM was removed. |
| 37 | */ |
| 38 | |
| 39 | #define	APM_ERR_PM_DISABLED	0x01 |
| 40 | #define	APM_ERR_REALALREADY	0x02 |
| 41 | #define	APM_ERR_NOTCONN		0x03 |
| 42 | #define	APM_ERR_16ALREADY	0x05 |
| 43 | #define	APM_ERR_16NOTSUPP	0x06 |
| 44 | #define	APM_ERR_32ALREADY	0x07 |
| 45 | #define	APM_ERR_32NOTSUPP	0x08 |
| 46 | #define	APM_ERR_UNRECOG_DEV	0x09 |
| 47 | #define	APM_ERR_ERANGE		0x0A |
| 48 | #define	APM_ERR_NOTENGAGED	0x0B |
| 49 | #define	APM_ERR_EOPNOTSUPP	0x0C |
| 50 | #define	APM_ERR_RTIMER_DISABLED	0x0D |
| 51 | #define APM_ERR_UNABLE		0x60 |
| 52 | #define APM_ERR_NOEVENTS	0x80 |
| 53 | #define	APM_ERR_NOT_PRESENT	0x86 |
| 54 | |
| 55 | #define APM_DEV_ALLDEVS		0x0001 |
| 56 | |
| 57 | #define		APM_SYS_READY	0x0000 |
| 58 | #define		APM_SYS_STANDBY	0x0001 |
| 59 | #define		APM_SYS_SUSPEND	0x0002 |
| 60 | #define		APM_SYS_OFF	0x0003 |
| 61 | #define		APM_LASTREQ_INPROG	0x0004 |
| 62 | #define		APM_LASTREQ_REJECTED	0x0005 |
| 63 | |
| 64 | #define		APM_AC_OFF		0x00 |
| 65 | #define		APM_AC_ON		0x01 |
| 66 | #define		APM_AC_BACKUP		0x02 |
| 67 | #define		APM_AC_UNKNOWN		0xff |
| 68 | |
| 69 | /* the first set of battery constants is 1.0 style values; |
| 70 | * the second set is 1.1 style bit definitions */ |
| 71 | #define		APM_BATT_HIGH		0x00 |
| 72 | #define		APM_BATT_LOW		0x01 |
| 73 | #define		APM_BATT_CRITICAL	0x02 |
| 74 | #define		APM_BATT_CHARGING	0x03 |
| 75 | #define		APM_BATT_ABSENT		0x04 /* Software only--not in spec! */ |
| 76 | #define		APM_BATT_UNKNOWN	0xff |
| 77 | |
| 78 | #define		APM_BATT_FLAG_HIGH	0x01 |
| 79 | #define		APM_BATT_FLAG_LOW	0x02 |
| 80 | #define		APM_BATT_FLAG_CRITICAL	0x04 |
| 81 | #define		APM_BATT_FLAG_CHARGING	0x08 |
| 82 | #define		APM_BATT_FLAG_NOBATTERY	0x10 |
| 83 | #define		APM_BATT_FLAG_NO_SYSTEM_BATTERY	0x80 |
| 84 | #define		APM_BATT_FLAG_UNKNOWN	0xff |
| 85 | |
| 86 | #define		APM_BATT_LIFE_UNKNOWN	0xff |
| 87 | |
| 88 | #define		APM_STANDBY_REQ		0x0001 /* %bx on return */ |
| 89 | #define		APM_SUSPEND_REQ		0x0002 |
| 90 | #define		APM_NORMAL_RESUME	0x0003 |
| 91 | #define		APM_CRIT_RESUME		0x0004 /* suspend/resume happened |
| 92 | 						 without us */ |
| 93 | #define		APM_BATTERY_LOW		0x0005 |
| 94 | #define		APM_POWER_CHANGE	0x0006 |
| 95 | #define		APM_UPDATE_TIME		0x0007 |
| 96 | #define		APM_CRIT_SUSPEND_REQ	0x0008 |
| 97 | #define		APM_USER_STANDBY_REQ	0x0009 |
| 98 | #define		APM_USER_SUSPEND_REQ	0x000A |
| 99 | #define		APM_SYS_STANDBY_RESUME	0x000B |
| 100 | #define		APM_CAP_CHANGE		0x000C	/* V1.2 */ |
| 101 | |
| 102 | #define		APM_GLOBAL_STANDBY	0x0001 |
| 103 | #define		APM_GLOBAL_SUSPEND	0x0002 |
| 104 | |
| 105 | /* |
| 106 | * APM info word from the real-mode handler is adjusted to put |
| 107 | * major/minor version in low half and support bits in upper half. |
| 108 | */ |
| 109 | #define	APM_MAJOR_VERS(info) (((info)&0xff00)>>8) |
| 110 | #define	APM_MINOR_VERS(info) ((info)&0xff) |
| 111 | |
| 112 | #define	APMDEBUG_INFO		0x01 |
| 113 | #define	APMDEBUG_EVENTS		0x04 |
| 114 | #define	APMDEBUG_DEVICE		0x20 |
| 115 | #define	APMDEBUG_ANOM		0x40 |
| 116 | |
| 117 | #endif /* _DEV_APM_APMBIOS_H_ */ |