HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46101 )
Change subject: ec/lenovo/h8: Convert to ASL 2.0 syntax ......................................................................
ec/lenovo/h8: Convert to ASL 2.0 syntax
Change-Id: I87bab2b11ba5e1fb585d5c88cf831b36e257c148 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/lenovo/h8/acpi/ac.asl M src/ec/lenovo/h8/acpi/battery.asl M src/ec/lenovo/h8/acpi/beep.asl M src/ec/lenovo/h8/acpi/ec.asl M src/ec/lenovo/h8/acpi/lid.asl M src/ec/lenovo/h8/acpi/sleepbutton.asl M src/ec/lenovo/h8/acpi/systemstatus.asl M src/ec/lenovo/h8/acpi/thermal.asl M src/ec/lenovo/h8/acpi/thinkpad.asl 9 files changed, 142 insertions(+), 140 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/01/46101/1
diff --git a/src/ec/lenovo/h8/acpi/ac.asl b/src/ec/lenovo/h8/acpi/ac.asl index ec7b7fc..436fdcf 100644 --- a/src/ec/lenovo/h8/acpi/ac.asl +++ b/src/ec/lenovo/h8/acpi/ac.asl @@ -15,8 +15,8 @@
Method(_PSR, 0, NotSerialized) { - Store(HPAC, Local0) - Store(Local0, \PWRS) + Local0 = HPAC + \PWRS = Local0 \PNOT() return (Local0) } diff --git a/src/ec/lenovo/h8/acpi/battery.asl b/src/ec/lenovo/h8/acpi/battery.asl index 42b91b9..a43ffce 100644 --- a/src/ec/lenovo/h8/acpi/battery.asl +++ b/src/ec/lenovo/h8/acpi/battery.asl @@ -94,32 +94,32 @@ Method(BSTA, 4, NotSerialized) { Acquire(ECLK, 0xffff) - Store(0, Local0) - ^BPAG(Or(1, Arg0)) - Store(BAMA, Local1) + Local0 = 0 + ^BPAG(1 | Arg0) + Local1 = BAMA ^BPAG(Arg0) /* Battery dynamic information */
/* * Present rate is a 16bit signed int, positive while charging * and negative while discharging. */ - Store(BAPR, Local2) + Local2 = BAPR
If (Arg2) // Charging { - Or(2, Local0, Local0) + Local0 |= 2 } Else { If (Arg3) // Discharging { - Or(1, Local0, Local0) + Local0 |= 1 // Negate present rate - Subtract(0x10000, Local2, Local2) + Local2 = 0x10000 - Local2 } Else // Full battery, force to 0 { - Store(0, Local2) + Local2 = 0 } }
@@ -127,21 +127,21 @@ * The present rate value must be positive now, if it is not we have an * EC bug or inconsistency and force the value to 0. */ - If (LGreaterEqual (Local2, 0x8000)) { - Store(0, Local2) + If (Local2 >= 0x8000) { + Local2 = 0 }
- Store(Local0, Index(Arg1, 0x00)) + Arg1 [0] = Local0
if (Local1) { - Multiply (BARC, 10, Index(Arg1, 2)) - Multiply (Local2, BAVO, Local2) - Divide (Local2, 1000, , Index(Arg1, 1)) + Arg1 [2] = BARC * 10 + Local2 *= BAVO + Arg1 [1] = Local2 / 1000 } else { - Store(BARC, Index(Arg1, 2)) - Store(Local2, Index(Arg1, 1)) + Arg1 [2] = BARC + Arg1 [1] = Local2 } - Store(BAVO, Index(Arg1, 3)) + Arg1 [3] = BAVO Release(ECLK) Return (Arg1) } @@ -149,44 +149,46 @@ Method(BINF, 2, Serialized) { Acquire(ECLK, 0xffff) - ^BPAG(Or(1, Arg1)) /* Battery 0 static information */ - Xor(BAMA, 1, Index(Arg0, 0)) - Store(BAMA, Local0) + ^BPAG(1 | Arg1) /* Battery 0 static information */ + Arg0 [0] = BAMA ^ 1 + Local0 = BAMA ^BPAG(Arg1) - Store(BAFC, Local2) - ^BPAG(Or(2, Arg1)) - Store(BADC, Local1) + Local2 = BAFC + ^BPAG(2 | Arg1) + Local1 = BADC
if (Local0) { - Multiply (Local1, 10, Local1) - Multiply (Local2, 10, Local2) + Local1 *= 10 + Local2 *= 10 }
- Store(Local1, Index(Arg0, 1)) // Design Capacity - Store(Local2, Index(Arg0, 2)) // Last full charge capacity - Store(BADV, Index(Arg0, 4)) // Design Voltage - Divide (Local2, 20, Local0, Index(Arg0, 5)) // Warning capacity + Arg0 [1] = Local1 // Design Capacity + Arg0 [2] = Local2 // Last full charge capacity + Arg0 [4] = BADV // Design Voltage + Local0 = Local2 % 20 /* FIXME: Local0 not used */ + Arg0 [5] = Local2 / 20 // Warning capacity
- Store (BASN, Local0) + Local0 = BASN Name (SERN, Buffer (0x06) { " " }) - Store (4, Local1) + Local1 = 4 While (Local0) { - Divide (Local0, 0x0A, Local2, Local0) - Add (Local2, 48, Index (SERN, Local1)) - Decrement (Local1) + Local2 = Local0 % 10 + Local0 /= 10 + SERN [Local1] = Local2 + 48 + Local1-- } - Store (SERN, Index (Arg0, 10)) // Serial Number + Arg0 [10] = SERN // Serial Number
^BPAG(Or(4, Arg1)) Name (TYPE, Buffer() { 0, 0, 0, 0, 0 }) - Store(BATY, TYPE) - Store(TYPE, Index (Arg0, 11)) // Battery type - ^BPAG(Or(5, Arg1)) - Store(BAOE, Index (Arg0, 12)) // OEM information - ^BPAG(Or(6, Arg1)) - Store(BANA, Index (Arg0, 9)) // Model number + TYPE = BATY + Arg0 [11] = TYPE // Battery type + ^BPAG(5 | Arg1) + Arg0 [12] = BAOE // OEM information + ^BPAG(6 | Arg1) + Arg0 [9] = BANA // Model number Release(ECLK) Return (Arg0) } diff --git a/src/ec/lenovo/h8/acpi/beep.asl b/src/ec/lenovo/h8/acpi/beep.asl index 214c8a9..3e51938 100644 --- a/src/ec/lenovo/h8/acpi/beep.asl +++ b/src/ec/lenovo/h8/acpi/beep.asl @@ -9,5 +9,5 @@
Method(BEEP, 1, NotSerialized) { - Store (Arg0, SNDS) + SNDS = Arg0 } diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl index 18463a5..0c77327 100644 --- a/src/ec/lenovo/h8/acpi/ec.asl +++ b/src/ec/lenovo/h8/acpi/ec.asl @@ -64,12 +64,12 @@ Method (_REG, 2, NotSerialized) { /* Wait for ERAM driver loaded */ - if (LEqual(Arg1, One)) { + if (Arg1 == 1) { /* Fill HKEY defaults on first boot */ - if (LEqual(^HKEY.INIT, Zero)) { - Store (BTEB, ^HKEY.WBDC) - Store (WWEB, ^HKEY.WWAN) - Store (One, ^HKEY.INIT) + if (^HKEY.INIT == 0) { + ^HKEY.WBDC = BTEB + ^HKEY.WWAN = WWEB + ^HKEY.INIT = 1 } } } @@ -86,13 +86,13 @@
Method (TLED, 1, NotSerialized) { - Store(Arg0, LEDS) + LEDS = Arg0 }
/* Not used for coreboot. Provided for compatibility with thinkpad-acpi. */ Method (LED, 2, NotSerialized) { - TLED(Or(Arg0, Arg1)) + TLED (Arg0 | Arg1) }
Method (_INI, 0, NotSerialized) @@ -101,24 +101,24 @@
Method (MUTE, 1, NotSerialized) { - Store(Arg0, AMUT) + AMUT = Arg0 }
Method (RADI, 1, NotSerialized) { - Store(Arg0, WLEB) - Store(Arg0, WWEB) - Store(Arg0, BTEB) + WLEB = Arg0 + WWEB = Arg0 + BTEB = Arg0 }
Method (USBP, 1, NotSerialized) { - Store(Arg0, USPW) + USPW = Arg0 }
Method (LGHT, 1, NotSerialized) { - Store(Arg0, KBLT) + KBLT = Arg0 }
@@ -157,7 +157,7 @@ Method(_Q27, 0, NotSerialized) { Notify (AC, 0x80) - Store(0x50, EVNT) + EVNT = 0x50 \PNOT() }
@@ -318,11 +318,11 @@ Method (FANE, 1, Serialized) { If (Arg0) { - Store (One, FAND) - Store (Zero, FANA) + FAND = 1 + FANA = 0 } Else { - Store (Zero, FAND) - Store (One, FANA) + FAND = 0 + FANA = 1 } }
diff --git a/src/ec/lenovo/h8/acpi/lid.asl b/src/ec/lenovo/h8/acpi/lid.asl index 8b74ecd..7695e4e 100644 --- a/src/ec/lenovo/h8/acpi/lid.asl +++ b/src/ec/lenovo/h8/acpi/lid.asl @@ -27,9 +27,9 @@ Method(_PSW, 1, NotSerialized) { if (Arg0) { - Store(1, WKLD) + WKLD = 1 } else { - Store(0, WKLD) + WKLD = 0 } } } diff --git a/src/ec/lenovo/h8/acpi/sleepbutton.asl b/src/ec/lenovo/h8/acpi/sleepbutton.asl index d3d6c9c..441dc65 100644 --- a/src/ec/lenovo/h8/acpi/sleepbutton.asl +++ b/src/ec/lenovo/h8/acpi/sleepbutton.asl @@ -20,11 +20,11 @@ Method(_PSW, 1, NotSerialized) { if (Arg0) { - Store(6, FNKY) /* Fn key acts as wake button */ - Store(1, WKFN) + FNKY = 6 /* Fn key acts as wake button */ + WKFN = 1 } else { - Store(0, FNKY) /* Fn key normal operation */ - Store(0, WKFN) + FNKY = 0 /* Fn key normal operation */ + WKFN = 0 } } } diff --git a/src/ec/lenovo/h8/acpi/systemstatus.asl b/src/ec/lenovo/h8/acpi/systemstatus.asl index a5793be..7598154 100644 --- a/src/ec/lenovo/h8/acpi/systemstatus.asl +++ b/src/ec/lenovo/h8/acpi/systemstatus.asl @@ -5,7 +5,7 @@ { Method(_SST, 1, NotSerialized) { - If (LEqual (Arg0, 0)) { + If (Arg0 == 0) { /* Indicator off */
/* power TLED off */ @@ -14,7 +14,7 @@ _SB.PCI0.LPCB.EC.TLED(0x07) }
- If (LEqual (Arg0, 1)) { + If (Arg0 == 1) { /* working state */
/* power TLED on */ @@ -23,7 +23,7 @@ _SB.PCI0.LPCB.EC.TLED(0x07) }
- If (LEqual (Arg0, 2)) { + If (Arg0 == 2) { /* waking state */
/* power LED on */ @@ -32,7 +32,7 @@ _SB.PCI0.LPCB.EC.TLED(0xc7) }
- If (LEqual (Arg0, 3)) { + If (Arg0 == 3) { /* sleep state */
/* power TLED pulsing */ diff --git a/src/ec/lenovo/h8/acpi/thermal.asl b/src/ec/lenovo/h8/acpi/thermal.asl index fe2d287..b72df1e 100644 --- a/src/ec/lenovo/h8/acpi/thermal.asl +++ b/src/ec/lenovo/h8/acpi/thermal.asl @@ -11,13 +11,13 @@
Method(C2K, 1, NotSerialized) { - Multiply(Arg0, 10, Local0) - Add (Local0, 2732, Local0) - if (LLessEqual(Local0, 2732)) { + Local0 = Arg0 * 10 + Local0 += 2732 + if (Local0 < 2732) { Return (3000) }
- if (LGreater(Local0, 4012)) { + if (Local0 > 4012) { Return (3000) } Return (Local0) @@ -46,8 +46,8 @@
/* Get critical temperature in degree celsius */ Method (GCRT, 0, NotSerialized) { - Store (\TCRT, Local0) - if (LGreater (Local0, 0)) { + Local0 = \TCRT + if (Local0 > 0) { Return (Local0) } Return (127) @@ -55,8 +55,8 @@
/* Get passive temperature in degree celsius */ Method (GPSV, 0, NotSerialized) { - Store (\TPSV, Local0) - if (LGreater (Local0, 0)) { + Local0 = \TPSV + if (Local0 > 0) { Return (Local0) } Return (95) @@ -73,23 +73,23 @@ Method(_TMP) { #if defined(EC_LENOVO_H8_ME_WORKAROUND) /* Avoid tripping alarm if ME isn't booted at all yet */ - If (LAnd (LNot (MEB1), LEqual (_SB.PCI0.LPCB.EC.TMP0, 128))) { + If (!MEB1 && (_SB.PCI0.LPCB.EC.TMP0 == 128)) { Return (C2K(40)) } - Store (1, MEB1) + MEB1 = 1 #endif Return (C2K(_SB.PCI0.LPCB.EC.TMP0)) }
Method (_AC0) { - Store (GPSV (), Local0) + Local0 = GPSV ()
/* Active fan 10 degree below passive threshold */ - Subtract (Local0, 10, Local0) + Local0 -= 10
If (\FLVL) { /* Turn of 5 degree below trip point */ - Subtract (Local0, 5, Local0) + Local0 -= 5 }
Return (C2K (Local0)) @@ -113,13 +113,13 @@ */ Method (_ON) { _SB.PCI0.LPCB.EC.FANE(One) - Store (One, \FLVL) + \FLVL = 1 Notify (_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) }
Method (_OFF) { _SB.PCI0.LPCB.EC.FANE(Zero) - Store (Zero, \FLVL) + \FLVL = 0 Notify (_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) } } @@ -160,10 +160,10 @@ Method(_TMP) { #if defined(EC_LENOVO_H8_ME_WORKAROUND) /* Avoid tripping alarm if ME isn't booted at all yet */ - If (LAnd (LNot (MEB2), LEqual (_SB.PCI0.LPCB.EC.TMP1, 128))) { + If (!MEB2 && (_SB.PCI0.LPCB.EC.TMP1 == 128)) { Return (C2K(40)) } - Store (1, MEB2) + MEB2 = 1 #endif Return (C2K(_SB.PCI0.LPCB.EC.TMP1)) } diff --git a/src/ec/lenovo/h8/acpi/thinkpad.asl b/src/ec/lenovo/h8/acpi/thinkpad.asl index eca0d44..944a301 100644 --- a/src/ec/lenovo/h8/acpi/thinkpad.asl +++ b/src/ec/lenovo/h8/acpi/thinkpad.asl @@ -34,16 +34,16 @@ /* Retrieve event. */ Method (MHKP, 0, NotSerialized) { - Store (BTN, Local0) - If (LNotEqual (Local0, Zero)) { - Store (Zero, BTN) - Add (Local0, 0x1000, Local0) + Local0 = BTN + If (Local0 != 0) { + BTN = 0 + Local0 += 0x1000 Return (Local0) } - Store (BTAB, Local0) - If (LNotEqual (Local0, Zero)) { - Store (Zero, BTAB) - Add (Local0, 0x5000, Local0) + Local0 = BTAB + If (Local0 != 0) { + BTAB = 0 + Local0 += 0x5000 Return (Local0) } Return (Zero) @@ -51,18 +51,18 @@
/* Report event */ Method (RHK, 1, NotSerialized) { - ShiftLeft (One, Subtract (Arg0, 1), Local0) - If (And (EMSK, Local0)) { - Store (Arg0, BTN) + Local0 = 1 << (Arg0 - 1) + If (EMSK & Local0) { + BTN = Arg0 Notify (HKEY, 0x80) } }
/* Report tablet */ Method (RTAB, 1, NotSerialized) { - ShiftLeft (One, Subtract (Arg0, 1), Local0) - If (And (ETAB, Local0)) { - Store (Arg0, BTAB) + Local0 = 1 << (Arg0 - 1) + If (ETAB & Local0) { + BTAB = Arg0 Notify (HKEY, 0x80) } } @@ -70,32 +70,32 @@ /* Enable/disable all events. */ Method (MHKC, 1, NotSerialized) { If (Arg0) { - Store (DHKN, EMSK) - Store (Ones, ETAB) + EMSK = DHKN + ETAB = Ones } Else { - Store (Zero, EMSK) - Store (Zero, ETAB) + EMSK = 0 + ETAB = 0 } - Store (Arg0, EN) + EN = Arg0 }
/* Enable/disable event. */ Method (MHKM, 2, NotSerialized) { - If (LLessEqual (Arg0, 0x20)) { - ShiftLeft (One, Subtract (Arg0, 1), Local0) + If (Arg0 <= 0x20) { + Local0 = 1 << (Arg0 - 1) If (Arg1) { - Or (DHKN, Local0, DHKN) + DHKN |= Local0 } Else { - And (DHKN, Not (Local0), DHKN) + DHKN &= ~Local0 } If (EN) { - Store (DHKN, EMSK) + EMSK = DHKN } } } @@ -115,7 +115,7 @@ /* Mute audio */ Method (SSMS, 1, NotSerialized) { - Store(Arg0, ALMT) + ALMT = Arg0 }
/* Control mute microphone LED */ @@ -159,15 +159,15 @@ */ Method (GBDC, 0) { - Store (One, HAST) + HAST = 1
If (HBDC) { - Store(One, Local0) + Local0 = 1 If(_SB.PCI0.LPCB.EC.BTEB) { - Or(Local0, 2, Local0) + Local0 |= 2 } - Or(Local0, ShiftLeft(WBDC, 2), Local0) + Local0 |= WBDC << 2 Return (Local0) } Else { Return (0) @@ -181,13 +181,13 @@ */ Method (SBDC, 1) { - Store (One, HAST) + HAST = 1
If (HBDC) { - ShiftRight (And(Arg0, 2), 1, Local0) - Store (Local0, _SB.PCI0.LPCB.EC.BTEB) - ShiftRight (And(Arg0, 4), 2, Local0) - Store (Local0, WBDC) + Local0 = (Arg0 & 2) >> 1 + _SB.PCI0.LPCB.EC.BTEB = Local0 + Local0 = (Arg0 & 4) >> 2 + WBDC = Local0 } }
@@ -201,15 +201,15 @@ */ Method (GWAN, 0) { - Store (One, HAST) + HAST = 1
If (HWAN) { - Store(One, Local0) + Local0 = 1 If(_SB.PCI0.LPCB.EC.WWEB) { - Or(Local0, 2, Local0) + Local0 |= 2 } - Or(Local0, ShiftLeft(WWAN, 2), Local0) + Local0 |= WWAN << 2 Return (Local0) } Else { Return (0) @@ -223,12 +223,12 @@ */ Method (SWAN, 1) { - Store (One, HAST) + HAST = 1
If (HWAN) { - ShiftRight (And(Arg0, 2), 1, Local0) - Store (Local0, _SB.PCI0.LPCB.EC.WWEB) - ShiftRight (And(Arg0, 4), 2, WWAN) + Local0 = (Arg0 & 2) >> 1 + _SB.PCI0.LPCB.EC.WWEB = Local0 + WWAN = (Arg0 & 4) >> 2 } }
@@ -241,9 +241,9 @@ Method (MLCG, 1) { If (HKBL) { - Store (0x200, Local0) + Local0 = 0x200 /* FIXME: Support 2bit brightness control */ - Or (Local0, _SB.PCI0.LPCB.EC.KBLT, Local0) + Local0 = _SB.PCI0.LPCB.EC.KBLT Return (Local0) } Else { Return (0) @@ -258,7 +258,7 @@ { If (HKBL) { /* FIXME: Support 2bit brightness control */ - Store (And(Arg0, 1), _SB.PCI0.LPCB.EC.WWEB) + _SB.PCI0.LPCB.EC.WWEB = Arg0 & 1 } }
@@ -270,10 +270,10 @@ Method (GUWB, 0) { If (HUWB) { - Store (One, Local0) + Local0 = 1 If(_SB.PCI0.LPCB.EC.UWBE) { - Or(Local0, 2, Local0) + Local0 |= 2 } Return (Local0) } Else { @@ -288,8 +288,8 @@ Method (SUWB, 1) { If (HUWB) { - ShiftRight (And(Arg0, 2), 1, Local0) - Store (Local0, _SB.PCI0.LPCB.EC.UWBE) + Local0 = (Arg0 & 2) >> 1 + _SB.PCI0.LPCB.EC.UWBE = Local0 } }
@@ -299,8 +299,8 @@ Method (WAKE, 1) { If (HAST) { - Store (WBDC, _SB.PCI0.LPCB.EC.BTEB) - Store (WWAN, _SB.PCI0.LPCB.EC.WWEB) + _SB.PCI0.LPCB.EC.BTEB = WBDC + _SB.PCI0.LPCB.EC.WWEB = WWAN } }