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 <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/22514
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Alexander Couzens <lynxis@fe80.eu>
This commit is contained in:
Patrick Rudolph 2017-11-13 19:00:11 +01:00
parent c6fa12727a
commit 9b8ef11f00
2 changed files with 30 additions and 10 deletions

View File

@ -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"))

View File

@ -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)
}
}