1 /*
2 * acpi_drivers.h ($Revision: 32 $)
3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 */
25
26 #ifndef __ACPI_DRIVERS_H__
27 #define __ACPI_DRIVERS_H__
28
29 #include <linux/acpi.h>
30 #include "acpi_bus.h"
31
32
33 #define ACPI_MAX_STRING 80
34
35
36 /* --------------------------------------------------------------------------
37 ACPI Bus
38 -------------------------------------------------------------------------- */
39
40 #define ACPI_BUS_COMPONENT 0x00010000
41 #define ACPI_BUS_CLASS "system_bus"
42 #define ACPI_BUS_HID "ACPI_BUS"
43 #define ACPI_BUS_DRIVER_NAME "ACPI Bus Driver"
44 #define ACPI_BUS_DEVICE_NAME "System Bus"
45
46
47 /* --------------------------------------------------------------------------
48 AC Adapter
49 -------------------------------------------------------------------------- */
50
51 #define ACPI_AC_COMPONENT 0x00020000
52 #define ACPI_AC_CLASS "ac_adapter"
53 #define ACPI_AC_HID "ACPI0003"
54 #define ACPI_AC_DRIVER_NAME "ACPI AC Adapter Driver"
55 #define ACPI_AC_DEVICE_NAME "AC Adapter"
56 #define ACPI_AC_FILE_STATE "state"
57 #define ACPI_AC_NOTIFY_STATUS 0x80
58 #define ACPI_AC_STATUS_OFFLINE 0x00
59 #define ACPI_AC_STATUS_ONLINE 0x01
60 #define ACPI_AC_STATUS_UNKNOWN 0xFF
61
62
63 /* --------------------------------------------------------------------------
64 Battery
65 -------------------------------------------------------------------------- */
66
67 #define ACPI_BATTERY_COMPONENT 0x00040000
68 #define ACPI_BATTERY_CLASS "battery"
69 #define ACPI_BATTERY_HID "PNP0C0A"
70 #define ACPI_BATTERY_DRIVER_NAME "ACPI Battery Driver"
71 #define ACPI_BATTERY_DEVICE_NAME "Battery"
72 #define ACPI_BATTERY_FILE_INFO "info"
73 #define ACPI_BATTERY_FILE_STATUS "state"
74 #define ACPI_BATTERY_FILE_ALARM "alarm"
75 #define ACPI_BATTERY_NOTIFY_STATUS 0x80
76 #define ACPI_BATTERY_NOTIFY_INFO 0x81
77 #define ACPI_BATTERY_UNITS_WATTS "mW"
78 #define ACPI_BATTERY_UNITS_AMPS "mA"
79
80
81 /* --------------------------------------------------------------------------
82 Button
83 -------------------------------------------------------------------------- */
84
85 #define ACPI_BUTTON_COMPONENT 0x00080000
86 #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
87 #define ACPI_BUTTON_CLASS "button"
88 #define ACPI_BUTTON_FILE_INFO "info"
89 #define ACPI_BUTTON_FILE_STATE "state"
90 #define ACPI_BUTTON_TYPE_UNKNOWN 0x00
91 #define ACPI_BUTTON_NOTIFY_STATUS 0x80
92
93 #define ACPI_BUTTON_SUBCLASS_POWER "power"
94 #define ACPI_BUTTON_HID_POWER "PNP0C0C"
95 #define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
96 #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
97 #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
98 #define ACPI_BUTTON_TYPE_POWER 0x01
99 #define ACPI_BUTTON_TYPE_POWERF 0x02
100
101 #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep"
102 #define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
103 #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"
104 #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)"
105 #define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)"
106 #define ACPI_BUTTON_TYPE_SLEEP 0x03
107 #define ACPI_BUTTON_TYPE_SLEEPF 0x04
108
109 #define ACPI_BUTTON_SUBCLASS_LID "lid"
110 #define ACPI_BUTTON_HID_LID "PNP0C0D"
111 #define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
112 #define ACPI_BUTTON_TYPE_LID 0x05
113
114
115 /* --------------------------------------------------------------------------
116 Embedded Controller
117 -------------------------------------------------------------------------- */
118
119 #define ACPI_EC_COMPONENT 0x00100000
120 #define ACPI_EC_CLASS "embedded_controller"
121 #define ACPI_EC_HID "PNP0C09"
122 #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver"
123 #define ACPI_EC_DEVICE_NAME "Embedded Controller"
124 #define ACPI_EC_FILE_INFO "info"
125
126 #ifdef CONFIG_ACPI_EC
127
128 int acpi_ec_ecdt_probe (void);
129 int acpi_ec_init (void);
130 void acpi_ec_exit (void);
131
132 #endif
133
134
135 /* --------------------------------------------------------------------------
136 Fan
137 -------------------------------------------------------------------------- */
138
139 #define ACPI_FAN_COMPONENT 0x00200000
140 #define ACPI_FAN_CLASS "fan"
141 #define ACPI_FAN_HID "PNP0C0B"
142 #define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver"
143 #define ACPI_FAN_DEVICE_NAME "Fan"
144 #define ACPI_FAN_FILE_STATE "state"
145 #define ACPI_FAN_NOTIFY_STATUS 0x80
146
147
148 /* --------------------------------------------------------------------------
149 PCI
150 -------------------------------------------------------------------------- */
151
152 #ifdef CONFIG_ACPI_PCI
153
154 #define ACPI_PCI_COMPONENT 0x00400000
155
156 /* ACPI PCI Root Bridge (pci_root.c) */
157
158 #define ACPI_PCI_ROOT_CLASS "pci_bridge"
159 #define ACPI_PCI_ROOT_HID "PNP0A03"
160 #define ACPI_PCI_ROOT_DRIVER_NAME "ACPI PCI Root Bridge Driver"
161 #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
162
163 int acpi_pci_root_init (void);
164 void acpi_pci_root_exit (void);
165
166 /* ACPI PCI Interrupt Link (pci_link.c) */
167
168 #define ACPI_PCI_LINK_CLASS "pci_irq_routing"
169 #define ACPI_PCI_LINK_HID "PNP0C0F"
170 #define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver"
171 #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
172 #define ACPI_PCI_LINK_FILE_INFO "info"
173 #define ACPI_PCI_LINK_FILE_STATUS "state"
174
175 int acpi_pci_link_check (void);
176 int acpi_pci_link_get_irq (acpi_handle handle, int index, int* edge_level, int* active_high_low);
177 int acpi_pci_link_init (void);
178 void acpi_pci_link_exit (void);
179
180 /* ACPI PCI Interrupt Routing (pci_irq.c) */
181
182 int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
183
184 /* ACPI PCI Device Binding (pci_bind.c) */
185
186 struct pci_bus;
187
188 int acpi_pci_bind (struct acpi_device *device);
189 int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus);
190
191 #endif /*CONFIG_ACPI_PCI*/
192
193
194 /* --------------------------------------------------------------------------
195 Power Resource
196 -------------------------------------------------------------------------- */
197
198 #define ACPI_POWER_COMPONENT 0x00800000
199 #define ACPI_POWER_CLASS "power_resource"
200 #define ACPI_POWER_HID "ACPI_PWR"
201 #define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver"
202 #define ACPI_POWER_DEVICE_NAME "Power Resource"
203 #define ACPI_POWER_FILE_INFO "info"
204 #define ACPI_POWER_FILE_STATUS "state"
205 #define ACPI_POWER_RESOURCE_STATE_OFF 0x00
206 #define ACPI_POWER_RESOURCE_STATE_ON 0x01
207 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
208
209 #ifdef CONFIG_ACPI_POWER
210
211 int acpi_power_get_inferred_state (struct acpi_device *device);
212 int acpi_power_transition (struct acpi_device *device, int state);
213 int acpi_power_init (void);
214 void acpi_power_exit (void);
215
216 #endif
217
218
219 /* --------------------------------------------------------------------------
220 Processor
221 -------------------------------------------------------------------------- */
222
223 #define ACPI_PROCESSOR_COMPONENT 0x01000000
224 #define ACPI_PROCESSOR_CLASS "processor"
225 #define ACPI_PROCESSOR_HID "ACPI_CPU"
226 #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver"
227 #define ACPI_PROCESSOR_DEVICE_NAME "Processor"
228 #define ACPI_PROCESSOR_FILE_INFO "info"
229 #define ACPI_PROCESSOR_FILE_POWER "power"
230 #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
231 #define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
232 #define ACPI_PROCESSOR_FILE_LIMIT "limit"
233 #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
234 #define ACPI_PROCESSOR_NOTIFY_POWER 0x81
235 #define ACPI_PROCESSOR_LIMIT_NONE 0x00
236 #define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
237 #define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
238
239 int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
240
241
242 /* --------------------------------------------------------------------------
243 System
244 -------------------------------------------------------------------------- */
245
246 #define ACPI_SYSTEM_COMPONENT 0x02000000
247 #define ACPI_SYSTEM_CLASS "system"
248 #define ACPI_SYSTEM_HID "ACPI_SYS"
249 #define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver"
250 #define ACPI_SYSTEM_DEVICE_NAME "System"
251 #define ACPI_SYSTEM_FILE_INFO "info"
252 #define ACPI_SYSTEM_FILE_EVENT "event"
253 #define ACPI_SYSTEM_FILE_ALARM "alarm"
254 #define ACPI_SYSTEM_FILE_DSDT "dsdt"
255 #define ACPI_SYSTEM_FILE_FADT "fadt"
256 #define ACPI_SYSTEM_FILE_SLEEP "sleep"
257 #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
258 #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
259
260 #ifdef CONFIG_ACPI_SYSTEM
261
262 int acpi_system_init (void);
263 void acpi_system_exit (void);
264
265 #endif
266
267
268 /* --------------------------------------------------------------------------
269 Thermal Zone
270 -------------------------------------------------------------------------- */
271
272 #define ACPI_THERMAL_COMPONENT 0x04000000
273 #define ACPI_THERMAL_CLASS "thermal_zone"
274 #define ACPI_THERMAL_HID "ACPI_THM"
275 #define ACPI_THERMAL_DRIVER_NAME "ACPI Thermal Zone Driver"
276 #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
277 #define ACPI_THERMAL_FILE_STATE "state"
278 #define ACPI_THERMAL_FILE_TEMPERATURE "temperature"
279 #define ACPI_THERMAL_FILE_TRIP_POINTS "trip_points"
280 #define ACPI_THERMAL_FILE_COOLING_MODE "cooling_mode"
281 #define ACPI_THERMAL_FILE_POLLING_FREQ "polling_frequency"
282 #define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80
283 #define ACPI_THERMAL_NOTIFY_THRESHOLDS 0x81
284 #define ACPI_THERMAL_NOTIFY_DEVICES 0x82
285 #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0
286 #define ACPI_THERMAL_NOTIFY_HOT 0xF1
287 #define ACPI_THERMAL_MODE_ACTIVE 0x00
288 #define ACPI_THERMAL_MODE_PASSIVE 0x01
289 #define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff"
290
291 /* Motherboard devices */
292 int acpi_motherboard_init(void);
293 /* --------------------------------------------------------------------------
294 Debug Support
295 -------------------------------------------------------------------------- */
296
297 #define ACPI_DEBUG_RESTORE 0
298 #define ACPI_DEBUG_LOW 1
299 #define ACPI_DEBUG_MEDIUM 2
300 #define ACPI_DEBUG_HIGH 3
301 #define ACPI_DEBUG_DRIVERS 4
302
303 extern u32 acpi_dbg_level;
304 extern u32 acpi_dbg_layer;
305
306 static inline void
acpi_set_debug(u32 flag)307 acpi_set_debug (
308 u32 flag)
309 {
310 static u32 layer_save;
311 static u32 level_save;
312
313 switch (flag) {
314 case ACPI_DEBUG_RESTORE:
315 acpi_dbg_layer = layer_save;
316 acpi_dbg_level = level_save;
317 break;
318 case ACPI_DEBUG_LOW:
319 case ACPI_DEBUG_MEDIUM:
320 case ACPI_DEBUG_HIGH:
321 case ACPI_DEBUG_DRIVERS:
322 layer_save = acpi_dbg_layer;
323 level_save = acpi_dbg_level;
324 break;
325 }
326
327 switch (flag) {
328 case ACPI_DEBUG_LOW:
329 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
330 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
331 break;
332 case ACPI_DEBUG_MEDIUM:
333 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
334 acpi_dbg_level = ACPI_LV_FUNCTIONS | ACPI_LV_ALL_EXCEPTIONS;
335 break;
336 case ACPI_DEBUG_HIGH:
337 acpi_dbg_layer = 0xFFFFFFFF;
338 acpi_dbg_level = 0xFFFFFFFF;
339 break;
340 case ACPI_DEBUG_DRIVERS:
341 acpi_dbg_layer = ACPI_ALL_DRIVERS;
342 acpi_dbg_level = 0xFFFFFFFF;
343 break;
344 }
345 }
346
347
348 #endif /*__ACPI_DRIVERS_H__*/
349