xref: /openbmc/linux/include/uapi/linux/apm_bios.h (revision 827634ad)
1 /*
2  * Include file for the interface to an APM BIOS
3  * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2, or (at your option) any
8  * later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  */
15 #ifndef _UAPI_LINUX_APM_H
16 #define _UAPI_LINUX_APM_H
17 
18 
19 #include <linux/types.h>
20 
21 typedef unsigned short	apm_event_t;
22 typedef unsigned short	apm_eventinfo_t;
23 
24 struct apm_bios_info {
25 	__u16	version;
26 	__u16	cseg;
27 	__u32	offset;
28 	__u16	cseg_16;
29 	__u16	dseg;
30 	__u16	flags;
31 	__u16	cseg_len;
32 	__u16	cseg_16_len;
33 	__u16	dseg_len;
34 };
35 
36 
37 /*
38  * Power states
39  */
40 #define APM_STATE_READY		0x0000
41 #define APM_STATE_STANDBY	0x0001
42 #define APM_STATE_SUSPEND	0x0002
43 #define APM_STATE_OFF		0x0003
44 #define APM_STATE_BUSY		0x0004
45 #define APM_STATE_REJECT	0x0005
46 #define APM_STATE_OEM_SYS	0x0020
47 #define APM_STATE_OEM_DEV	0x0040
48 
49 #define APM_STATE_DISABLE	0x0000
50 #define APM_STATE_ENABLE	0x0001
51 
52 #define APM_STATE_DISENGAGE	0x0000
53 #define APM_STATE_ENGAGE	0x0001
54 
55 /*
56  * Events (results of Get PM Event)
57  */
58 #define APM_SYS_STANDBY		0x0001
59 #define APM_SYS_SUSPEND		0x0002
60 #define APM_NORMAL_RESUME	0x0003
61 #define APM_CRITICAL_RESUME	0x0004
62 #define APM_LOW_BATTERY		0x0005
63 #define APM_POWER_STATUS_CHANGE	0x0006
64 #define APM_UPDATE_TIME		0x0007
65 #define APM_CRITICAL_SUSPEND	0x0008
66 #define APM_USER_STANDBY	0x0009
67 #define APM_USER_SUSPEND	0x000a
68 #define APM_STANDBY_RESUME	0x000b
69 #define APM_CAPABILITY_CHANGE	0x000c
70 #define APM_USER_HIBERNATION	0x000d
71 #define APM_HIBERNATION_RESUME	0x000e
72 
73 /*
74  * Error codes
75  */
76 #define APM_SUCCESS		0x00
77 #define APM_DISABLED		0x01
78 #define APM_CONNECTED		0x02
79 #define APM_NOT_CONNECTED	0x03
80 #define APM_16_CONNECTED	0x05
81 #define APM_16_UNSUPPORTED	0x06
82 #define APM_32_CONNECTED	0x07
83 #define APM_32_UNSUPPORTED	0x08
84 #define APM_BAD_DEVICE		0x09
85 #define APM_BAD_PARAM		0x0a
86 #define APM_NOT_ENGAGED		0x0b
87 #define APM_BAD_FUNCTION	0x0c
88 #define APM_RESUME_DISABLED	0x0d
89 #define APM_NO_ERROR		0x53
90 #define APM_BAD_STATE		0x60
91 #define APM_NO_EVENTS		0x80
92 #define APM_NOT_PRESENT		0x86
93 
94 /*
95  * APM Device IDs
96  */
97 #define APM_DEVICE_BIOS		0x0000
98 #define APM_DEVICE_ALL		0x0001
99 #define APM_DEVICE_DISPLAY	0x0100
100 #define APM_DEVICE_STORAGE	0x0200
101 #define APM_DEVICE_PARALLEL	0x0300
102 #define APM_DEVICE_SERIAL	0x0400
103 #define APM_DEVICE_NETWORK	0x0500
104 #define APM_DEVICE_PCMCIA	0x0600
105 #define APM_DEVICE_BATTERY	0x8000
106 #define APM_DEVICE_OEM		0xe000
107 #define APM_DEVICE_OLD_ALL	0xffff
108 #define APM_DEVICE_CLASS	0x00ff
109 #define APM_DEVICE_MASK		0xff00
110 
111 
112 /*
113  * Battery status
114  */
115 #define APM_MAX_BATTERIES	2
116 
117 /*
118  * APM defined capability bit flags
119  */
120 #define APM_CAP_GLOBAL_STANDBY		0x0001
121 #define APM_CAP_GLOBAL_SUSPEND		0x0002
122 #define APM_CAP_RESUME_STANDBY_TIMER	0x0004 /* Timer resume from standby */
123 #define APM_CAP_RESUME_SUSPEND_TIMER	0x0008 /* Timer resume from suspend */
124 #define APM_CAP_RESUME_STANDBY_RING	0x0010 /* Resume on Ring fr standby */
125 #define APM_CAP_RESUME_SUSPEND_RING	0x0020 /* Resume on Ring fr suspend */
126 #define APM_CAP_RESUME_STANDBY_PCMCIA	0x0040 /* Resume on PCMCIA Ring	*/
127 #define APM_CAP_RESUME_SUSPEND_PCMCIA	0x0080 /* Resume on PCMCIA Ring	*/
128 
129 /*
130  * ioctl operations
131  */
132 #include <linux/ioctl.h>
133 
134 #define APM_IOC_STANDBY		_IO('A', 1)
135 #define APM_IOC_SUSPEND		_IO('A', 2)
136 
137 #endif /* _UAPI_LINUX_APM_H */
138