HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46104 )
Change subject: ec/quanta/it8518: Convert to ASL 2.0 syntax ......................................................................
ec/quanta/it8518: Convert to ASL 2.0 syntax
Change-Id: I990e9bf3bb8663b245c98d1a3b24eb4afba0433f Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/quanta/it8518/acpi/ac.asl M src/ec/quanta/it8518/acpi/battery.asl M src/ec/quanta/it8518/acpi/ec.asl 3 files changed, 71 insertions(+), 72 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/46104/1
diff --git a/src/ec/quanta/it8518/acpi/ac.asl b/src/ec/quanta/it8518/acpi/ac.asl index 4da27e0..f88baef 100644 --- a/src/ec/quanta/it8518/acpi/ac.asl +++ b/src/ec/quanta/it8518/acpi/ac.asl @@ -9,7 +9,7 @@
Method (_PSR) { - Store(ACPW, Local0) + Local0 = ACPW Return(Local0) }
diff --git a/src/ec/quanta/it8518/acpi/battery.asl b/src/ec/quanta/it8518/acpi/battery.asl index 79a1da3..838f943 100644 --- a/src/ec/quanta/it8518/acpi/battery.asl +++ b/src/ec/quanta/it8518/acpi/battery.asl @@ -49,26 +49,26 @@ // 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 to wait for EC to be ready after changing the Battery Info ID // Selector Method (WAEC) { - Store (20, Local0) // Timeout 100 msec - While (LEqual (HSID, Zero)) + Local0 = 20 // Timeout 100 msec + While (HSID == 0) { // EC Is not ready Sleep (5) - Decrement (Local0) - If (LEqual (Local0, Zero)) + Local0-- + If (Local0 == 0) { Break } @@ -78,7 +78,7 @@ // Battery Slot Status Method (_STA, 0, Serialized) { - Store (MBTS, BXST) + BXST = MBTS If (BXST) { // Battery is present @@ -97,7 +97,7 @@ // // Information ID 1 - // - Store (One, HIID) + HIID = 1 WAEC ()
// @@ -105,13 +105,13 @@ // SMART battery : 1 - 10mWh : 0 - mAh // ACPI spec : 0 - mWh : 1 - mAh // - Store(SBCM, Local7) - XOr (Local7, One, Index (PBIF, 0)) + Local7 = SBCM + PBIF [0] = Local7 ^ 1
// // Information ID 0 - // - Store (Zero, HIID) + HIID = 0 WAEC ()
// @@ -119,17 +119,17 @@ // If (Local7) { - Multiply (SBFC, 10, Index (PBIF, 2)) + PBIF [2] = SBFC * 10 } Else { - Store (SBFC, Index (PBIF, 2)) + PBIF [2] = SBFC }
// // Information ID 2 - // - Store (2, HIID) + HIID = 2 WAEC ()
// @@ -137,63 +137,63 @@ // If (Local7) { - Multiply (SBDC, 10, Local0) + Local0 = SBDC * 10 } Else { - Store (SBDC, Local0) + Local0 = SBDC } - Store (Local0, Index(PBIF, One)) + PBIF [1] = Local0
// // Design capacity of High (5%) // Design capacity of Low (1%) // - Divide (Local0, 20, , Index (PBIF, 5)) - Divide (Local0, 100, , Index (PBIF, 6)) + PBIF [5] = Local0 / 20 + PBIF [6] = Local0 / 100
// // Design voltage // - Store (SBDV, Index (PBIF, 4)) + PBIF [4] = SBDV
// // Serial Number // - Store (ToHexString (SBSN), Index (PBIF, 10)) + PBIF [10] = ToHexString (SBSN)
// // Information ID 4 - // - Store (4, HIID) + HIID = 4 WAEC ()
// // Battery Type - Device Chemistry // - Store (ToString (Concatenate(SBCH, 0x00)), Index (PBIF, 11)) + PBIF [11] = ToString (Concatenate(SBCH, 0x00))
// // Information ID 5 - // - Store (5, HIID) + HIID = 5 WAEC ()
// // OEM Information - Manufacturer Name // - Store (ToString (Concatenate(SBMN, 0x00)), Index (PBIF, 12)) + PBIF [12] = ToString (Concatenate(SBMN, 0x00))
// // Information ID 6 - // - Store (6, HIID) + HIID = 6 WAEC ()
// // Model Number - Device Name // - Store (ToString (Concatenate(SBDN, 0x00)), Index (PBIF, 9)) + PBIF [9] = ToString (Concatenate(SBDN, 0x00))
Return (PBIF) } @@ -216,80 +216,80 @@ //
// Get battery state from EC - If (And (HB0S, 0x20)) + If (HB0S & 0x20) { - Store (2, Local0) + Local0 = 2 } Else { - if (And (HB0S, 0x40)) + if (HB0S & 0x40) { - Store (One, Local0) + Local0 = 1 } Else { - Store (Zero, Local0) + Local0 = 0 } }
// Set critical flag if battery is empty - If (LEqual (And (HB0S, 0x0F), 0)) + If ((HB0S & 0x0F) == 0) { - Or (Local0, 4, Local0) + Local0 |= 4 }
- Store (Zero, Local1) + Local1 = 0
// Check if AC is present If (ACPW) { // Set only charging/discharging bits - And (Local0, 0x03, Local1) + Local1 = Local0 & 0x03 } Else { // Always discharging when on battery power - Store (One, Local1) + Local1 = 1 }
// Flag if the battery level is critical - And (Local0, 0x04, Local4) - Or (Local1, Local4, Local1) - Store (Local1, Index (PBST, 0)) + Local4 = Local0 & 0x04 + Local1 |= Local4 + PBST [0] = Local1
// // 1: BATTERY PRESENT RATE/CURRENT // - Store (ECAC, Local1) - If (LGreaterEqual (Local1, 0x8000)) + Local1 = ECAC + If (Local1 >= 0x8000) { - If (And (Local0, 1)) + If (Local0 & 1) { - Subtract (0x10000, Local1, Local1) + Local1 = 0x10000 - Local1 } Else { // Error - Store (Zero, Local1) + Local1 = 0 } } Else { - If (LNot (AND (Local0, 2))) + If (!(Local0 & 2)) { // Battery is not charging - Store (Zero, Local1) + Local1 = 0 } }
- XOr (DerefOf (Index (PBIF, Zero)), One, Local6) + Local6 = DerefOf (PBIF [0]) ^ 1
If (Local6) { - Multiply (ECVO, Local1, Local1) - Divide (Local1, 1000, , Local1) + Local1 *= ECVO + Local1 /= 1000 } - Store (Local1, Index (PBST, One)) + PBST [1] = Local1
// // 2: BATTERY REMAINING CAPACITY @@ -299,36 +299,35 @@ // ACPI spec : 0 - mWh : 1 - mAh If (Local6) { - Multiply (ECRC, 10, Local1) + Local1 = ECRC * 10 } Else { - Store (ECRC, Local1) + Local1 = ECRC }
- If (LAnd (BFWK, LAnd (ACPW, LNot (Local0)))) + If (BFWK && ACPW && !Local0) { // 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 // TODO: Is SBRS the "battery gas gauge"? - Store (SBRS, Local2) + Local2 = SBRS
// See if within ~3% of full - ShiftRight (Local2, 5, Local3) - If (LAnd (LGreater (Local1, Subtract (Local2, Local3)), - LLess (Local1, Add (Local2, Local3)))) + Local3 = Local2 >> 5 + If ((Local1 > (Local2 - Local3)) && (Local1 < (Local2 + Local3))) { - Store (Local2, Local1) + Local1 = Local2 } } - Store (Local1, Index (PBST, 2)) + PBST [2] = Local1
// // 3: BATTERY PRESENT VOLTAGE // - Store (ECVO, Index (PBST, 3)) + PBST [3] = ECVO
Return (PBST) } diff --git a/src/ec/quanta/it8518/acpi/ec.asl b/src/ec/quanta/it8518/acpi/ec.asl index a3598be..6b368c3 100644 --- a/src/ec/quanta/it8518/acpi/ec.asl +++ b/src/ec/quanta/it8518/acpi/ec.asl @@ -544,19 +544,19 @@ Method (_REG, 2, NotSerialized) { // Initialize AC power state - Store (ACPW, \PWRS) + \PWRS = ACPW
// Initialize LID switch state - Store (NOT(HPLD), \LIDS) + \LIDS = ~HPLD
// Enable OS control of fan speed - // TODO Store (One, FCOS) + // TODO FCOS = 1
// Force a read of CPU temperature // TODO Which temperature corresponds to the CPU? - Store (TMP0, Local0) + Local0 = TMP0 /* So that we don't get a warning that Local0 is unused. */ - Increment (Local0) + Local0++
}
@@ -594,7 +594,7 @@ // AC Power Connected Method (_Q26, 0, NotSerialized) { - Store (One, \PWRS) + \PWRS = 1 Notify (AC, 0x80) Notify (BATX, 0x80) \PNOT () @@ -603,7 +603,7 @@ // AC Power Removed Method (_Q27, 0, NotSerialized) { - Store (Zero, \PWRS) + \PWRS = 0 Notify (AC, 0x80) \PNOT () } @@ -611,14 +611,14 @@ // LID Open Method (_Q2A) { - Store (One, \LIDS) + \LIDS = 1 Notify (_SB.LID0, 0x80) }
// LID Close (Suspend Trigger) Method (_Q2B) { - Store (Zero, \LIDS) + \LIDS = 0 Notify (_SB.LID0, 0x80) }
@@ -641,7 +641,7 @@ { IF (DCWL) //if Wlan exist { - //TODO Store (WLAT, LANE) + //TODO LANE = WLAT } }