[coreboot-gerrit] Change in coreboot[master]: ec/lenovo/h8/acpi: Fix regression

Patrick Rudolph (Code Review) gerrit at coreboot.org
Fri Nov 17 15:39:32 CET 2017


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/22514


Change subject: ec/lenovo/h8/acpi: Fix regression
......................................................................

ec/lenovo/h8/acpi: Fix regression

Fix a regression introduced by #21227 0709dc04.
The commit causes 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.
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 at das-labor.org>
---
M src/ec/lenovo/h8/acpi/ec.asl
M src/ec/lenovo/h8/acpi/thermal.asl
2 files changed, 30 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/22514/1

diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl
index 750121d..944858f 100644
--- a/src/ec/lenovo/h8/acpi/ec.asl
+++ b/src/ec/lenovo/h8/acpi/ec.asl
@@ -286,6 +286,22 @@
 		^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 83c966a..103bd16 100644
--- a/src/ec/lenovo/h8/acpi/thermal.asl
+++ b/src/ec/lenovo/h8/acpi/thermal.asl
@@ -101,7 +101,7 @@
 			/* 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 @@
 
 		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)
 			}
 		}

-- 
To view, visit https://review.coreboot.org/22514
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia99f8814ac14194578dcd1aa50a63e3f35c042dd
Gerrit-Change-Number: 22514
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171117/f9f5a8ea/attachment.html>


More information about the coreboot-gerrit mailing list