aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/hwsleep.c43
-rw-r--r--drivers/acpi/acpica/rscreate.c27
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/ec.c1
-rw-r--r--drivers/acpi/osl.c4
-rw-r--r--drivers/acpi/processor_idle.c19
-rw-r--r--drivers/acpi/sleep.c35
-rw-r--r--drivers/acpi/system.c11
-rw-r--r--drivers/acpi/thermal.c2
-rw-r--r--drivers/acpi/video.c8
10 files changed, 85 insertions, 67 deletions
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index baa5fc05e124..db307a356f08 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
211 211
212ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 212ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
213 213
214static unsigned int gts, bfs;
215module_param(gts, uint, 0644);
216module_param(bfs, uint, 0644);
217MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
218MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
219
214/******************************************************************************* 220/*******************************************************************************
215 * 221 *
216 * FUNCTION: acpi_enter_sleep_state 222 * FUNCTION: acpi_enter_sleep_state
@@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
278 return_ACPI_STATUS(status); 284 return_ACPI_STATUS(status);
279 } 285 }
280 286
281 /* Execute the _GTS method */ 287 if (gts) {
288 /* Execute the _GTS method */
282 289
283 arg_list.count = 1; 290 arg_list.count = 1;
284 arg_list.pointer = &arg; 291 arg_list.pointer = &arg;
285 arg.type = ACPI_TYPE_INTEGER; 292 arg.type = ACPI_TYPE_INTEGER;
286 arg.integer.value = sleep_state; 293 arg.integer.value = sleep_state;
287 294
288 status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); 295 status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
289 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 296 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
290 return_ACPI_STATUS(status); 297 return_ACPI_STATUS(status);
298 }
291 } 299 }
292 300
293 /* Get current value of PM1A control */ 301 /* Get current value of PM1A control */
@@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
513 } 521 }
514 } 522 }
515 523
516 /* Execute the _BFS method */ 524 if (bfs) {
525 /* Execute the _BFS method */
517 526
518 arg_list.count = 1; 527 arg_list.count = 1;
519 arg_list.pointer = &arg; 528 arg_list.pointer = &arg;
520 arg.type = ACPI_TYPE_INTEGER; 529 arg.type = ACPI_TYPE_INTEGER;
521 arg.integer.value = sleep_state; 530 arg.integer.value = sleep_state;
522 531
523 status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); 532 status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
524 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 533 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
525 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); 534 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
535 }
526 } 536 }
527
528 return_ACPI_STATUS(status); 537 return_ACPI_STATUS(status);
529} 538}
530 539
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 663f692fffcf..a3c23d686d5f 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
192 192
193 for (index = 0; index < number_of_elements; index++) { 193 for (index = 0; index < number_of_elements; index++) {
194 int source_name_index = 2;
195 int source_index_index = 3;
196 194
197 /* 195 /*
198 * Point user_prt past this current structure 196 * Point user_prt past this current structure
@@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
261 return_ACPI_STATUS(AE_BAD_DATA); 259 return_ACPI_STATUS(AE_BAD_DATA);
262 } 260 }
263 261
264 /*
265 * If BIOS erroneously reversed the _PRT source_name and source_index,
266 * then reverse them back.
267 */
268 if ((sub_object_list[3])->common.type !=
269 ACPI_TYPE_INTEGER) {
270 if (acpi_gbl_enable_interpreter_slack) {
271 source_name_index = 3;
272 source_index_index = 2;
273 printk(KERN_WARNING
274 "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,
277 "(PRT[%X].source_index) Need Integer, found %s",
278 index,
279 acpi_ut_get_object_type_name
280 (sub_object_list[3])));
281 return_ACPI_STATUS(AE_BAD_DATA);
282 }
283 }
284
285 user_prt->pin = (u32) obj_desc->integer.value; 262 user_prt->pin = (u32) obj_desc->integer.value;
286 263
287 /* 264 /*
@@ -304,7 +281,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
304 * 3) Third subobject: Dereference the PRT.source_name 281 * 3) Third subobject: Dereference the PRT.source_name
305 * The name may be unresolved (slack mode), so allow a null object 282 * The name may be unresolved (slack mode), so allow a null object
306 */ 283 */
307 obj_desc = sub_object_list[source_name_index]; 284 obj_desc = sub_object_list[2];
308 if (obj_desc) { 285 if (obj_desc) {
309 switch (obj_desc->common.type) { 286 switch (obj_desc->common.type) {
310 case ACPI_TYPE_LOCAL_REFERENCE: 287 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -378,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
378 355
379 /* 4) Fourth subobject: Dereference the PRT.source_index */ 356 /* 4) Fourth subobject: Dereference the PRT.source_index */
380 357
381 obj_desc = sub_object_list[source_index_index]; 358 obj_desc = sub_object_list[3];
382 if (obj_desc->common.type != ACPI_TYPE_INTEGER) { 359 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
383 ACPI_ERROR((AE_INFO, 360 ACPI_ERROR((AE_INFO,
384 "(PRT[%X].SourceIndex) Need Integer, found %s", 361 "(PRT[%X].SourceIndex) Need Integer, found %s",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 3c7d8942f23b..b0de6312919a 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
903 }, 903 },
904}; 904};
905 905
906static void acpi_battery_init_async(void *unused, async_cookie_t cookie) 906static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
907{ 907{
908 if (acpi_disabled) 908 if (acpi_disabled)
909 return; 909 return;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 04e90443eff7..391f331674c7 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device)
1065 struct acpi_ec *ec = acpi_driver_data(device); 1065 struct acpi_ec *ec = acpi_driver_data(device);
1066 /* Enable use of GPE back */ 1066 /* Enable use of GPE back */
1067 clear_bit(EC_FLAGS_NO_GPE, &ec->flags); 1067 clear_bit(EC_FLAGS_NO_GPE, &ec->flags);
1068 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
1068 acpi_enable_gpe(NULL, ec->gpe); 1069 acpi_enable_gpe(NULL, ec->gpe);
1069 return 0; 1070 return 0;
1070} 1071}
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index d59f08ecaf16..d916bea729f1 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -353,8 +353,10 @@ static irqreturn_t acpi_irq(int irq, void *dev_id)
353 if (handled) { 353 if (handled) {
354 acpi_irq_handled++; 354 acpi_irq_handled++;
355 return IRQ_HANDLED; 355 return IRQ_HANDLED;
356 } else 356 } else {
357 acpi_irq_not_handled++;
357 return IRQ_NONE; 358 return IRQ_NONE;
359 }
358} 360}
359 361
360acpi_status 362acpi_status
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 6fe121434ffb..eed3b458ebac 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
581 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 581 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
582 struct acpi_processor_cx *cx = &pr->power.states[i]; 582 struct acpi_processor_cx *cx = &pr->power.states[i];
583 583
584#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
585 /* TSC could halt in idle, so notify users */
586 if (tsc_halts_in_c(cx->type))
587 mark_tsc_unstable("TSC halts in idle");;
588#endif
584 switch (cx->type) { 589 switch (cx->type) {
585 case ACPI_STATE_C1: 590 case ACPI_STATE_C1:
586 cx->valid = 1; 591 cx->valid = 1;
@@ -657,11 +662,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
657 662
658 seq_printf(seq, "active state: C%zd\n" 663 seq_printf(seq, "active state: C%zd\n"
659 "max_cstate: C%d\n" 664 "max_cstate: C%d\n"
660 "bus master activity: %08x\n"
661 "maximum allowed latency: %d usec\n", 665 "maximum allowed latency: %d usec\n",
662 pr->power.state ? pr->power.state - pr->power.states : 0, 666 pr->power.state ? pr->power.state - pr->power.states : 0,
663 max_cstate, (unsigned)pr->power.bm_activity, 667 max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));
664 pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));
665 668
666 seq_puts(seq, "states:\n"); 669 seq_puts(seq, "states:\n");
667 670
@@ -871,11 +874,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
871 kt2 = ktime_get_real(); 874 kt2 = ktime_get_real();
872 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 875 idle_time = ktime_to_us(ktime_sub(kt2, kt1));
873 876
874#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
875 /* TSC could halt in idle, so notify users */
876 if (tsc_halts_in_c(cx->type))
877 mark_tsc_unstable("TSC halts in idle");;
878#endif
879 sleep_ticks = us_to_pm_timer_ticks(idle_time); 877 sleep_ticks = us_to_pm_timer_ticks(idle_time);
880 878
881 /* Tell the scheduler how much we idled: */ 879 /* Tell the scheduler how much we idled: */
@@ -989,11 +987,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
989 spin_unlock(&c3_lock); 987 spin_unlock(&c3_lock);
990 } 988 }
991 989
992#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
993 /* TSC could halt in idle, so notify users */
994 if (tsc_halts_in_c(ACPI_STATE_C3))
995 mark_tsc_unstable("TSC halts in idle");
996#endif
997 sleep_ticks = us_to_pm_timer_ticks(idle_time); 990 sleep_ticks = us_to_pm_timer_ticks(idle_time);
998 /* Tell the scheduler how much we idled: */ 991 /* Tell the scheduler how much we idled: */
999 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 992 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 779e4e500df4..01574a066534 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -300,9 +300,9 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state)
300static struct platform_suspend_ops acpi_suspend_ops = { 300static struct platform_suspend_ops acpi_suspend_ops = {
301 .valid = acpi_suspend_state_valid, 301 .valid = acpi_suspend_state_valid,
302 .begin = acpi_suspend_begin, 302 .begin = acpi_suspend_begin,
303 .prepare = acpi_pm_prepare, 303 .prepare_late = acpi_pm_prepare,
304 .enter = acpi_suspend_enter, 304 .enter = acpi_suspend_enter,
305 .finish = acpi_pm_finish, 305 .wake = acpi_pm_finish,
306 .end = acpi_pm_end, 306 .end = acpi_pm_end,
307}; 307};
308 308
@@ -328,9 +328,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
328static struct platform_suspend_ops acpi_suspend_ops_old = { 328static struct platform_suspend_ops acpi_suspend_ops_old = {
329 .valid = acpi_suspend_state_valid, 329 .valid = acpi_suspend_state_valid,
330 .begin = acpi_suspend_begin_old, 330 .begin = acpi_suspend_begin_old,
331 .prepare = acpi_pm_disable_gpes, 331 .prepare_late = acpi_pm_disable_gpes,
332 .enter = acpi_suspend_enter, 332 .enter = acpi_suspend_enter,
333 .finish = acpi_pm_finish, 333 .wake = acpi_pm_finish,
334 .end = acpi_pm_end, 334 .end = acpi_pm_end,
335 .recover = acpi_pm_finish, 335 .recover = acpi_pm_finish,
336}; 336};
@@ -713,6 +713,32 @@ static void acpi_power_off(void)
713 acpi_enter_sleep_state(ACPI_STATE_S5); 713 acpi_enter_sleep_state(ACPI_STATE_S5);
714} 714}
715 715
716/*
717 * ACPI 2.0 created the optional _GTS and _BFS,
718 * but industry adoption has been neither rapid nor broad.
719 *
720 * Linux gets into trouble when it executes poorly validated
721 * paths through the BIOS, so disable _GTS and _BFS by default,
722 * but do speak up and offer the option to enable them.
723 */
724void __init acpi_gts_bfs_check(void)
725{
726 acpi_handle dummy;
727
728 if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy)))
729 {
730 printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n");
731 printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, "
732 "please notify linux-acpi@vger.kernel.org\n");
733 }
734 if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy)))
735 {
736 printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n");
737 printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, "
738 "please notify linux-acpi@vger.kernel.org\n");
739 }
740}
741
716int __init acpi_sleep_init(void) 742int __init acpi_sleep_init(void)
717{ 743{
718 acpi_status status; 744 acpi_status status;
@@ -771,5 +797,6 @@ int __init acpi_sleep_init(void)
771 * object can also be evaluated when the system enters S5. 797 * object can also be evaluated when the system enters S5.
772 */ 798 */
773 register_reboot_notifier(&tts_notifier); 799 register_reboot_notifier(&tts_notifier);
800 acpi_gts_bfs_check();
774 return 0; 801 return 0;
775} 802}
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index da51f05ef8d8..0944daec064f 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -38,6 +38,7 @@ ACPI_MODULE_NAME("system");
38#define ACPI_SYSTEM_DEVICE_NAME "System" 38#define ACPI_SYSTEM_DEVICE_NAME "System"
39 39
40u32 acpi_irq_handled; 40u32 acpi_irq_handled;
41u32 acpi_irq_not_handled;
41 42
42/* 43/*
43 * Make ACPICA version work as module param 44 * Make ACPICA version work as module param
@@ -214,8 +215,9 @@ err:
214 215
215#define COUNT_GPE 0 216#define COUNT_GPE 0
216#define COUNT_SCI 1 /* acpi_irq_handled */ 217#define COUNT_SCI 1 /* acpi_irq_handled */
217#define COUNT_ERROR 2 /* other */ 218#define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */
218#define NUM_COUNTERS_EXTRA 3 219#define COUNT_ERROR 3 /* other */
220#define NUM_COUNTERS_EXTRA 4
219 221
220struct event_counter { 222struct event_counter {
221 u32 count; 223 u32 count;
@@ -317,6 +319,8 @@ static ssize_t counter_show(struct kobject *kobj,
317 319
318 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = 320 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count =
319 acpi_irq_handled; 321 acpi_irq_handled;
322 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count =
323 acpi_irq_not_handled;
320 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = 324 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
321 acpi_gpe_count; 325 acpi_gpe_count;
322 326
@@ -363,6 +367,7 @@ static ssize_t counter_set(struct kobject *kobj,
363 all_counters[i].count = 0; 367 all_counters[i].count = 0;
364 acpi_gpe_count = 0; 368 acpi_gpe_count = 0;
365 acpi_irq_handled = 0; 369 acpi_irq_handled = 0;
370 acpi_irq_not_handled = 0;
366 goto end; 371 goto end;
367 } 372 }
368 373
@@ -456,6 +461,8 @@ void acpi_irq_stats_init(void)
456 sprintf(buffer, "gpe_all"); 461 sprintf(buffer, "gpe_all");
457 else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) 462 else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI)
458 sprintf(buffer, "sci"); 463 sprintf(buffer, "sci");
464 else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT)
465 sprintf(buffer, "sci_not");
459 else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) 466 else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR)
460 sprintf(buffer, "error"); 467 sprintf(buffer, "error");
461 else 468 else
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 9cd15e8c8932..564ea1424288 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
909 thermal_zone_device_register("acpitz", trips, tz, 909 thermal_zone_device_register("acpitz", trips, tz,
910 &acpi_thermal_zone_ops, 910 &acpi_thermal_zone_ops,
911 0, 0, 0, 911 0, 0, 0,
912 tz->polling_frequency); 912 tz->polling_frequency*100);
913 if (IS_ERR(tz->thermal_zone)) 913 if (IS_ERR(tz->thermal_zone))
914 return -ENODEV; 914 return -ENODEV;
915 915
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 346277f93cda..1705d947ea09 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
770 * In this case, the first two elements in _BCL packages 770 * In this case, the first two elements in _BCL packages
771 * are also supported brightness levels that OS should take care of. 771 * are also supported brightness levels that OS should take care of.
772 */ 772 */
773 for (i = 2; i < count; i++) 773 for (i = 2; i < count; i++) {
774 if (br->levels[i] == br->levels[0] || 774 if (br->levels[i] == br->levels[0])
775 br->levels[i] == br->levels[1])
776 level_ac_battery++; 775 level_ac_battery++;
776 if (br->levels[i] == br->levels[1])
777 level_ac_battery++;
778 }
777 779
778 if (level_ac_battery < 2) { 780 if (level_ac_battery < 2) {
779 level_ac_battery = 2 - level_ac_battery; 781 level_ac_battery = 2 - level_ac_battery;