Skip to contentSkip to conversation

acpi: Unconditionally set SCI_EN on resume

PATCH In review Matthew Garrett 4 participants 6 messages May 11, 2010 – May 12, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: Unconditionally set SCI_EN on resume

The ACPI spec tells us that the firmware will reenable SCI_EN on resume. Reality disagrees in some cases. The ACPI spec tells us that the only way to set SCI_EN is via an SMM call.
https://bugzilla.kernel.org/show_bug.cgi?id=13745 shows us that doing so may break machines. Tracing the ACPI calls made by Windows shows that it unconditionally sets SCI_EN on resume with a direct register write, and therefore the overwhelming probability is that everything is fine with this behaviour.

---
 arch/x86/kernel/acpi/sleep.c |    2 -
 drivers/acpi/sleep.c         |  157 +-----------------------------------------
 include/linux/acpi.h         |    1 -
 3 files changed, 2 insertions(+), 158 deletions(-)
arch/x86/kernel/acpi/sleep.c +0 -2
index f996103..82e5086 100644
@@ -162,8 +162,6 @@ static int __init acpi_sleep_setup(char *str)
 #endif
 		if (strncmp(str, "old_ordering", 12) == 0)
 			acpi_old_suspend_ordering();
-		if (strncmp(str, "sci_force_enable", 16) == 0)
-			acpi_set_sci_en_on_resume();
 		str = strchr(str, ',');
 		if (str != NULL)
 			str += strspn(str, ", \t");
drivers/acpi/sleep.c +2 -155

193 lines not on this page · raw message

include/linux/acpi.h +0 -1
index b926afe..87ca491 100644
@@ -251,7 +251,6 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
 void __init acpi_no_s4_hw_signature(void);
 void __init acpi_old_suspend_ordering(void);
 void __init acpi_s4_no_nvs(void);
-void __init acpi_set_sci_en_on_resume(void);
 #endif /* CONFIG_PM_SLEEP */
 
 struct acpi_osc_context {
Signature · 1 line
1.7.0.1
#1 lore raw
Quoted 57 lines · Matthew Garrett

The ACPI spec tells us that the firmware will reenable SCI_EN on resume. Reality disagrees in some cases. The ACPI spec tells us that the only way to set SCI_EN is via an SMM call.
https://bugzilla.kernel.org/show_bug.cgi?id=13745 shows us that doing so may break machines. Tracing the ACPI calls made by Windows shows that it unconditionally sets SCI_EN on resume with a direct register write, and therefore the overwhelming probability is that everything is fine with this behaviour.

---
 arch/x86/kernel/acpi/sleep.c |    2 -
 drivers/acpi/sleep.c         |  157 +-----------------------------------------
 include/linux/acpi.h         |    1 -
 3 files changed, 2 insertions(+), 158 deletions(-)
arch/x86/kernel/acpi/sleep.c +0 -2
index f996103..82e5086 100644
@@ -162,8 +162,6 @@ static int __init acpi_sleep_setup(char *str)
 #endif
 		if (strncmp(str, "old_ordering", 12) == 0)
 			acpi_old_suspend_ordering();
-		if (strncmp(str, "sci_force_enable", 16) == 0)
-			acpi_set_sci_en_on_resume();
 		str = strchr(str, ',');
 		if (str != NULL)
 			str += strspn(str, ", \t");
drivers/acpi/sleep.c +0 -16
index baa76bb..4ab2275 100644
@@ -80,22 +80,6 @@ static int acpi_sleep_prepare(u32 acpi_state)
 
 #ifdef CONFIG_ACPI_SLEEP
 static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-/*
- * According to the ACPI specification the BIOS should make sure that ACPI is
- * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states.  Still,
- * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
- * on such systems during resume.  Unfortunately that doesn't help in
- * particularly pathological cases in which SCI_EN has to be set directly on
- * resume, although the specification states very clearly that this flag is
- * owned by the hardware.  The set_sci_en_on_resume variable will be set in such
- * cases.
- */
-static bool set_sci_en_on_resume;
-
-void __init acpi_set_sci_en_on_resume(void)
-{
-	set_sci_en_on_resume = true;
-}
 
 /*
  * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the

drivers/acpi/sleep.c static int acpi_suspend_enter(suspend_state_t pm_state) · line 241

Quoted 10 lines
drivers/acpi/sleep.c +2 -5
@@ -253,11 +237,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
 		break;
 	}
 
-	/* If ACPI is not enabled by the BIOS, we need to enable it here. */
-	if (set_sci_en_on_resume)
-		acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
-	else
-		acpi_enable();
+	/* This violates the spec but is required for bug compatibility. */
+	acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);

No, this breaks my MSI Wind U100 right away.

If you called acpi_enable() before that and do that depending on its result, _that_ would work.

Thanks,
Rafael

#2 lore raw
Quoted 4 lines · Rafael J. Wysocki

No, this breaks my MSI Wind U100 right away.

If you called acpi_enable() before that and do that depending on its result, _that_ would work.

Calling acpi_enable breaks some HPs. What version of Windows did the Wind ship with?

Signature · 1 line
Matthew Garrett | [email protected]
#3 lore raw
Quoted 9 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki

No, this breaks my MSI Wind U100 right away.

If you called acpi_enable() before that and do that depending on its result, _that_ would work.

Calling acpi_enable breaks some HPs. What version of Windows did the Wind ship with?

Without any. It shipped with SLED 10. :-)

Rafael

#4 lore raw
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Matthew Garrett
Quoted 2 lines · Rafael J. Wysocki

No, this breaks my MSI Wind U100 right away.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

If you called acpi_enable() before that and do that depending on its result, _that_ would work.

Calling acpi_enable breaks some HPs. What version of Windows did the Wind ship with?

Without any. It shipped with SLED 10. :-)

Can you dump the DSDT? It's possible that this behaviour varies depending on the OSI queries.

Signature · 1 line
Matthew Garrett | [email protected]
reviewer
#5 lore raw
In reply to Matthew Garrett

applied to acpi #test (replacing previous patch set on this topic)

However, s/acpi/ACPI/ :-)

thanks,
Len Brown, Intel Open Source Technology Center