HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46097 )
Change subject: ec/google/chromeec: Convert to ASL 2.0 syntax ......................................................................
ec/google/chromeec: Convert to ASL 2.0 syntax
Change-Id: Ia35c8e0dac7a36deea62b2ffdc3ebc86d3aafa50 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/google/chromeec/acpi/battery.asl M src/ec/google/chromeec/acpi/ec.asl M src/ec/google/chromeec/acpi/keyboard_backlight.asl M src/ec/google/chromeec/acpi/tbmc.asl 4 files changed, 115 insertions(+), 116 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/46097/1
diff --git a/src/ec/google/chromeec/acpi/battery.asl b/src/ec/google/chromeec/acpi/battery.asl index d9304c1..9e5356f 100644 --- a/src/ec/google/chromeec/acpi/battery.asl +++ b/src/ec/google/chromeec/acpi/battery.asl @@ -11,25 +11,25 @@ Method (BTSW, 1) { #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE - If (LEqual (BTIX, Arg0)) { + If (BTIX == Arg0) { Return (Zero) } - If (LGreaterEqual (Arg0, BTCN)) { + If (Arg0 >= BTCN) { Return (One) } - Store (Arg0, _SB.PCI0.LPCB.EC0.BTID) - Store (5, Local0) // Timeout 5 msec - While (LNotEqual (BTIX, Arg0)) + _SB.PCI0.LPCB.EC0.BTID = Arg0 + Local0 = 5 // Timeout 5 msec + While (BTIX != Arg0) { Sleep (1) - Decrement (Local0) - If (LEqual (Local0, Zero)) + Local0-- + If (Local0 == 0) { Return (One) } } #else - If (LNotEqual (0, Arg0)) { + If (Arg0 != 0) { Return (One) } #endif @@ -44,10 +44,10 @@ Return (Zero) }
- If (And(Not(BTSW (Arg0)), BTEX)) { - Store (0x1F, Local0) + If (!BTSW (Arg0) & BTEX) { + Local0 = 0x1F } Else { - Store (0x0F, Local0) + Local0 = 0x0F }
Release (^BATM) @@ -68,27 +68,27 @@ Return (Arg1) } // Last Full Charge Capacity - Store (BTDF, Index (Arg1, 2)) + Arg1 [2] = BTDF
// Design Voltage - Store (BTDV, Index (Arg1, 4)) + Arg1 [4] = BTDV
// Design Capacity - Store (BTDA, Local0) - Store (Local0, Index (Arg1, 1)) + Local0 = BTDA + Arg1 [1] = Local0
// Design Capacity of Warning - Divide (Multiply (Local0, DWRN), 100, , Local2) - Store (Local2, Index (Arg1, 5)) + Local2 = (Local0 * DWRN) / 100 + Arg1 [5] = Local2
// Design Capacity of Low - Divide (Multiply (Local0, DLOW), 100, , Local2) - Store (Local2, Index (Arg1, 6)) + Local2 = (Local0 * DLOW) / 100 + Arg1 [6] = Local2
// Get battery info from mainboard - Store (ToString(Concatenate(BMOD, 0x00)), Index (Arg1, 9)) - Store (ToString(Concatenate(BSER, 0x00)), Index (Arg1, 10)) - Store (ToString(Concatenate(BMFG, 0x00)), Index (Arg1, 12)) + Arg1 [9] = ToString (Concatenate (BMOD, 0x00)) + Arg1 [10] = ToString (Concatenate (BSER, 0x00)) + Arg1 [12] = ToString (Concatenate (BMFG, 0x00))
Release (^BATM) Return (Arg1) @@ -108,30 +108,30 @@ Return (Arg1) } // Last Full Charge Capacity - Store (BTDF, Index (Arg1, 3)) + Arg1 [3] = BTDF
// Design Voltage - Store (BTDV, Index (Arg1, 5)) + Arg1 [5] = BTDV
// Design Capacity - Store (BTDA, Local0) - Store (Local0, Index (Arg1, 2)) + Local0 = BTDA + Arg1 [2] = Local0
// Design Capacity of Warning - Divide (Multiply (Local0, DWRN), 100, , Local2) - Store (Local2, Index (Arg1, 6)) + Local2 = (Local0 * DWRN) / 100 + Arg1 [6] = Local2
// Design Capacity of Low - Divide (Multiply (Local0, DLOW), 100, , Local2) - Store (Local2, Index (Arg1, 7)) + Local2 = (Local0 * DLOW) / 100 + Arg1 [7] = Local2
// Cycle Count - Store (BTCC, Index (Arg1, 8)) + Arg1 [8] = BTCC
// Get battery info from mainboard - Store (ToString(Concatenate(BMOD, 0x00)), Index (Arg1, 16)) - Store (ToString(Concatenate(BSER, 0x00)), Index (Arg1, 17)) - Store (ToString(Concatenate(BMFG, 0x00)), Index (Arg1, 19)) + Arg1 [16] = ToString (Concatenate (BMOD, 0x00)) + Arg1 [17] = ToString (Concatenate (BSER, 0x00)) + Arg1 [19] = ToString (Concatenate (BMFG, 0x00))
Release (^BATM) Return (Arg1) @@ -159,30 +159,30 @@ // bit 1 = charging // bit 2 = critical level // - Store (Zero, Local1) + Local1 = 0
// Check if AC is present If (ACEX) { If (BFCG) { - Store (0x02, Local1) + Local1 = 0x02 } ElseIf (BFDC) { - Store (0x01, Local1) + Local1 = 0x01 } } Else { // Always discharging when on battery power - Store (0x01, Local1) + Local1 = 0x01 }
// Check for critical battery level If (BFCR) { - Or (Local1, 0x04, Local1) + Local1 |= Local1 } - Store (Local1, Index (Arg1, 0)) + Arg1 [0] = Local1
// Notify if battery state has changed since last time - If (LNotEqual (Local1, DeRefOf (Arg2))) { - Store (Local1, Arg2) - If (LEqual(Arg0, 0)) { + If (Local1 != DeRefOf (Arg2)) { + Arg2 = Local1 + If (Arg0 == 0) { Notify (BAT0, 0x80) } #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE @@ -195,33 +195,32 @@ // // 1: BATTERY PRESENT RATE // - Store (BTPR, Index (Arg1, 1)) + Arg1 [1] = BTPR
// // 2: BATTERY REMAINING CAPACITY // - Store (BTRA, Local1) - If (LAnd (Arg3, LAnd (ACEX, LNot (LAnd (BFDC, BFCG))))) { + Local1 = BTRA + If (Arg3 && ACEX && !(BFDC && BFCG)) { // On AC power and battery is neither charging // nor discharging. Linux expects a full battery // to report same capacity as last full charge. // https://bugzilla.kernel.org/show_bug.cgi?id=12632 - Store (BTDF, Local2) + Local2 = BTDF
// See if within ~6% of full - ShiftRight (Local2, 4, Local3) - If (LAnd (LGreater (Local1, Subtract (Local2, Local3)), - LLess (Local1, Add (Local2, Local3)))) + Local3 = Local2 >> 4 + If (Local1 > (Local2 - Local3) && Local1 < (Local2 + Local3)) { - Store (Local2, Local1) + Local1 = Local2 } } - Store (Local1, Index (Arg1, 2)) + Arg1 [2] = Local1
// // 3: BATTERY PRESENT VOLTAGE // - Store (BTVO, Index (Arg1, 3)) + Arg1 [3] = BTVO
Release (^BATM) Return (Arg1) @@ -286,13 +285,13 @@ // Method to enable full battery workaround Method (BFWE) { - Store (One, BFWK) + BFWK = 1 }
// Method to disable full battery workaround Method (BFWD) { - Store (Zero, BFWK) + BFWK = 0 }
Method (_STA, 0, Serialized) @@ -376,13 +375,13 @@ // Method to enable full battery workaround Method (BFWE) { - Store (One, BFWK) + BFWK = 1 }
// Method to disable full battery workaround Method (BFWD) { - Store (Zero, BFWK) + BFWK = 0 }
Method (_STA, 0, Serialized) diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl index d12274f..be9c213 100644 --- a/src/ec/google/chromeec/acpi/ec.asl +++ b/src/ec/google/chromeec/acpi/ec.asl @@ -149,7 +149,7 @@ Method (_REG, 2, NotSerialized) { // Initialize AC power state - Store (ACEX, \PWRS) + \PWRS = ACEX /* * Inform platform code about the current AC power state. * This allows the platform to take any action based on the initialized state. @@ -158,7 +158,7 @@ \PNOT ()
// Initialize LID switch state - Store (LIDS, \LIDS) + \LIDS = LIDS
#ifdef EC_ENABLE_AMD_DPTC_SUPPORT /* @@ -175,33 +175,33 @@ /* Read requested temperature and check against EC error values */ Method (TSRD, 1, Serialized) { - Store (_SB.PCI0.LPCB.EC0.TINS (Arg0), Local0) + Local0 = _SB.PCI0.LPCB.EC0.TINS (Arg0)
/* Check for sensor not calibrated */ - If (LEqual (Local0, _SB.PCI0.LPCB.EC0.TNCA)) { + If (Local0 == _SB.PCI0.LPCB.EC0.TNCA) { Return (Zero) }
/* Check for sensor not present */ - If (LEqual (Local0, _SB.PCI0.LPCB.EC0.TNPR)) { + If (Local0 == _SB.PCI0.LPCB.EC0.TNPR) { Return (Zero) }
/* Check for sensor not powered */ - If (LEqual (Local0, _SB.PCI0.LPCB.EC0.TNOP)) { + If (Local0 == _SB.PCI0.LPCB.EC0.TNOP) { Return (Zero) }
/* Check for sensor bad reading */ - If (LEqual (Local0, _SB.PCI0.LPCB.EC0.TBAD)) { + If (Local0 == _SB.PCI0.LPCB.EC0.TBAD) { Return (Zero) }
/* Adjust by offset to get Kelvin */ - Add (_SB.PCI0.LPCB.EC0.TOFS, Local0, Local0) + Local0 += _SB.PCI0.LPCB.EC0.TOFS
/* Convert to 1/10 Kelvin */ - Multiply (Local0, 10, Local0) + Local0 *= 10
Return (Local0) } @@ -209,8 +209,8 @@ // Lid Closed Event Method (_Q01, 0, NotSerialized) { - Store ("EC: LID CLOSE", Debug) - Store (LIDS, \LIDS) + Debug = "EC: LID CLOSE" + \LIDS = LIDS #ifdef EC_ENABLE_LID_SWITCH Notify (LID0, 0x80) #endif @@ -219,8 +219,8 @@ // Lid Open Event Method (_Q02, 0, NotSerialized) { - Store ("EC: LID OPEN", Debug) - Store (LIDS, \LIDS) + Debug = "EC: LID OPEN" + \LIDS = LIDS Notify (CREC, 0x2) #ifdef EC_ENABLE_LID_SWITCH Notify (LID0, 0x80) @@ -230,14 +230,14 @@ // Power Button Method (_Q03, 0, NotSerialized) { - Store ("EC: POWER BUTTON", Debug) + Debug = "EC: POWER BUTTON" }
// AC Connected Method (_Q04, 0, NotSerialized) { - Store ("EC: AC CONNECTED", Debug) - Store (ACEX, \PWRS) + Debug = "EC: AC CONNECTED" + \PWRS = ACEX Notify (AC, 0x80) #ifdef DPTF_ENABLE_CHARGER If (CondRefOf (_SB.DPTF.TCHG)) { @@ -250,8 +250,8 @@ // AC Disconnected Method (_Q05, 0, NotSerialized) { - Store ("EC: AC DISCONNECTED", Debug) - Store (ACEX, \PWRS) + Debug = "EC: AC DISCONNECTED" + \PWRS = ACEX Notify (AC, 0x80) #ifdef DPTF_ENABLE_CHARGER If (CondRefOf (_SB.DPTF.TCHG)) { @@ -264,21 +264,21 @@ // Battery Low Event Method (_Q06, 0, NotSerialized) { - Store ("EC: BATTERY LOW", Debug) + Debug = "EC: BATTERY LOW" Notify (BAT0, 0x80) }
// Battery Critical Event Method (_Q07, 0, NotSerialized) { - Store ("EC: BATTERY CRITICAL", Debug) + Debug = "EC: BATTERY CRITICAL" Notify (BAT0, 0x80) }
// Battery Info Event Method (_Q08, 0, NotSerialized) { - Store ("EC: BATTERY INFO", Debug) + Debug = "EC: BATTERY INFO" Notify (BAT0, 0x81) #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE If (CondRefOf (BAT1)) { @@ -290,41 +290,41 @@ // Thermal Overload Event Method (_Q0A, 0, NotSerialized) { - Store ("EC: THERMAL OVERLOAD", Debug) + Debug = "EC: THERMAL OVERLOAD" Notify (_TZ, 0x80) }
// Thermal Event Method (_Q0B, 0, NotSerialized) { - Store ("EC: THERMAL", Debug) + Debug = "EC: THERMAL" Notify (_TZ, 0x80) }
// USB Charger Method (_Q0C, 0, NotSerialized) { - Store ("EC: USB CHARGER", Debug) + Debug = "EC: USB CHARGER" }
// Key Pressed Method (_Q0D, 0, NotSerialized) { - Store ("EC: KEY PRESSED", Debug) + Debug = "EC: KEY PRESSED" Notify (CREC, 0x2) }
// Thermal Shutdown Imminent Method (_Q10, 0, NotSerialized) { - Store ("EC: THERMAL SHUTDOWN", Debug) + Debug = "EC: THERMAL SHUTDOWN" Notify (_TZ, 0x80) }
// Battery Shutdown Imminent Method (_Q11, 0, NotSerialized) { - Store ("EC: BATTERY SHUTDOWN", Debug) + Debug = "EC: BATTERY SHUTDOWN" Notify (BAT0, 0x80) }
@@ -332,7 +332,7 @@ Method (_Q12, 0, NotSerialized) { #ifdef EC_ENABLE_THROTTLING_HANDLER - Store ("EC: THROTTLE START", Debug) + Debug = "EC: THROTTLE START" _TZ.THRT (1) #endif } @@ -341,7 +341,7 @@ Method (_Q13, 0, NotSerialized) { #ifdef EC_ENABLE_THROTTLING_HANDLER - Store ("EC: THROTTLE STOP", Debug) + Debug = "EC: THROTTLE STOP" _TZ.THRT (0) #endif } @@ -350,7 +350,7 @@ // PD event Method (_Q16, 0, NotSerialized) { - Store ("EC: GOT PD EVENT", Debug) + Debug = "EC: GOT PD EVENT" Notify (_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) } #endif @@ -358,7 +358,7 @@ // Battery Status Method (_Q17, 0, NotSerialized) { - Store ("EC: BATTERY STATUS", Debug) + Debug = "EC: BATTERY STATUS" Notify (BAT0, 0x80) #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE If (CondRefOf (BAT1)) { @@ -370,7 +370,7 @@ // MKBP interrupt. Method (_Q1B, 0, NotSerialized) { - Store ("EC: MKBP", Debug) + Debug = "EC: MKBP" Notify (CREC, 0x80) }
@@ -378,7 +378,7 @@ // USB MUX Interrupt Method (_Q1C, 0, NotSerialized) { - Store ("EC: USB MUX", Debug) + Debug = "EC: USB MUX" Notify (_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) } #endif @@ -386,7 +386,7 @@ // TABLET mode switch Event Method (_Q1D, 0, NotSerialized) { - Store ("EC: TABLET mode switch Event", Debug) + Debug = "EC: TABLET mode switch Event" Notify (CREC, 0x2) #ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES _SB.DPTF.TPET() @@ -420,16 +420,16 @@ }
/* Set sensor ID */ - Store (ToInteger (Arg0), ^PATI) + ^PATI = ToInteger (Arg0)
/* Temperature is passed in 1/10 Kelvin */ - Divide (ToInteger (Arg1), 10, , Local1) + Local1 = ToInteger (Arg1) / 10
/* Adjust by EC temperature offset */ - Subtract (Local1, ^TOFS, ^PATT) + ^PATT = Local1 - ^TOFS
/* Set commit value with SELECT=0 and ENABLE=1 */ - Store (0x02, ^PATC) + ^PATC = 0x02
Release (^PATM) Return (1) @@ -447,16 +447,16 @@ }
/* Set sensor ID */ - Store (ToInteger (Arg0), ^PATI) + ^PATI = ToInteger (Arg0)
/* Temperature is passed in 1/10 Kelvin */ - Divide (ToInteger (Arg1), 10, , Local1) + Local1 = ToInteger (Arg1) / 10
/* Adjust by EC temperature offset */ - Subtract (Local1, ^TOFS, ^PATT) + ^PATT = Local1 - ^TOFS
/* Set commit value with SELECT=1 and ENABLE=1 */ - Store (0x03, ^PATC) + ^PATC = 0x03
Release (^PATM) Return (1) @@ -471,14 +471,14 @@ Return (0) }
- Store (ToInteger (Arg0), ^PATI) - Store (0x00, ^PATT) + ^PATI = ToInteger (Arg0) + ^PATT = 0x00
/* Disable PAT0 */ - Store (0x00, ^PATC) + ^PATC = 0x00
/* Disable PAT1 */ - Store (0x01, ^PATC) + ^PATC = 0x01
Release (^PATM) Return (1) @@ -489,9 +489,9 @@ */ Method (_Q09, 0, NotSerialized) { - If (LNot(Acquire (^PATM, 1000))) { + If (!Acquire (^PATM, 1000)) { /* Read sensor ID for event */ - Store (^PATI, Local0) + Local0 = ^PATI
/* When sensor ID returns 0xFF then no more events */ While (LNotEqual (Local0, EC_TEMP_SENSOR_NOT_PRESENT)) @@ -501,7 +501,7 @@ #endif
/* Keep reaading sensor ID for event */ - Store (^PATI, Local0) + Local0 = ^PATI }
Release (^PATM) @@ -514,7 +514,7 @@ */ Method (CHGS, 1, Serialized) { - Store (ToInteger (Arg0), ^CHGL) + ^CHGL = ToInteger (Arg0) }
/* @@ -522,7 +522,7 @@ */ Method (CHGD, 0, Serialized) { - Store (0xFF, ^CHGL) + ^CHGL = 0xFF }
/* Read current Tablet mode */ @@ -539,10 +539,10 @@ * DDPN = 0 is reserved for backwards compatibility. * If DDPN == 0 use TBMD to load appropriate DPTF table. */ - If (LEqual (^DDPN, 0)) { + If (^DDPN == 0) { Return (^TBMD) } Else { - Subtract (^DDPN, 1, Local0) + Local0 = ^DDPN - 1 Return (Local0) } } @@ -554,7 +554,7 @@ */ Method (UPPS, 1, Serialized) { - Or (USPP, ShiftLeft (1, Arg0), USPP) + USPP |= 1 << Arg0 }
/* @@ -563,7 +563,7 @@ */ Method (UPPC, 1, Serialized) { - And (USPP, Not (ShiftLeft (1, Arg0)), USPP) + USPP &= ~(1 << Arg0) } #endif
diff --git a/src/ec/google/chromeec/acpi/keyboard_backlight.asl b/src/ec/google/chromeec/acpi/keyboard_backlight.asl index 2d4a0c5..87be075 100644 --- a/src/ec/google/chromeec/acpi/keyboard_backlight.asl +++ b/src/ec/google/chromeec/acpi/keyboard_backlight.asl @@ -23,11 +23,11 @@ /* If query is unsupported, but this code is compiled * in, assume the backlight exists physically. */ - If (LEqual (1, _SB.PCI0.LPCB.EC0.DFUD)) { + If (_SB.PCI0.LPCB.EC0.DFUD == 1) { Return (0xf) } /* If EC reports that backlight exists, trust it */ - If (LEqual (1, _SB.PCI0.LPCB.EC0.KBLE)) { + If (_SB.PCI0.LPCB.EC0.KBLE == 1) { Return (0xf) } /* Otherwise: no device -> disable */ @@ -43,7 +43,7 @@ /* Write new backlight value */ Method (KBCM, 1, NotSerialized) { - Store (Arg0, _SB.PCI0.LPCB.EC0.KBLV) + _SB.PCI0.LPCB.EC0.KBLV = Arg0 } } } diff --git a/src/ec/google/chromeec/acpi/tbmc.asl b/src/ec/google/chromeec/acpi/tbmc.asl index 7be50d7..1661296 100644 --- a/src/ec/google/chromeec/acpi/tbmc.asl +++ b/src/ec/google/chromeec/acpi/tbmc.asl @@ -7,7 +7,7 @@ Name (_DDN, "Tablet Motion Control") Method (TBMC) { - If (LEqual (^^RCTM, One)) { + If (^^RCTM == 1) { Return (0x1) } Else { Return (0x0)
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46097
to look at the new patch set (#3).
Change subject: ec/google/chromeec: Convert to ASL 2.0 syntax ......................................................................
ec/google/chromeec: Convert to ASL 2.0 syntax
Change-Id: Ia35c8e0dac7a36deea62b2ffdc3ebc86d3aafa50 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/google/chromeec/acpi/battery.asl M src/ec/google/chromeec/acpi/ec.asl M src/ec/google/chromeec/acpi/keyboard_backlight.asl M src/ec/google/chromeec/acpi/tbmc.asl 4 files changed, 115 insertions(+), 116 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/46097/3