- Stephen Rothwell: APM updates
[davej-history.git] / include / linux / acpi.h
blob7a045f0339e9ffb3314e7a03c0f943d1fa3b1ca6
1 /*
2 * acpi.h - ACPI driver interface
4 * Copyright (C) 1999 Andrew Henroid
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _LINUX_ACPI_H
22 #define _LINUX_ACPI_H
24 #include <linux/types.h>
25 #include <linux/ioctl.h>
26 #ifdef __KERNEL__
27 #include <linux/sched.h>
28 #include <linux/wait.h>
29 #endif /* __KERNEL__ */
32 * System sleep states
34 enum
36 ACPI_S0, /* working */
37 ACPI_S1, /* sleep */
38 ACPI_S2, /* sleep */
39 ACPI_S3, /* sleep */
40 ACPI_S4, /* non-volatile sleep */
41 ACPI_S5, /* soft-off */
44 typedef int acpi_sstate_t;
47 * Device states
49 enum
51 ACPI_D0, /* fully-on */
52 ACPI_D1, /* partial-on */
53 ACPI_D2, /* partial-on */
54 ACPI_D3, /* fully-off */
57 typedef int acpi_dstate_t;
59 /* RSDP location */
60 #define ACPI_BIOS_ROM_BASE (0x0e0000)
61 #define ACPI_BIOS_ROM_END (0x100000)
63 /* Table signatures */
64 #define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
65 #define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */
66 #define ACPI_RSDT_SIG 0x54445352 /* 'RSDT' */
67 #define ACPI_FACP_SIG 0x50434146 /* 'FACP' */
68 #define ACPI_DSDT_SIG 0x54445344 /* 'DSDT' */
69 #define ACPI_FACS_SIG 0x53434146 /* 'FACS' */
71 /* PM1_STS/EN flags */
72 #define ACPI_TMR 0x0001
73 #define ACPI_BM 0x0010
74 #define ACPI_GBL 0x0020
75 #define ACPI_PWRBTN 0x0100
76 #define ACPI_SLPBTN 0x0200
77 #define ACPI_RTC 0x0400
78 #define ACPI_WAK 0x8000
80 /* PM1_CNT flags */
81 #define ACPI_SCI_EN 0x0001
82 #define ACPI_BM_RLD 0x0002
83 #define ACPI_GBL_RLS 0x0004
84 #define ACPI_SLP_TYP0 0x0400
85 #define ACPI_SLP_TYP1 0x0800
86 #define ACPI_SLP_TYP2 0x1000
87 #define ACPI_SLP_EN 0x2000
89 #define ACPI_SLP_TYP_MASK 0x1c00
90 #define ACPI_SLP_TYP_SHIFT 10
92 /* PM_TMR masks */
93 #define ACPI_TMR_MASK 0x00ffffff
94 #define ACPI_TMR_HZ 3580000 /* 3.58 MHz */
96 /* strangess to avoid integer overflow */
97 #define ACPI_uS_TO_TMR_TICKS(val) \
98 (((val) * (ACPI_TMR_HZ / 10000)) / 100)
99 #define ACPI_TMR_TICKS_TO_uS(ticks) \
100 (((ticks) * 100) / (ACPI_TMR_HZ / 10000))
102 /* PM2_CNT flags */
103 #define ACPI_ARB_DIS 0x01
105 /* FACP flags */
106 #define ACPI_WBINVD 0x00000001
107 #define ACPI_WBINVD_FLUSH 0x00000002
108 #define ACPI_PROC_C1 0x00000004
109 #define ACPI_P_LVL2_UP 0x00000008
110 #define ACPI_PWR_BUTTON 0x00000010
111 #define ACPI_SLP_BUTTON 0x00000020
112 #define ACPI_FIX_RTC 0x00000040
113 #define ACPI_RTC_64 0x00000080
114 #define ACPI_TMR_VAL_EXT 0x00000100
115 #define ACPI_DCK_CAP 0x00000200
117 /* FACP BOOT_ARCH flags */
118 #define FACP_BOOT_ARCH_LEGACY_DEVICES 0x0001
119 #define FACP_BOOT_ARCH_KBD_CONTROLLER 0x0002
121 /* FACS flags */
122 #define ACPI_S4BIOS 0x00000001
124 /* processor block offsets */
125 #define ACPI_P_CNT 0x00000000
126 #define ACPI_P_LVL2 0x00000004
127 #define ACPI_P_LVL3 0x00000005
129 /* C-state latencies (microseconds) */
130 #define ACPI_MAX_P_LVL2_LAT 100
131 #define ACPI_MAX_P_LVL3_LAT 1000
132 #define ACPI_INFINITE_LAT (~0UL)
134 struct acpi_rsdp {
135 __u32 signature[2];
136 __u8 checksum;
137 __u8 oem[6];
138 __u8 reserved;
139 __u32 rsdt;
140 } __attribute__ ((packed));
142 struct acpi_table {
143 __u32 signature;
144 __u32 length;
145 __u8 rev;
146 __u8 checksum;
147 __u8 oem[6];
148 __u8 oem_table[8];
149 __u32 oem_rev;
150 __u32 creator;
151 __u32 creator_rev;
152 } __attribute__ ((packed));
154 struct acpi_facp {
155 struct acpi_table hdr;
156 __u32 facs;
157 __u32 dsdt;
158 __u8 int_model;
159 __u8 reserved;
160 __u16 sci_int;
161 __u32 smi_cmd;
162 __u8 acpi_enable;
163 __u8 acpi_disable;
164 __u8 s4bios_req;
165 __u8 reserved2;
166 __u32 pm1a_evt;
167 __u32 pm1b_evt;
168 __u32 pm1a_cnt;
169 __u32 pm1b_cnt;
170 __u32 pm2_cnt;
171 __u32 pm_tmr;
172 __u32 gpe0;
173 __u32 gpe1;
174 __u8 pm1_evt_len;
175 __u8 pm1_cnt_len;
176 __u8 pm2_cnt_len;
177 __u8 pm_tm_len;
178 __u8 gpe0_len;
179 __u8 gpe1_len;
180 __u8 gpe1_base;
181 __u8 reserved3;
182 __u16 p_lvl2_lat;
183 __u16 p_lvl3_lat;
184 __u16 flush_size;
185 __u16 flush_stride;
186 __u8 duty_offset;
187 __u8 duty_width;
188 __u8 day_alarm;
189 __u8 mon_alarm;
190 __u8 century;
191 __u16 boot_arch;
192 __u8 reserved6;
193 __u32 flags;
194 } __attribute__ ((packed));
196 struct acpi_facs {
197 __u32 signature;
198 __u32 length;
199 __u32 hw_signature;
200 __u32 fw_wake_vector;
201 __u32 global_lock;
202 __u32 flags;
203 } __attribute__ ((packed));
206 * Sysctl declarations
209 enum
211 CTL_ACPI = 10
214 enum
216 ACPI_FACP = 1,
217 ACPI_DSDT,
218 ACPI_FACS,
219 ACPI_PM1_ENABLE,
220 ACPI_GPE_ENABLE,
221 ACPI_GPE_LEVEL,
222 ACPI_EVENT,
223 ACPI_P_BLK,
224 ACPI_ENTER_LVL2_LAT,
225 ACPI_ENTER_LVL3_LAT,
226 ACPI_P_LVL2_LAT,
227 ACPI_P_LVL3_LAT,
228 ACPI_C1_TIME,
229 ACPI_C2_TIME,
230 ACPI_C3_TIME,
231 ACPI_S0_SLP_TYP,
232 ACPI_S1_SLP_TYP,
233 ACPI_S5_SLP_TYP,
234 ACPI_SLEEP,
237 #define ACPI_SLP_TYP_DISABLED (~0UL)
240 * PIIX4-specific ACPI info (for systems with PIIX4 but no ACPI tables)
243 #define ACPI_PIIX4_INT_MODEL 0x00
244 #define ACPI_PIIX4_SCI_INT 0x0009
246 #define ACPI_PIIX4_SMI_CMD 0x00b2
247 #define ACPI_PIIX4_ACPI_ENABLE 0xf0
248 #define ACPI_PIIX4_ACPI_DISABLE 0xf1
249 #define ACPI_PIIX4_S4BIOS_REQ 0xf2
251 #define ACPI_PIIX4_PM1_EVT 0x0000
252 #define ACPI_PIIX4_PM1_CNT 0x0004
253 #define ACPI_PIIX4_S0_MASK (0x0005 << 10)
254 #define ACPI_PIIX4_S1_MASK (0x0004 << 10)
255 #define ACPI_PIIX4_S2_MASK (0x0003 << 10)
256 #define ACPI_PIIX4_S3_MASK (0x0002 << 10)
257 #define ACPI_PIIX4_S4_MASK (0x0001 << 10)
258 #define ACPI_PIIX4_S5_MASK (0x0000 << 10)
259 #define ACPI_PIIX4_PM_TMR 0x0008
260 #define ACPI_PIIX4_GPE0 0x000c
261 #define ACPI_PIIX4_P_BLK 0x0010
263 #define ACPI_PIIX4_PM1_EVT_LEN 0x04
264 #define ACPI_PIIX4_PM1_CNT_LEN 0x02
265 #define ACPI_PIIX4_PM_TM_LEN 0x04
266 #define ACPI_PIIX4_GPE0_LEN 0x04
268 #define ACPI_PIIX4_PM2_CNT 0x0022
269 #define ACPI_PIIX4_PM2_CNT_LEN 0x01
271 #define ACPI_PIIX4_PMREGMISC 0x80
272 #define ACPI_PIIX4_PMIOSE 0x01
275 * VIA-specific ACPI info (for systems with VT82C586B but no ACPI tables)
278 #define ACPI_VIA_INT_MODEL 0x00
280 #define ACPI_VIA_SMI_CMD 0x002f
281 #define ACPI_VIA_ACPI_ENABLE 0xa1
282 #define ACPI_VIA_ACPI_DISABLE 0xa0
284 #define ACPI_VIA_PM1_EVT 0x0000
285 #define ACPI_VIA_PM1_CNT 0x0004
286 #define ACPI_VIA_PM_TMR 0x0008
287 #define ACPI_VIA_GPE0 0x0020
288 #define ACPI_VIA_P_BLK 0x0010
290 #define ACPI_VIA_PM1_EVT_LEN 0x04
291 #define ACPI_VIA_PM1_CNT_LEN 0x02
292 #define ACPI_VIA_PM_TM_LEN 0x04
293 #define ACPI_VIA_GPE0_LEN 0x04
295 #define ACPI_VIA_DUTY_OFFSET 1
296 #define ACPI_VIA_DUTY_WIDTH 3
298 #define ACPI_VIA_DAY_ALARM 0x7d
299 #define ACPI_VIA_MON_ALARM 0x7e
300 #define ACPI_VIA_CENTURY 0x7f
302 #endif /* _LINUX_ACPI_H */