118334Speter/*	$NetBSD: apmbios.h,v 1.6 2012/09/30 21:05:14 dsl Exp $	*/
290075Sobrien/*-
318334Speter * Copyright (c) 1995 The NetBSD Foundation, Inc.
418334Speter * All rights reserved.
518334Speter *
618334Speter * This code is derived from software contributed to The NetBSD Foundation
718334Speter * by John Kohl.
818334Speter *
918334Speter * Redistribution and use in source and binary forms, with or without
1018334Speter * modification, are permitted provided that the following conditions
1118334Speter * are met:
1218334Speter * 1. Redistributions of source code must retain the above copyright
1318334Speter *    notice, this list of conditions and the following disclaimer.
1418334Speter * 2. Redistributions in binary form must reproduce the above copyright
1518334Speter *    notice, this list of conditions and the following disclaimer in the
1618334Speter *    documentation and/or other materials provided with the distribution.
1718334Speter *
1818334Speter * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1918334Speter * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2018334Speter * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2118334Speter * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2218334Speter * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2318334Speter * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2418334Speter * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2518334Speter * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2618334Speter * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2718334Speter * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2818334Speter * POSSIBILITY OF SUCH DAMAGE.
2950397Sobrien */
3018334Speter#ifndef _DEV_APM_APMBIOS_H_
3118334Speter#define _DEV_APM_APMBIOS_H_
3218334Speter
3318334Speter/*
3450397Sobrien * These definitions were those for the i386 'APM' (which predates ACPI),
3590075Sobrien * but have been hijacked for all sorts of uses.
3690075Sobrien * The APM specific values were removed when APM was removed.
3718334Speter */
3890075Sobrien
3990075Sobrien#define	APM_ERR_PM_DISABLED	0x01
4090075Sobrien#define	APM_ERR_REALALREADY	0x02
4190075Sobrien#define	APM_ERR_NOTCONN		0x03
4290075Sobrien#define	APM_ERR_16ALREADY	0x05
4390075Sobrien#define	APM_ERR_16NOTSUPP	0x06
4418334Speter#define	APM_ERR_32ALREADY	0x07
45117395Skan#define	APM_ERR_32NOTSUPP	0x08
46117395Skan#define	APM_ERR_UNRECOG_DEV	0x09
4718334Speter#define	APM_ERR_ERANGE		0x0A
4818334Speter#define	APM_ERR_NOTENGAGED	0x0B
4918334Speter#define	APM_ERR_EOPNOTSUPP	0x0C
50117395Skan#define	APM_ERR_RTIMER_DISABLED	0x0D
5150397Sobrien#define APM_ERR_UNABLE		0x60
5290075Sobrien#define APM_ERR_NOEVENTS	0x80
5318334Speter#define	APM_ERR_NOT_PRESENT	0x86
5418334Speter
5518334Speter#define APM_DEV_ALLDEVS		0x0001
5618334Speter
5750397Sobrien#define		APM_SYS_READY	0x0000
5818334Speter#define		APM_SYS_STANDBY	0x0001
5918334Speter#define		APM_SYS_SUSPEND	0x0002
6018334Speter#define		APM_SYS_OFF	0x0003
6118334Speter#define		APM_LASTREQ_INPROG	0x0004
6218334Speter#define		APM_LASTREQ_REJECTED	0x0005
6318334Speter
6418334Speter#define		APM_AC_OFF		0x00
6518334Speter#define		APM_AC_ON		0x01
6618334Speter#define		APM_AC_BACKUP		0x02
6718334Speter#define		APM_AC_UNKNOWN		0xff
6818334Speter
6918334Speter/* the first set of battery constants is 1.0 style values;
7018334Speter * the second set is 1.1 style bit definitions */
7118334Speter#define		APM_BATT_HIGH		0x00
7218334Speter#define		APM_BATT_LOW		0x01
7318334Speter#define		APM_BATT_CRITICAL	0x02
7418334Speter#define		APM_BATT_CHARGING	0x03
7518334Speter#define		APM_BATT_ABSENT		0x04 /* Software only--not in spec! */
7618334Speter#define		APM_BATT_UNKNOWN	0xff
7718334Speter
7818334Speter#define		APM_BATT_FLAG_HIGH	0x01
7918334Speter#define		APM_BATT_FLAG_LOW	0x02
8018334Speter#define		APM_BATT_FLAG_CRITICAL	0x04
8118334Speter#define		APM_BATT_FLAG_CHARGING	0x08
8218334Speter#define		APM_BATT_FLAG_NOBATTERY	0x10
8318334Speter#define		APM_BATT_FLAG_NO_SYSTEM_BATTERY	0x80
8418334Speter#define		APM_BATT_FLAG_UNKNOWN	0xff
8518334Speter
8618334Speter#define		APM_BATT_LIFE_UNKNOWN	0xff
8718334Speter
8818334Speter#define		APM_STANDBY_REQ		0x0001 /* %bx on return */
8918334Speter#define		APM_SUSPEND_REQ		0x0002
9018334Speter#define		APM_NORMAL_RESUME	0x0003
9150397Sobrien#define		APM_CRIT_RESUME		0x0004 /* suspend/resume happened
9218334Speter						  without us */
9350397Sobrien#define		APM_BATTERY_LOW		0x0005
9418334Speter#define		APM_POWER_CHANGE	0x0006
9518334Speter#define		APM_UPDATE_TIME		0x0007
9618334Speter#define		APM_CRIT_SUSPEND_REQ	0x0008
9790075Sobrien#define		APM_USER_STANDBY_REQ	0x0009
9818334Speter#define		APM_USER_SUSPEND_REQ	0x000A
9990075Sobrien#define		APM_SYS_STANDBY_RESUME	0x000B
10090075Sobrien#define		APM_CAP_CHANGE		0x000C	/* V1.2 */
10152284Sobrien
10252284Sobrien#define		APM_GLOBAL_STANDBY	0x0001
10352284Sobrien#define		APM_GLOBAL_SUSPEND	0x0002
10490075Sobrien
10590075Sobrien/*
10652284Sobrien * APM info word from the real-mode handler is adjusted to put
10790075Sobrien * major/minor version in low half and support bits in upper half.
10890075Sobrien */
10990075Sobrien#define	APM_MAJOR_VERS(info) (((info)&0xff00)>>8)
11018334Speter#define	APM_MINOR_VERS(info) ((info)&0xff)
11118334Speter
11218334Speter#define	APMDEBUG_INFO		0x01
11318334Speter#define	APMDEBUG_EVENTS		0x04
11418334Speter#define	APMDEBUG_DEVICE		0x20
11518334Speter#define	APMDEBUG_ANOM		0x40
11618334Speter
11750397Sobrien#endif /* _DEV_APM_APMBIOS_H_ */
11818334Speter