aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2010-05-28 16:17:27 -0400
committerLen Brown <len.brown@intel.com>2010-05-28 16:17:27 -0400
commit91dd6964390b331beb731623cb59c4a933ff8162 (patch)
tree2d22bdbd92e1e642fa4a77be4d4bf4cc5cbba2a9 /drivers
parentdc1544ea5d6dfdf29440295788e639e4b44c605a (diff)
parentb6dacf63e9fb2e7a1369843d6cef332f76fca6a3 (diff)
Merge branch 'acpi_enable' into release
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/evxfevnt.c33
-rw-r--r--drivers/acpi/acpica/hwacpi.c20
-rw-r--r--drivers/acpi/sleep.c157
3 files changed, 24 insertions, 186 deletions
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 5ff32c78ea2d..bfbe291d572e 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -69,7 +69,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
69 69
70acpi_status acpi_enable(void) 70acpi_status acpi_enable(void)
71{ 71{
72 acpi_status status = AE_OK; 72 acpi_status status;
73 73
74 ACPI_FUNCTION_TRACE(acpi_enable); 74 ACPI_FUNCTION_TRACE(acpi_enable);
75 75
@@ -84,21 +84,30 @@ acpi_status acpi_enable(void)
84 if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { 84 if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
85 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 85 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
86 "System is already in ACPI mode\n")); 86 "System is already in ACPI mode\n"));
87 } else { 87 return_ACPI_STATUS(AE_OK);
88 /* Transition to ACPI mode */ 88 }
89 89
90 status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); 90 /* Transition to ACPI mode */
91 if (ACPI_FAILURE(status)) {
92 ACPI_ERROR((AE_INFO,
93 "Could not transition to ACPI mode"));
94 return_ACPI_STATUS(status);
95 }
96 91
97 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 92 status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
98 "Transition to ACPI mode successful\n")); 93 if (ACPI_FAILURE(status)) {
94 ACPI_ERROR((AE_INFO,
95 "Could not transition to ACPI mode"));
96 return_ACPI_STATUS(status);
99 } 97 }
100 98
101 return_ACPI_STATUS(status); 99 /* Sanity check that transition succeeded */
100
101 if (acpi_hw_get_mode() != ACPI_SYS_MODE_ACPI) {
102 ACPI_ERROR((AE_INFO,
103 "Hardware did not enter ACPI mode"));
104 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
105 }
106
107 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
108 "Transition to ACPI mode successful\n"));
109
110 return_ACPI_STATUS(AE_OK);
102} 111}
103 112
104ACPI_EXPORT_SYMBOL(acpi_enable) 113ACPI_EXPORT_SYMBOL(acpi_enable)
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index 679a112a7d26..b44274a0b62c 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -63,7 +63,6 @@ acpi_status acpi_hw_set_mode(u32 mode)
63{ 63{
64 64
65 acpi_status status; 65 acpi_status status;
66 u32 retry;
67 66
68 ACPI_FUNCTION_TRACE(hw_set_mode); 67 ACPI_FUNCTION_TRACE(hw_set_mode);
69 68
@@ -125,24 +124,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
125 return_ACPI_STATUS(status); 124 return_ACPI_STATUS(status);
126 } 125 }
127 126
128 /* 127 return_ACPI_STATUS(AE_OK);
129 * Some hardware takes a LONG time to switch modes. Give them 3 sec to
130 * do so, but allow faster systems to proceed more quickly.
131 */
132 retry = 3000;
133 while (retry) {
134 if (acpi_hw_get_mode() == mode) {
135 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
136 "Mode %X successfully enabled\n",
137 mode));
138 return_ACPI_STATUS(AE_OK);
139 }
140 acpi_os_stall(1000);
141 retry--;
142 }
143
144 ACPI_ERROR((AE_INFO, "Hardware did not change modes"));
145 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
146} 128}
147 129
148/******************************************************************************* 130/*******************************************************************************
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index baa76bbf244a..4ab2275b4461 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -80,22 +80,6 @@ static int acpi_sleep_prepare(u32 acpi_state)
80 80
81#ifdef CONFIG_ACPI_SLEEP 81#ifdef CONFIG_ACPI_SLEEP
82static u32 acpi_target_sleep_state = ACPI_STATE_S0; 82static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83/*
84 * According to the ACPI specification the BIOS should make sure that ACPI is
85 * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
86 * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
87 * on such systems during resume. Unfortunately that doesn't help in
88 * particularly pathological cases in which SCI_EN has to be set directly on
89 * resume, although the specification states very clearly that this flag is
90 * owned by the hardware. The set_sci_en_on_resume variable will be set in such
91 * cases.
92 */
93static bool set_sci_en_on_resume;
94
95void __init acpi_set_sci_en_on_resume(void)
96{
97 set_sci_en_on_resume = true;
98}
99 83
100/* 84/*
101 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the 85 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
@@ -253,11 +237,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
253 break; 237 break;
254 } 238 }
255 239
256 /* If ACPI is not enabled by the BIOS, we need to enable it here. */ 240 /* This violates the spec but is required for bug compatibility. */
257 if (set_sci_en_on_resume) 241 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
258 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
259 else
260 acpi_enable();
261 242
262 /* Reprogram control registers and execute _BFS */ 243 /* Reprogram control registers and execute _BFS */
263 acpi_leave_sleep_state_prep(acpi_state); 244 acpi_leave_sleep_state_prep(acpi_state);
@@ -346,12 +327,6 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
346 return 0; 327 return 0;
347} 328}
348 329
349static int __init init_set_sci_en_on_resume(const struct dmi_system_id *d)
350{
351 set_sci_en_on_resume = true;
352 return 0;
353}
354
355static struct dmi_system_id __initdata acpisleep_dmi_table[] = { 330static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
356 { 331 {
357 .callback = init_old_suspend_ordering, 332 .callback = init_old_suspend_ordering,
@@ -370,22 +345,6 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
370 }, 345 },
371 }, 346 },
372 { 347 {
373 .callback = init_set_sci_en_on_resume,
374 .ident = "Apple MacBook 1,1",
375 .matches = {
376 DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
377 DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),
378 },
379 },
380 {
381 .callback = init_set_sci_en_on_resume,
382 .ident = "Apple MacMini 1,1",
383 .matches = {
384 DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
385 DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
386 },
387 },
388 {
389 .callback = init_old_suspend_ordering, 348 .callback = init_old_suspend_ordering,
390 .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)", 349 .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)",
391 .matches = { 350 .matches = {
@@ -394,94 +353,6 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
394 }, 353 },
395 }, 354 },
396 { 355 {
397 .callback = init_set_sci_en_on_resume,
398 .ident = "Toshiba Satellite L300",
399 .matches = {
400 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
401 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L300"),
402 },
403 },
404 {
405 .callback = init_set_sci_en_on_resume,
406 .ident = "Hewlett-Packard HP G7000 Notebook PC",
407 .matches = {
408 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
409 DMI_MATCH(DMI_PRODUCT_NAME, "HP G7000 Notebook PC"),
410 },
411 },
412 {
413 .callback = init_set_sci_en_on_resume,
414 .ident = "Hewlett-Packard HP Pavilion dv3 Notebook PC",
415 .matches = {
416 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
417 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv3 Notebook PC"),
418 },
419 },
420 {
421 .callback = init_set_sci_en_on_resume,
422 .ident = "Hewlett-Packard Pavilion dv4",
423 .matches = {
424 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
425 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4"),
426 },
427 },
428 {
429 .callback = init_set_sci_en_on_resume,
430 .ident = "Hewlett-Packard Pavilion dv7",
431 .matches = {
432 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
433 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7"),
434 },
435 },
436 {
437 .callback = init_set_sci_en_on_resume,
438 .ident = "Hewlett-Packard Compaq Presario C700 Notebook PC",
439 .matches = {
440 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
441 DMI_MATCH(DMI_PRODUCT_NAME, "Compaq Presario C700 Notebook PC"),
442 },
443 },
444 {
445 .callback = init_set_sci_en_on_resume,
446 .ident = "Hewlett-Packard Compaq Presario CQ40 Notebook PC",
447 .matches = {
448 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
449 DMI_MATCH(DMI_PRODUCT_NAME, "Compaq Presario CQ40 Notebook PC"),
450 },
451 },
452 {
453 .callback = init_set_sci_en_on_resume,
454 .ident = "Lenovo ThinkPad T410",
455 .matches = {
456 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
457 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
458 },
459 },
460 {
461 .callback = init_set_sci_en_on_resume,
462 .ident = "Lenovo ThinkPad T510",
463 .matches = {
464 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
465 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
466 },
467 },
468 {
469 .callback = init_set_sci_en_on_resume,
470 .ident = "Lenovo ThinkPad W510",
471 .matches = {
472 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
473 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
474 },
475 },
476 {
477 .callback = init_set_sci_en_on_resume,
478 .ident = "Lenovo ThinkPad X201[s]",
479 .matches = {
480 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
481 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
482 },
483 },
484 {
485 .callback = init_old_suspend_ordering, 356 .callback = init_old_suspend_ordering,
486 .ident = "Panasonic CF51-2L", 357 .ident = "Panasonic CF51-2L",
487 .matches = { 358 .matches = {
@@ -490,30 +361,6 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
490 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), 361 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
491 }, 362 },
492 }, 363 },
493 {
494 .callback = init_set_sci_en_on_resume,
495 .ident = "Dell Studio 1558",
496 .matches = {
497 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
498 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1558"),
499 },
500 },
501 {
502 .callback = init_set_sci_en_on_resume,
503 .ident = "Dell Studio 1557",
504 .matches = {
505 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
506 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
507 },
508 },
509 {
510 .callback = init_set_sci_en_on_resume,
511 .ident = "Dell Studio 1555",
512 .matches = {
513 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
514 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1555"),
515 },
516 },
517 {}, 364 {},
518}; 365};
519#endif /* CONFIG_SUSPEND */ 366#endif /* CONFIG_SUSPEND */