From aedef7382e27d1494768997a18e4d9351cb44cd6 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sat, 12 Jul 2025 17:28:13 -0500 Subject: [PATCH 39/43] ec/lenovo/h8: Rework invalid temperature reporting As far back as the x201, Lenovo's EC ACPI has treated 128 as an invalid value, and returned a corrected value when it is reported/read from EC RAM. Drop the ME workaround, which most H8-equipped boards select, in favor of Lenovo's logic, since both accomplish the same result. Change-Id: Icdc91e439ec30c8263de5810a13e75f7595472a5 Signed-off-by: Matt DeVillier --- src/ec/lenovo/h8/acpi/thermal.asl | 25 ++++++------------- .../lenovo/haswell/acpi/platform.asl | 3 --- src/mainboard/lenovo/haswell/dsdt.asl | 1 - src/mainboard/lenovo/l520/acpi/platform.asl | 4 --- src/mainboard/lenovo/l520/dsdt.asl | 1 - src/mainboard/lenovo/s230u/dsdt.asl | 1 - src/mainboard/lenovo/t400/dsdt.asl | 1 - src/mainboard/lenovo/t410/dsdt.asl | 1 - src/mainboard/lenovo/t420/acpi/platform.asl | 4 --- src/mainboard/lenovo/t420/dsdt.asl | 1 - src/mainboard/lenovo/t420s/acpi/platform.asl | 4 --- src/mainboard/lenovo/t420s/dsdt.asl | 1 - src/mainboard/lenovo/t430/acpi/platform.asl | 4 --- src/mainboard/lenovo/t430/dsdt.asl | 1 - src/mainboard/lenovo/t430s/acpi/platform.asl | 4 --- src/mainboard/lenovo/t430s/dsdt.asl | 1 - src/mainboard/lenovo/t520/acpi/platform.asl | 4 --- src/mainboard/lenovo/t520/dsdt.asl | 1 - src/mainboard/lenovo/t530/acpi/platform.asl | 4 --- src/mainboard/lenovo/t530/dsdt.asl | 1 - src/mainboard/lenovo/x131e/acpi/platform.asl | 4 --- src/mainboard/lenovo/x131e/dsdt.asl | 1 - .../lenovo/x1_carbon_gen1/acpi/platform.asl | 4 --- src/mainboard/lenovo/x1_carbon_gen1/dsdt.asl | 1 - src/mainboard/lenovo/x201/acpi/platform.asl | 4 --- src/mainboard/lenovo/x201/dsdt.asl | 1 - src/mainboard/lenovo/x220/acpi/platform.asl | 4 --- src/mainboard/lenovo/x220/dsdt.asl | 1 - src/mainboard/lenovo/x230/acpi/platform.asl | 4 --- src/mainboard/lenovo/x230/dsdt.asl | 1 - 30 files changed, 8 insertions(+), 84 deletions(-) diff --git a/src/ec/lenovo/h8/acpi/thermal.asl b/src/ec/lenovo/h8/acpi/thermal.asl index bf9b653e12..54f4f922bd 100644 --- a/src/ec/lenovo/h8/acpi/thermal.asl +++ b/src/ec/lenovo/h8/acpi/thermal.asl @@ -4,11 +4,6 @@ Scope(\_TZ) { -#if defined(EC_LENOVO_H8_ME_WORKAROUND) - Name (MEB1, 0) - Name (MEB2, 0) -#endif - Method(C2K, 1, NotSerialized) { Local0 = Arg0 * 10 @@ -71,14 +66,12 @@ External (\PPKG, MethodObj) } Method(_TMP) { -#if defined(EC_LENOVO_H8_ME_WORKAROUND) - /* Avoid tripping alarm if ME isn't booted at all yet */ - If (!MEB1 && \_SB.PCI0.LPCB.EC.TMP0 == 128) { + Local0 = \_SB.PCI0.LPCB.EC.TMP0 + /* Avoid tripping alarm if invalid value reported */ + If (Local0 == 128) { Return (C2K(40)) } - MEB1 = 1 -#endif - Return (C2K(\_SB.PCI0.LPCB.EC.TMP0)) + Return (C2K(Local0)) } Method (_AC0) { @@ -158,14 +151,12 @@ External (\PPKG, MethodObj) } Method(_TMP) { -#if defined(EC_LENOVO_H8_ME_WORKAROUND) - /* Avoid tripping alarm if ME isn't booted at all yet */ - If (!MEB2 && \_SB.PCI0.LPCB.EC.TMP1 == 128) { + Local0 = \_SB.PCI0.LPCB.EC.TMP1 + /* Avoid tripping alarm if invalid value reported */ + If (Local0 == 128) { Return (C2K(40)) } - MEB2 = 1 -#endif - Return (C2K(\_SB.PCI0.LPCB.EC.TMP1)) + Return (C2K(Local0)) } } #endif diff --git a/src/mainboard/lenovo/haswell/acpi/platform.asl b/src/mainboard/lenovo/haswell/acpi/platform.asl index f5a4df75f4..42587fd78a 100644 --- a/src/mainboard/lenovo/haswell/acpi/platform.asl +++ b/src/mainboard/lenovo/haswell/acpi/platform.asl @@ -2,9 +2,6 @@ Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 Return(Package(){0,0}) } diff --git a/src/mainboard/lenovo/haswell/dsdt.asl b/src/mainboard/lenovo/haswell/dsdt.asl index a7afeee766..708f524b08 100644 --- a/src/mainboard/lenovo/haswell/dsdt.asl +++ b/src/mainboard/lenovo/haswell/dsdt.asl @@ -2,7 +2,6 @@ #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #define THINKPAD_EC_GPE 17 #include diff --git a/src/mainboard/lenovo/l520/acpi/platform.asl b/src/mainboard/lenovo/l520/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/l520/acpi/platform.asl +++ b/src/mainboard/lenovo/l520/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/l520/dsdt.asl b/src/mainboard/lenovo/l520/dsdt.asl index 06cffcf8a2..18e9f25a9a 100644 --- a/src/mainboard/lenovo/l520/dsdt.asl +++ b/src/mainboard/lenovo/l520/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 22 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/s230u/dsdt.asl b/src/mainboard/lenovo/s230u/dsdt.asl index 861309b8e9..47e91fdb30 100644 --- a/src/mainboard/lenovo/s230u/dsdt.asl +++ b/src/mainboard/lenovo/s230u/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 23 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t400/dsdt.asl b/src/mainboard/lenovo/t400/dsdt.asl index f9c682f9dc..cb824e42da 100644 --- a/src/mainboard/lenovo/t400/dsdt.asl +++ b/src/mainboard/lenovo/t400/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t410/dsdt.asl b/src/mainboard/lenovo/t410/dsdt.asl index 42a10e605c..e2571f60c7 100644 --- a/src/mainboard/lenovo/t410/dsdt.asl +++ b/src/mainboard/lenovo/t410/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t420/acpi/platform.asl b/src/mainboard/lenovo/t420/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t420/acpi/platform.asl +++ b/src/mainboard/lenovo/t420/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t420/dsdt.asl b/src/mainboard/lenovo/t420/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/t420/dsdt.asl +++ b/src/mainboard/lenovo/t420/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t420s/acpi/platform.asl b/src/mainboard/lenovo/t420s/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t420s/acpi/platform.asl +++ b/src/mainboard/lenovo/t420s/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t420s/dsdt.asl b/src/mainboard/lenovo/t420s/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/t420s/dsdt.asl +++ b/src/mainboard/lenovo/t420s/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t430/acpi/platform.asl b/src/mainboard/lenovo/t430/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t430/acpi/platform.asl +++ b/src/mainboard/lenovo/t430/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t430/dsdt.asl b/src/mainboard/lenovo/t430/dsdt.asl index c19e75ee82..795f9a1ee9 100644 --- a/src/mainboard/lenovo/t430/dsdt.asl +++ b/src/mainboard/lenovo/t430/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t430s/acpi/platform.asl b/src/mainboard/lenovo/t430s/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t430s/acpi/platform.asl +++ b/src/mainboard/lenovo/t430s/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t430s/dsdt.asl b/src/mainboard/lenovo/t430s/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/t430s/dsdt.asl +++ b/src/mainboard/lenovo/t430s/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t520/acpi/platform.asl b/src/mainboard/lenovo/t520/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t520/acpi/platform.asl +++ b/src/mainboard/lenovo/t520/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t520/dsdt.asl b/src/mainboard/lenovo/t520/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/t520/dsdt.asl +++ b/src/mainboard/lenovo/t520/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/t530/acpi/platform.asl b/src/mainboard/lenovo/t530/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/t530/acpi/platform.asl +++ b/src/mainboard/lenovo/t530/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/t530/dsdt.asl b/src/mainboard/lenovo/t530/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/t530/dsdt.asl +++ b/src/mainboard/lenovo/t530/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/x131e/acpi/platform.asl b/src/mainboard/lenovo/x131e/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/x131e/acpi/platform.asl +++ b/src/mainboard/lenovo/x131e/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/x131e/dsdt.asl b/src/mainboard/lenovo/x131e/dsdt.asl index 34391416f3..dc9878030e 100644 --- a/src/mainboard/lenovo/x131e/dsdt.asl +++ b/src/mainboard/lenovo/x131e/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 22 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl b/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl +++ b/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/x1_carbon_gen1/dsdt.asl b/src/mainboard/lenovo/x1_carbon_gen1/dsdt.asl index 6838b5e9a6..18a47960f4 100644 --- a/src/mainboard/lenovo/x1_carbon_gen1/dsdt.asl +++ b/src/mainboard/lenovo/x1_carbon_gen1/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #define EC_LENOVO_H8_ALT_FN_F2F3_LAYOUT 1 #include diff --git a/src/mainboard/lenovo/x201/acpi/platform.asl b/src/mainboard/lenovo/x201/acpi/platform.asl index f17adafc88..a238248886 100644 --- a/src/mainboard/lenovo/x201/acpi/platform.asl +++ b/src/mainboard/lenovo/x201/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/x201/dsdt.asl b/src/mainboard/lenovo/x201/dsdt.asl index 42a10e605c..e2571f60c7 100644 --- a/src/mainboard/lenovo/x201/dsdt.asl +++ b/src/mainboard/lenovo/x201/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/x220/acpi/platform.asl b/src/mainboard/lenovo/x220/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/x220/acpi/platform.asl +++ b/src/mainboard/lenovo/x220/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/x220/dsdt.asl b/src/mainboard/lenovo/x220/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/x220/dsdt.asl +++ b/src/mainboard/lenovo/x220/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( diff --git a/src/mainboard/lenovo/x230/acpi/platform.asl b/src/mainboard/lenovo/x230/acpi/platform.asl index c4becafc2a..9dee90edc3 100644 --- a/src/mainboard/lenovo/x230/acpi/platform.asl +++ b/src/mainboard/lenovo/x230/acpi/platform.asl @@ -15,10 +15,6 @@ Method(_PTS,1) Method(_WAK,1) { - /* ME may not be up yet. */ - \_TZ.MEB1 = 0 - \_TZ.MEB2 = 0 - /* Wake the HKEY to init BT/WWAN */ \_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0) diff --git a/src/mainboard/lenovo/x230/dsdt.asl b/src/mainboard/lenovo/x230/dsdt.asl index 33b6f80b17..1134782675 100644 --- a/src/mainboard/lenovo/x230/dsdt.asl +++ b/src/mainboard/lenovo/x230/dsdt.asl @@ -3,7 +3,6 @@ #define THINKPAD_EC_GPE 17 #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB -#define EC_LENOVO_H8_ME_WORKAROUND 1 #include DefinitionBlock( -- 2.39.5