aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/bus.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/bus.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r--drivers/acpi/bus.c310
1 files changed, 151 insertions, 159 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index d77c2307883c..6a4da417c16b 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -36,19 +36,17 @@
36#include <acpi/acpi_bus.h> 36#include <acpi/acpi_bus.h>
37#include <acpi/acpi_drivers.h> 37#include <acpi/acpi_drivers.h>
38 38
39
40#define _COMPONENT ACPI_BUS_COMPONENT 39#define _COMPONENT ACPI_BUS_COMPONENT
41ACPI_MODULE_NAME ("acpi_bus") 40ACPI_MODULE_NAME("acpi_bus")
42
43#ifdef CONFIG_X86 41#ifdef CONFIG_X86
44extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); 42extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
45#endif 43#endif
46 44
47FADT_DESCRIPTOR acpi_fadt; 45FADT_DESCRIPTOR acpi_fadt;
48EXPORT_SYMBOL(acpi_fadt); 46EXPORT_SYMBOL(acpi_fadt);
49 47
50struct acpi_device *acpi_root; 48struct acpi_device *acpi_root;
51struct proc_dir_entry *acpi_root_dir; 49struct proc_dir_entry *acpi_root_dir;
52EXPORT_SYMBOL(acpi_root_dir); 50EXPORT_SYMBOL(acpi_root_dir);
53 51
54#define STRUCT_TO_INT(s) (*((int*)&s)) 52#define STRUCT_TO_INT(s) (*((int*)&s))
@@ -57,12 +55,9 @@ EXPORT_SYMBOL(acpi_root_dir);
57 Device Management 55 Device Management
58 -------------------------------------------------------------------------- */ 56 -------------------------------------------------------------------------- */
59 57
60int 58int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
61acpi_bus_get_device (
62 acpi_handle handle,
63 struct acpi_device **device)
64{ 59{
65 acpi_status status = AE_OK; 60 acpi_status status = AE_OK;
66 61
67 ACPI_FUNCTION_TRACE("acpi_bus_get_device"); 62 ACPI_FUNCTION_TRACE("acpi_bus_get_device");
68 63
@@ -71,24 +66,23 @@ acpi_bus_get_device (
71 66
72 /* TBD: Support fixed-feature devices */ 67 /* TBD: Support fixed-feature devices */
73 68
74 status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device); 69 status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
75 if (ACPI_FAILURE(status) || !*device) { 70 if (ACPI_FAILURE(status) || !*device) {
76 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", 71 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
77 handle)); 72 handle));
78 return_VALUE(-ENODEV); 73 return_VALUE(-ENODEV);
79 } 74 }
80 75
81 return_VALUE(0); 76 return_VALUE(0);
82} 77}
78
83EXPORT_SYMBOL(acpi_bus_get_device); 79EXPORT_SYMBOL(acpi_bus_get_device);
84 80
85int 81int acpi_bus_get_status(struct acpi_device *device)
86acpi_bus_get_status (
87 struct acpi_device *device)
88{ 82{
89 acpi_status status = AE_OK; 83 acpi_status status = AE_OK;
90 unsigned long sta = 0; 84 unsigned long sta = 0;
91 85
92 ACPI_FUNCTION_TRACE("acpi_bus_get_status"); 86 ACPI_FUNCTION_TRACE("acpi_bus_get_status");
93 87
94 if (!device) 88 if (!device)
@@ -98,10 +92,11 @@ acpi_bus_get_status (
98 * Evaluate _STA if present. 92 * Evaluate _STA if present.
99 */ 93 */
100 if (device->flags.dynamic_status) { 94 if (device->flags.dynamic_status) {
101 status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); 95 status =
96 acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
102 if (ACPI_FAILURE(status)) 97 if (ACPI_FAILURE(status))
103 return_VALUE(-ENODEV); 98 return_VALUE(-ENODEV);
104 STRUCT_TO_INT(device->status) = (int) sta; 99 STRUCT_TO_INT(device->status) = (int)sta;
105 } 100 }
106 101
107 /* 102 /*
@@ -115,33 +110,30 @@ acpi_bus_get_status (
115 110
116 if (device->status.functional && !device->status.present) { 111 if (device->status.functional && !device->status.present) {
117 printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: " 112 printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
118 "functional but not present; setting present\n", 113 "functional but not present; setting present\n",
119 device->pnp.bus_id, 114 device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
120 (u32) STRUCT_TO_INT(device->status));
121 device->status.present = 1; 115 device->status.present = 1;
122 } 116 }
123 117
124 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 118 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
125 device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status))); 119 device->pnp.bus_id,
120 (u32) STRUCT_TO_INT(device->status)));
126 121
127 return_VALUE(0); 122 return_VALUE(0);
128} 123}
129EXPORT_SYMBOL(acpi_bus_get_status);
130 124
125EXPORT_SYMBOL(acpi_bus_get_status);
131 126
132/* -------------------------------------------------------------------------- 127/* --------------------------------------------------------------------------
133 Power Management 128 Power Management
134 -------------------------------------------------------------------------- */ 129 -------------------------------------------------------------------------- */
135 130
136int 131int acpi_bus_get_power(acpi_handle handle, int *state)
137acpi_bus_get_power (
138 acpi_handle handle,
139 int *state)
140{ 132{
141 int result = 0; 133 int result = 0;
142 acpi_status status = 0; 134 acpi_status status = 0;
143 struct acpi_device *device = NULL; 135 struct acpi_device *device = NULL;
144 unsigned long psc = 0; 136 unsigned long psc = 0;
145 137
146 ACPI_FUNCTION_TRACE("acpi_bus_get_power"); 138 ACPI_FUNCTION_TRACE("acpi_bus_get_power");
147 139
@@ -157,20 +149,18 @@ acpi_bus_get_power (
157 *state = device->parent->power.state; 149 *state = device->parent->power.state;
158 else 150 else
159 *state = ACPI_STATE_D0; 151 *state = ACPI_STATE_D0;
160 } 152 } else {
161 else {
162 /* 153 /*
163 * Get the device's power state either directly (via _PSC) or 154 * Get the device's power state either directly (via _PSC) or
164 * indirectly (via power resources). 155 * indirectly (via power resources).
165 */ 156 */
166 if (device->power.flags.explicit_get) { 157 if (device->power.flags.explicit_get) {
167 status = acpi_evaluate_integer(device->handle, "_PSC", 158 status = acpi_evaluate_integer(device->handle, "_PSC",
168 NULL, &psc); 159 NULL, &psc);
169 if (ACPI_FAILURE(status)) 160 if (ACPI_FAILURE(status))
170 return_VALUE(-ENODEV); 161 return_VALUE(-ENODEV);
171 device->power.state = (int) psc; 162 device->power.state = (int)psc;
172 } 163 } else if (device->power.flags.power_resources) {
173 else if (device->power.flags.power_resources) {
174 result = acpi_power_get_inferred_state(device); 164 result = acpi_power_get_inferred_state(device);
175 if (result) 165 if (result)
176 return_VALUE(result); 166 return_VALUE(result);
@@ -180,22 +170,19 @@ acpi_bus_get_power (
180 } 170 }
181 171
182 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", 172 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
183 device->pnp.bus_id, device->power.state)); 173 device->pnp.bus_id, device->power.state));
184 174
185 return_VALUE(0); 175 return_VALUE(0);
186} 176}
187EXPORT_SYMBOL(acpi_bus_get_power);
188 177
178EXPORT_SYMBOL(acpi_bus_get_power);
189 179
190int 180int acpi_bus_set_power(acpi_handle handle, int state)
191acpi_bus_set_power (
192 acpi_handle handle,
193 int state)
194{ 181{
195 int result = 0; 182 int result = 0;
196 acpi_status status = AE_OK; 183 acpi_status status = AE_OK;
197 struct acpi_device *device = NULL; 184 struct acpi_device *device = NULL;
198 char object_name[5] = {'_','P','S','0'+state,'\0'}; 185 char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
199 186
200 ACPI_FUNCTION_TRACE("acpi_bus_set_power"); 187 ACPI_FUNCTION_TRACE("acpi_bus_set_power");
201 188
@@ -209,7 +196,8 @@ acpi_bus_set_power (
209 /* Make sure this is a valid target state */ 196 /* Make sure this is a valid target state */
210 197
211 if (!device->flags.power_manageable) { 198 if (!device->flags.power_manageable) {
212 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); 199 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
200 "Device is not power manageable\n"));
213 return_VALUE(-ENODEV); 201 return_VALUE(-ENODEV);
214 } 202 }
215 /* 203 /*
@@ -219,15 +207,18 @@ acpi_bus_set_power (
219 if (device->power.state == ACPI_STATE_UNKNOWN) 207 if (device->power.state == ACPI_STATE_UNKNOWN)
220 acpi_bus_get_power(device->handle, &device->power.state); 208 acpi_bus_get_power(device->handle, &device->power.state);
221 if (state == device->power.state) { 209 if (state == device->power.state) {
222 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); 210 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
211 state));
223 return_VALUE(0); 212 return_VALUE(0);
224 } 213 }
225 if (!device->power.states[state].flags.valid) { 214 if (!device->power.states[state].flags.valid) {
226 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state)); 215 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n",
216 state));
227 return_VALUE(-ENODEV); 217 return_VALUE(-ENODEV);
228 } 218 }
229 if (device->parent && (state < device->parent->power.state)) { 219 if (device->parent && (state < device->parent->power.state)) {
230 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n")); 220 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
221 "Cannot set device to a higher-powered state than parent\n"));
231 return_VALUE(-ENODEV); 222 return_VALUE(-ENODEV);
232 } 223 }
233 224
@@ -245,18 +236,17 @@ acpi_bus_set_power (
245 goto end; 236 goto end;
246 } 237 }
247 if (device->power.states[state].flags.explicit_set) { 238 if (device->power.states[state].flags.explicit_set) {
248 status = acpi_evaluate_object(device->handle, 239 status = acpi_evaluate_object(device->handle,
249 object_name, NULL, NULL); 240 object_name, NULL, NULL);
250 if (ACPI_FAILURE(status)) { 241 if (ACPI_FAILURE(status)) {
251 result = -ENODEV; 242 result = -ENODEV;
252 goto end; 243 goto end;
253 } 244 }
254 } 245 }
255 } 246 } else {
256 else {
257 if (device->power.states[state].flags.explicit_set) { 247 if (device->power.states[state].flags.explicit_set) {
258 status = acpi_evaluate_object(device->handle, 248 status = acpi_evaluate_object(device->handle,
259 object_name, NULL, NULL); 249 object_name, NULL, NULL);
260 if (ACPI_FAILURE(status)) { 250 if (ACPI_FAILURE(status)) {
261 result = -ENODEV; 251 result = -ENODEV;
262 goto end; 252 goto end;
@@ -269,19 +259,20 @@ acpi_bus_set_power (
269 } 259 }
270 } 260 }
271 261
272end: 262 end:
273 if (result) 263 if (result)
274 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n", 264 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
275 device->pnp.bus_id, state)); 265 "Error transitioning device [%s] to D%d\n",
266 device->pnp.bus_id, state));
276 else 267 else
277 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", 268 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
278 device->pnp.bus_id, state)); 269 "Device [%s] transitioned to D%d\n",
270 device->pnp.bus_id, state));
279 271
280 return_VALUE(result); 272 return_VALUE(result);
281} 273}
282EXPORT_SYMBOL(acpi_bus_set_power);
283
284 274
275EXPORT_SYMBOL(acpi_bus_set_power);
285 276
286/* -------------------------------------------------------------------------- 277/* --------------------------------------------------------------------------
287 Event Management 278 Event Management
@@ -292,16 +283,12 @@ static DEFINE_SPINLOCK(acpi_bus_event_lock);
292LIST_HEAD(acpi_bus_event_list); 283LIST_HEAD(acpi_bus_event_list);
293DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue); 284DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
294 285
295extern int event_is_open; 286extern int event_is_open;
296 287
297int 288int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
298acpi_bus_generate_event (
299 struct acpi_device *device,
300 u8 type,
301 int data)
302{ 289{
303 struct acpi_bus_event *event = NULL; 290 struct acpi_bus_event *event = NULL;
304 unsigned long flags = 0; 291 unsigned long flags = 0;
305 292
306 ACPI_FUNCTION_TRACE("acpi_bus_generate_event"); 293 ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
307 294
@@ -329,14 +316,13 @@ acpi_bus_generate_event (
329 316
330 return_VALUE(0); 317 return_VALUE(0);
331} 318}
319
332EXPORT_SYMBOL(acpi_bus_generate_event); 320EXPORT_SYMBOL(acpi_bus_generate_event);
333 321
334int 322int acpi_bus_receive_event(struct acpi_bus_event *event)
335acpi_bus_receive_event (
336 struct acpi_bus_event *event)
337{ 323{
338 unsigned long flags = 0; 324 unsigned long flags = 0;
339 struct acpi_bus_event *entry = NULL; 325 struct acpi_bus_event *entry = NULL;
340 326
341 DECLARE_WAITQUEUE(wait, current); 327 DECLARE_WAITQUEUE(wait, current);
342 328
@@ -361,7 +347,8 @@ acpi_bus_receive_event (
361 } 347 }
362 348
363 spin_lock_irqsave(&acpi_bus_event_lock, flags); 349 spin_lock_irqsave(&acpi_bus_event_lock, flags);
364 entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node); 350 entry =
351 list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
365 if (entry) 352 if (entry)
366 list_del(&entry->node); 353 list_del(&entry->node);
367 spin_unlock_irqrestore(&acpi_bus_event_lock, flags); 354 spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
@@ -375,19 +362,17 @@ acpi_bus_receive_event (
375 362
376 return_VALUE(0); 363 return_VALUE(0);
377} 364}
378EXPORT_SYMBOL(acpi_bus_receive_event);
379 365
366EXPORT_SYMBOL(acpi_bus_receive_event);
380 367
381/* -------------------------------------------------------------------------- 368/* --------------------------------------------------------------------------
382 Notification Handling 369 Notification Handling
383 -------------------------------------------------------------------------- */ 370 -------------------------------------------------------------------------- */
384 371
385static int 372static int
386acpi_bus_check_device ( 373acpi_bus_check_device(struct acpi_device *device, int *status_changed)
387 struct acpi_device *device,
388 int *status_changed)
389{ 374{
390 acpi_status status = 0; 375 acpi_status status = 0;
391 struct acpi_device_status old_status; 376 struct acpi_device_status old_status;
392 377
393 ACPI_FUNCTION_TRACE("acpi_bus_check_device"); 378 ACPI_FUNCTION_TRACE("acpi_bus_check_device");
@@ -422,15 +407,14 @@ acpi_bus_check_device (
422 407
423 if (status_changed) 408 if (status_changed)
424 *status_changed = 1; 409 *status_changed = 1;
425 410
426 /* 411 /*
427 * Device Insertion/Removal 412 * Device Insertion/Removal
428 */ 413 */
429 if ((device->status.present) && !(old_status.present)) { 414 if ((device->status.present) && !(old_status.present)) {
430 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n")); 415 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
431 /* TBD: Handle device insertion */ 416 /* TBD: Handle device insertion */
432 } 417 } else if (!(device->status.present) && (old_status.present)) {
433 else if (!(device->status.present) && (old_status.present)) {
434 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n")); 418 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
435 /* TBD: Handle device removal */ 419 /* TBD: Handle device removal */
436 } 420 }
@@ -438,13 +422,10 @@ acpi_bus_check_device (
438 return_VALUE(0); 422 return_VALUE(0);
439} 423}
440 424
441 425static int acpi_bus_check_scope(struct acpi_device *device)
442static int
443acpi_bus_check_scope (
444 struct acpi_device *device)
445{ 426{
446 int result = 0; 427 int result = 0;
447 int status_changed = 0; 428 int status_changed = 0;
448 429
449 ACPI_FUNCTION_TRACE("acpi_bus_check_scope"); 430 ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
450 431
@@ -467,20 +448,15 @@ acpi_bus_check_scope (
467 return_VALUE(0); 448 return_VALUE(0);
468} 449}
469 450
470
471/** 451/**
472 * acpi_bus_notify 452 * acpi_bus_notify
473 * --------------- 453 * ---------------
474 * Callback for all 'system-level' device notifications (values 0x00-0x7F). 454 * Callback for all 'system-level' device notifications (values 0x00-0x7F).
475 */ 455 */
476static void 456static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
477acpi_bus_notify (
478 acpi_handle handle,
479 u32 type,
480 void *data)
481{ 457{
482 int result = 0; 458 int result = 0;
483 struct acpi_device *device = NULL; 459 struct acpi_device *device = NULL;
484 460
485 ACPI_FUNCTION_TRACE("acpi_bus_notify"); 461 ACPI_FUNCTION_TRACE("acpi_bus_notify");
486 462
@@ -490,64 +466,73 @@ acpi_bus_notify (
490 switch (type) { 466 switch (type) {
491 467
492 case ACPI_NOTIFY_BUS_CHECK: 468 case ACPI_NOTIFY_BUS_CHECK:
493 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n", 469 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
494 device->pnp.bus_id)); 470 "Received BUS CHECK notification for device [%s]\n",
471 device->pnp.bus_id));
495 result = acpi_bus_check_scope(device); 472 result = acpi_bus_check_scope(device);
496 /* 473 /*
497 * TBD: We'll need to outsource certain events to non-ACPI 474 * TBD: We'll need to outsource certain events to non-ACPI
498 * drivers via the device manager (device.c). 475 * drivers via the device manager (device.c).
499 */ 476 */
500 break; 477 break;
501 478
502 case ACPI_NOTIFY_DEVICE_CHECK: 479 case ACPI_NOTIFY_DEVICE_CHECK:
503 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n", 480 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
504 device->pnp.bus_id)); 481 "Received DEVICE CHECK notification for device [%s]\n",
482 device->pnp.bus_id));
505 result = acpi_bus_check_device(device, NULL); 483 result = acpi_bus_check_device(device, NULL);
506 /* 484 /*
507 * TBD: We'll need to outsource certain events to non-ACPI 485 * TBD: We'll need to outsource certain events to non-ACPI
508 * drivers via the device manager (device.c). 486 * drivers via the device manager (device.c).
509 */ 487 */
510 break; 488 break;
511 489
512 case ACPI_NOTIFY_DEVICE_WAKE: 490 case ACPI_NOTIFY_DEVICE_WAKE:
513 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n", 491 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
514 device->pnp.bus_id)); 492 "Received DEVICE WAKE notification for device [%s]\n",
493 device->pnp.bus_id));
515 /* TBD */ 494 /* TBD */
516 break; 495 break;
517 496
518 case ACPI_NOTIFY_EJECT_REQUEST: 497 case ACPI_NOTIFY_EJECT_REQUEST:
519 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n", 498 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
520 device->pnp.bus_id)); 499 "Received EJECT REQUEST notification for device [%s]\n",
500 device->pnp.bus_id));
521 /* TBD */ 501 /* TBD */
522 break; 502 break;
523 503
524 case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: 504 case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
525 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n", 505 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
526 device->pnp.bus_id)); 506 "Received DEVICE CHECK LIGHT notification for device [%s]\n",
507 device->pnp.bus_id));
527 /* TBD: Exactly what does 'light' mean? */ 508 /* TBD: Exactly what does 'light' mean? */
528 break; 509 break;
529 510
530 case ACPI_NOTIFY_FREQUENCY_MISMATCH: 511 case ACPI_NOTIFY_FREQUENCY_MISMATCH:
531 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n", 512 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
532 device->pnp.bus_id)); 513 "Received FREQUENCY MISMATCH notification for device [%s]\n",
514 device->pnp.bus_id));
533 /* TBD */ 515 /* TBD */
534 break; 516 break;
535 517
536 case ACPI_NOTIFY_BUS_MODE_MISMATCH: 518 case ACPI_NOTIFY_BUS_MODE_MISMATCH:
537 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n", 519 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
538 device->pnp.bus_id)); 520 "Received BUS MODE MISMATCH notification for device [%s]\n",
521 device->pnp.bus_id));
539 /* TBD */ 522 /* TBD */
540 break; 523 break;
541 524
542 case ACPI_NOTIFY_POWER_FAULT: 525 case ACPI_NOTIFY_POWER_FAULT:
543 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n", 526 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
544 device->pnp.bus_id)); 527 "Received POWER FAULT notification for device [%s]\n",
528 device->pnp.bus_id));
545 /* TBD */ 529 /* TBD */
546 break; 530 break;
547 531
548 default: 532 default:
549 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n", 533 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
550 type)); 534 "Received unknown/unsupported notification [%08x]\n",
535 type));
551 break; 536 break;
552 } 537 }
553 538
@@ -558,13 +543,12 @@ acpi_bus_notify (
558 Initialization/Cleanup 543 Initialization/Cleanup
559 -------------------------------------------------------------------------- */ 544 -------------------------------------------------------------------------- */
560 545
561static int __init 546static int __init acpi_bus_init_irq(void)
562acpi_bus_init_irq (void)
563{ 547{
564 acpi_status status = AE_OK; 548 acpi_status status = AE_OK;
565 union acpi_object arg = {ACPI_TYPE_INTEGER}; 549 union acpi_object arg = { ACPI_TYPE_INTEGER };
566 struct acpi_object_list arg_list = {1, &arg}; 550 struct acpi_object_list arg_list = { 1, &arg };
567 char *message = NULL; 551 char *message = NULL;
568 552
569 ACPI_FUNCTION_TRACE("acpi_bus_init_irq"); 553 ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
570 554
@@ -601,12 +585,10 @@ acpi_bus_init_irq (void)
601 return_VALUE(0); 585 return_VALUE(0);
602} 586}
603 587
604 588void __init acpi_early_init(void)
605void __init
606acpi_early_init (void)
607{ 589{
608 acpi_status status = AE_OK; 590 acpi_status status = AE_OK;
609 struct acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt}; 591 struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
610 592
611 ACPI_FUNCTION_TRACE("acpi_early_init"); 593 ACPI_FUNCTION_TRACE("acpi_early_init");
612 594
@@ -619,13 +601,15 @@ acpi_early_init (void)
619 601
620 status = acpi_initialize_subsystem(); 602 status = acpi_initialize_subsystem();
621 if (ACPI_FAILURE(status)) { 603 if (ACPI_FAILURE(status)) {
622 printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n"); 604 printk(KERN_ERR PREFIX
605 "Unable to initialize the ACPI Interpreter\n");
623 goto error0; 606 goto error0;
624 } 607 }
625 608
626 status = acpi_load_tables(); 609 status = acpi_load_tables();
627 if (ACPI_FAILURE(status)) { 610 if (ACPI_FAILURE(status)) {
628 printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n"); 611 printk(KERN_ERR PREFIX
612 "Unable to load the System Description Tables\n");
629 goto error0; 613 goto error0;
630 } 614 }
631 615
@@ -637,7 +621,6 @@ acpi_early_init (void)
637 printk(KERN_ERR PREFIX "Unable to get the FADT\n"); 621 printk(KERN_ERR PREFIX "Unable to get the FADT\n");
638 goto error0; 622 goto error0;
639 } 623 }
640
641#ifdef CONFIG_X86 624#ifdef CONFIG_X86
642 if (!acpi_ioapic) { 625 if (!acpi_ioapic) {
643 extern acpi_interrupt_flags acpi_sci_flags; 626 extern acpi_interrupt_flags acpi_sci_flags;
@@ -647,7 +630,8 @@ acpi_early_init (void)
647 acpi_sci_flags.trigger = 3; 630 acpi_sci_flags.trigger = 3;
648 631
649 /* Set PIC-mode SCI trigger type */ 632 /* Set PIC-mode SCI trigger type */
650 acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger); 633 acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
634 acpi_sci_flags.trigger);
651 } else { 635 } else {
652 extern int acpi_sci_override_gsi; 636 extern int acpi_sci_override_gsi;
653 /* 637 /*
@@ -658,7 +642,10 @@ acpi_early_init (void)
658 } 642 }
659#endif 643#endif
660 644
661 status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE)); 645 status =
646 acpi_enable_subsystem(~
647 (ACPI_NO_HARDWARE_INIT |
648 ACPI_NO_ACPI_ENABLE));
662 if (ACPI_FAILURE(status)) { 649 if (ACPI_FAILURE(status)) {
663 printk(KERN_ERR PREFIX "Unable to enable ACPI\n"); 650 printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
664 goto error0; 651 goto error0;
@@ -666,30 +653,32 @@ acpi_early_init (void)
666 653
667 return_VOID; 654 return_VOID;
668 655
669error0: 656 error0:
670 disable_acpi(); 657 disable_acpi();
671 return_VOID; 658 return_VOID;
672} 659}
673 660
674static int __init 661static int __init acpi_bus_init(void)
675acpi_bus_init (void)
676{ 662{
677 int result = 0; 663 int result = 0;
678 acpi_status status = AE_OK; 664 acpi_status status = AE_OK;
679 extern acpi_status acpi_os_initialize1(void); 665 extern acpi_status acpi_os_initialize1(void);
680 666
681 ACPI_FUNCTION_TRACE("acpi_bus_init"); 667 ACPI_FUNCTION_TRACE("acpi_bus_init");
682 668
683 status = acpi_os_initialize1(); 669 status = acpi_os_initialize1();
684 670
685 status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE); 671 status =
672 acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
686 if (ACPI_FAILURE(status)) { 673 if (ACPI_FAILURE(status)) {
687 printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n"); 674 printk(KERN_ERR PREFIX
675 "Unable to start the ACPI Interpreter\n");
688 goto error1; 676 goto error1;
689 } 677 }
690 678
691 if (ACPI_FAILURE(status)) { 679 if (ACPI_FAILURE(status)) {
692 printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n"); 680 printk(KERN_ERR PREFIX
681 "Unable to initialize ACPI OS objects\n");
693 goto error1; 682 goto error1;
694 } 683 }
695#ifdef CONFIG_ACPI_EC 684#ifdef CONFIG_ACPI_EC
@@ -723,9 +712,12 @@ acpi_bus_init (void)
723 /* 712 /*
724 * Register the for all standard device notifications. 713 * Register the for all standard device notifications.
725 */ 714 */
726 status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL); 715 status =
716 acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
717 &acpi_bus_notify, NULL);
727 if (ACPI_FAILURE(status)) { 718 if (ACPI_FAILURE(status)) {
728 printk(KERN_ERR PREFIX "Unable to register for device notifications\n"); 719 printk(KERN_ERR PREFIX
720 "Unable to register for device notifications\n");
729 goto error1; 721 goto error1;
730 } 722 }
731 723
@@ -737,21 +729,20 @@ acpi_bus_init (void)
737 return_VALUE(0); 729 return_VALUE(0);
738 730
739 /* Mimic structured exception handling */ 731 /* Mimic structured exception handling */
740error1: 732 error1:
741 acpi_terminate(); 733 acpi_terminate();
742 return_VALUE(-ENODEV); 734 return_VALUE(-ENODEV);
743} 735}
744 736
745decl_subsys(acpi,NULL,NULL); 737decl_subsys(acpi, NULL, NULL);
746 738
747static int __init acpi_init (void) 739static int __init acpi_init(void)
748{ 740{
749 int result = 0; 741 int result = 0;
750 742
751 ACPI_FUNCTION_TRACE("acpi_init"); 743 ACPI_FUNCTION_TRACE("acpi_init");
752 744
753 printk(KERN_INFO PREFIX "Subsystem revision %08x\n", 745 printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
754 ACPI_CA_VERSION);
755 746
756 if (acpi_disabled) { 747 if (acpi_disabled) {
757 printk(KERN_INFO PREFIX "Interpreter disabled.\n"); 748 printk(KERN_INFO PREFIX "Interpreter disabled.\n");
@@ -767,7 +758,8 @@ static int __init acpi_init (void)
767 if (!PM_IS_ACTIVE()) 758 if (!PM_IS_ACTIVE())
768 pm_active = 1; 759 pm_active = 1;
769 else { 760 else {
770 printk(KERN_INFO PREFIX "APM is already active, exiting\n"); 761 printk(KERN_INFO PREFIX
762 "APM is already active, exiting\n");
771 disable_acpi(); 763 disable_acpi();
772 result = -ENODEV; 764 result = -ENODEV;
773 } 765 }