From 9b8ef11f00e895cf55e80f3a762ffb7cf500cc07 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 13 Nov 2017 19:00:11 +0100 Subject: [PATCH] ec/lenovo/h8/acpi: Fix regression (MS Windows crash on boot) Fix a regression introduced by #21227 0709dc04 (ec/lenovo/h8/acpi/thermal: Add ACPI fan control). The commit caused Windows to crash as EC reads aren't allowed in the fan device or it's powerresource's methods. Implement the same approach as all other platforms using a GNVS variable named FLVL instead of reading from EC. In addition to EC reads writing to FIELD elements, in another ACPI scope, seems to be broken. Introduce a new method to set the fan disengage mode. Tested on Windows 7 and Lenovo T500. Change-Id: Ia99f8814ac14194578dcd1aa50a63e3f35c042dd Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/22514 Tested-by: build bot (Jenkins) Reviewed-by: Alexander Couzens --- src/ec/lenovo/h8/acpi/ec.asl | 16 ++++++++++++++++ src/ec/lenovo/h8/acpi/thermal.asl | 24 ++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl index 750121d687..944858ff8f 100644 --- a/src/ec/lenovo/h8/acpi/ec.asl +++ b/src/ec/lenovo/h8/acpi/ec.asl @@ -286,6 +286,22 @@ Device(EC) ^HKEY.RTAB (0xA) } + /* + * Set FAN disengage: + * Arg0: 1: Run at full speed + * 0: Automatic fan control + */ + Method (FANE, 1, Serialized) + { + If (Arg0) { + Store (One, FAND) + Store (Zero, FANA) + } Else { + Store (Zero, FAND) + Store (One, FANA) + } + } + Device (HKEY) { Name (_HID, EisaId ("IBM0068")) diff --git a/src/ec/lenovo/h8/acpi/thermal.asl b/src/ec/lenovo/h8/acpi/thermal.asl index 83c966af10..aaced607a8 100644 --- a/src/ec/lenovo/h8/acpi/thermal.asl +++ b/src/ec/lenovo/h8/acpi/thermal.asl @@ -101,7 +101,7 @@ External (\PPKG, MethodObj) /* Active fan 10 degree below passive threshold */ Subtract (Local0, 10, Local0) - If (LEqual (\_SB.PCI0.LPCB.EC.FAND, 1)) { + If (\FLVL) { /* Turn of 5 degree below trip point */ Subtract (Local0, 5, Local0) } @@ -113,23 +113,27 @@ External (\PPKG, MethodObj) PowerResource (FPwR, 0, 0) { + /* + * WINDOWS BUG: Don't read from EmbeddedControl + * in PowerResources. Use system-memory instead! + */ Method (_STA) { - If (LEqual (\_SB.PCI0.LPCB.EC.FAND, 0)) { - Return (Zero) - } Else { - Return (One) - } + Return (\FLVL) } + /* + * WINDOWS BUG: Don't write to FIELD elements located + * in another ACPI scope. Call a method that does it! + */ Method (_ON) { - Store (One, \_SB.PCI0.LPCB.EC.FAND) - Store (Zero, \_SB.PCI0.LPCB.EC.FANA) + \_SB.PCI0.LPCB.EC.FANE(One) + Store (One, \FLVL) Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) } Method (_OFF) { - Store (Zero, \_SB.PCI0.LPCB.EC.FAND) - Store (One, \_SB.PCI0.LPCB.EC.FANA) + \_SB.PCI0.LPCB.EC.FANE(Zero) + Store (Zero, \FLVL) Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) } }