added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / linux / acpi.h
1 /*
2  *  acpi.h - ACPI driver interface
3  *
4  *  Copyright (C) 1999 Andrew Henroid
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef _LINUX_ACPI_H
22 #define _LINUX_ACPI_H
23
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__ */
30
31 /*
32  * Device states
33  */
34 typedef enum {
35         ACPI_D0, /* fully-on */
36         ACPI_D1, /* partial-on */
37         ACPI_D2, /* partial-on */
38         ACPI_D3, /* fully-off */
39 } acpi_dstate_t;
40
41 typedef enum {
42         ACPI_S0, /* working state */
43         ACPI_S1, /* power-on suspend */
44         ACPI_S2, /* suspend to ram, with devices */
45         ACPI_S3, /* suspend to ram */
46         ACPI_S4, /* suspend to disk */
47         ACPI_S5, /* soft-off */
48 } acpi_sstate_t;
49
50 /* RSDP location */
51 #define ACPI_BIOS_ROM_BASE (0x0e0000)
52 #define ACPI_BIOS_ROM_END  (0x100000)
53
54 /* Table signatures */
55 #define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
56 #define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */
57 #define ACPI_RSDT_SIG  0x54445352 /* 'RSDT' */
58 #define ACPI_FADT_SIG  0x50434146 /* 'FACP' */
59 #define ACPI_DSDT_SIG  0x54445344 /* 'DSDT' */
60 #define ACPI_FACS_SIG  0x53434146 /* 'FACS' */
61
62 #define ACPI_SIG_LEN            4
63 #define ACPI_FADT_SIGNATURE     "FACP"
64
65 /* PM1_STS/EN flags */
66 #define ACPI_TMR    0x0001
67 #define ACPI_BM     0x0010
68 #define ACPI_GBL    0x0020
69 #define ACPI_PWRBTN 0x0100
70 #define ACPI_SLPBTN 0x0200
71 #define ACPI_RTC    0x0400
72 #define ACPI_WAK    0x8000
73
74 /* PM1_CNT flags */
75 #define ACPI_SCI_EN   0x0001
76 #define ACPI_BM_RLD   0x0002
77 #define ACPI_GBL_RLS  0x0004
78 #define ACPI_SLP_TYP0 0x0400
79 #define ACPI_SLP_TYP1 0x0800
80 #define ACPI_SLP_TYP2 0x1000
81 #define ACPI_SLP_EN   0x2000
82
83 #define ACPI_SLP_TYP_MASK  0x1c00
84 #define ACPI_SLP_TYP_SHIFT 10
85
86 /* PM_TMR masks */
87 #define ACPI_TMR_VAL_EXT 0x00000100
88 #define ACPI_TMR_MASK    0x00ffffff
89 #define ACPI_TMR_HZ      3579545 /* 3.58 MHz */
90 #define ACPI_TMR_KHZ     (ACPI_TMR_HZ / 1000)
91
92 #define ACPI_MICROSEC_TO_TMR_TICKS(val) \
93   (((val) * (ACPI_TMR_KHZ)) / 1000)
94
95 /* PM2_CNT flags */
96 #define ACPI_ARB_DIS 0x01
97
98 /* FADT flags */
99 #define ACPI_WBINVD       0x00000001
100 #define ACPI_WBINVD_FLUSH 0x00000002
101 #define ACPI_PROC_C1      0x00000004
102 #define ACPI_P_LVL2_UP    0x00000008
103 #define ACPI_PWR_BUTTON   0x00000010
104 #define ACPI_SLP_BUTTON   0x00000020
105 #define ACPI_FIX_RTC      0x00000040
106 #define ACPI_RTC_64       0x00000080
107 #define ACPI_TMR_VAL_EXT  0x00000100
108 #define ACPI_DCK_CAP      0x00000200
109
110 /* FADT BOOT_ARCH flags */
111 #define FADT_BOOT_ARCH_LEGACY_DEVICES   0x0001
112 #define FADT_BOOT_ARCH_KBD_CONTROLLER   0x0002
113
114 /* FACS flags */
115 #define ACPI_S4BIOS       0x00000001
116
117 /* processor block offsets */
118 #define ACPI_P_CNT        0x00000000
119 #define ACPI_P_LVL2       0x00000004
120 #define ACPI_P_LVL3       0x00000005
121
122 /* C-state latencies (microseconds) */
123 #define ACPI_MAX_P_LVL2_LAT 100
124 #define ACPI_MAX_P_LVL3_LAT 1000
125 #define ACPI_INFINITE_LAT   (~0UL)
126
127 /*
128  * Sysctl declarations
129  */
130
131 enum
132 {
133         CTL_ACPI = 10
134 };
135
136 enum
137 {
138         ACPI_FADT = 1,
139         ACPI_DSDT,
140         ACPI_PM1_ENABLE,
141         ACPI_GPE_ENABLE,
142         ACPI_GPE_LEVEL,
143         ACPI_EVENT,
144         ACPI_P_BLK,
145         ACPI_ENTER_LVL2_LAT,
146         ACPI_ENTER_LVL3_LAT,
147         ACPI_P_LVL2_LAT,
148         ACPI_P_LVL3_LAT,
149         ACPI_C1_TIME,
150         ACPI_C2_TIME,
151         ACPI_C3_TIME,
152         ACPI_C1_COUNT,
153         ACPI_C2_COUNT,
154         ACPI_C3_COUNT,
155         ACPI_S0_SLP_TYP,
156         ACPI_S1_SLP_TYP,
157         ACPI_S5_SLP_TYP,
158         ACPI_SLEEP,
159         ACPI_FACS,
160         ACPI_XSDT,
161         ACPI_PMTIMER,
162         ACPI_BATT,
163 };
164
165 #define ACPI_SLP_TYP_DISABLED   (~0UL)
166
167 #ifdef __KERNEL__
168
169 /* routines for saving/restoring kernel state */
170 FASTCALL(extern unsigned long acpi_save_state_mem(unsigned long return_point));
171 FASTCALL(extern int acpi_save_state_disk(unsigned long return_point));
172 extern void acpi_restore_state(void);
173
174 extern unsigned long acpi_wakeup_address;
175
176 #endif /* __KERNEL__ */
177
178 int acpi_init(void);
179
180 #endif /* _LINUX_ACPI_H */