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