HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46106 )
Change subject: ec/smsc/mec1308: Convert to ASL 2.0 syntax ......................................................................
ec/smsc/mec1308: Convert to ASL 2.0 syntax
Change-Id: Ia976d2512df1b9d940c6dc17d74fd46191aaa4aa Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/smsc/mec1308/acpi/battery.asl M src/ec/smsc/mec1308/acpi/ec.asl 2 files changed, 74 insertions(+), 77 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46106/1
diff --git a/src/ec/smsc/mec1308/acpi/battery.asl b/src/ec/smsc/mec1308/acpi/battery.asl index fad69b8..e83ed7d 100644 --- a/src/ec/smsc/mec1308/acpi/battery.asl +++ b/src/ec/smsc/mec1308/acpi/battery.asl @@ -47,24 +47,24 @@ // 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 }
// Swap bytes in a word Method (SWAB, 1, NotSerialized) { - ShiftRight (Arg0, 8, Local0) - ShiftLeft (Arg0, 8, Local1) - And (Local1, 0xFF00, Local1) - Or (Local0, Local1, Local0) - If (LEqual (Local0, 0xFFFF)) { - Store (0xFFFFFFFF, Local0) + Local0 = Arg0 >> 8 + Local1 = Arg0 << 8 + Local1 &= 0xFF00 + Local0 |= Local1 + If (Local0 == 0xFFFF) { + Local0 = 0xFFFFFFFF } Return (Local0) } @@ -81,15 +81,15 @@ Method (_BIF, 0, Serialized) { // Update fields from EC - Store (SWAB (BTDA), Index (PBIF, 1)) - Store (SWAB (BTDF), Index (PBIF, 2)) - Store (SWAB (BTDV), Index (PBIF, 4)) - Store (SWAB (BTDL), Index (PBIF, 6)) + PBIF [1] = SWAB (BTDA) + PBIF [2] = SWAB (BTDF) + PBIF [4] = SWAB (BTDV) + PBIF [6] = SWAB (BTDL)
// Get battery info from mainboard - Store (\BATM, Index (PBIF, 9)) - Store (\BATS, Index (PBIF, 10)) - Store (\BATV, Index (PBIF, 12)) + PBIF [9] = \BATM + PBIF [10] = \BATS + PBIF [12] = \BATV
Return (PBIF) } @@ -105,26 +105,26 @@ //
// Get battery state from EC - Store (BTST, Local0) - Store (Zero, Local1) + Local0 = BTST + Local1 = 0
// Check if AC is present If (ACEX) { // Set only charging/discharging bits - And (Local0, 0x03, Local1) + Local1 = Local0 & 0x03 } Else { // Always discharging when on battery power - Store (0x01, Local1) + Local1 = 0x01 }
// 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
// Notify if battery state has changed since last time - If (LNotEqual (Local1, BSTP)) { - Store (Local1, BSTP) + If (Local1 != BSTP) { + BSTP = Local1 Notify (BAT0, 0x80) }
@@ -132,45 +132,42 @@ // 1: BATTERY PRESENT RATE //
- Store (SWAB (BTPR), Local1) - If (LAnd (LNotEqual (Local1, 0xFFFFFFFF), - LGreaterEqual (Local1, 0x8000))) { - Xor (Local1, 0xFFFF, Local1) - Increment (Local1) + Local1 = SWAB (BTPR) + If ((Local1 != 0xFFFFFFFF) && (Local1 >= 0x8000)) { + Local1 ^= 0xFFFF + Local1++ } - Store (Local1, Index (PBST, 1)) + PBST [1] = Local1
// // 2: BATTERY REMAINING CAPACITY // - Store (SWAB (BTRA), Local1) - If (LAnd (LNotEqual (Local1, 0xFFFFFFFF), - LGreaterEqual (Local1, 0x8000))) { - Xor (Local1, 0xFFFF, Local1) - Increment (Local1) + Local1 = SWAB (BTRA) + If ((Local1 != 0xFFFFFFFF) && (Local1 >= 0x8000)) { + Local1 ^= 0xFFFF + Local1++ }
- If (LAnd (BFWK, LAnd (ACEX, LNot (Local0)))) { + If (BFWK && ACEX && !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 - Store (SWAB (BTDF), Local2) + Local2 = SWAB (BTDF)
// 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 (SWAB (BTVO), Index (PBST, 3)) + PBST [3] = SWAB (BTVO)
Return (PBST) } diff --git a/src/ec/smsc/mec1308/acpi/ec.asl b/src/ec/smsc/mec1308/acpi/ec.asl index c7b180d..6fd8165 100644 --- a/src/ec/smsc/mec1308/acpi/ec.asl +++ b/src/ec/smsc/mec1308/acpi/ec.asl @@ -58,24 +58,24 @@ Method (_REG, 2, NotSerialized) { // Initialize AC power state - Store (ACEX, \PWRS) + \PWRS = ACEX
// Initialize LID switch state - Store (LIDS, \LIDS) + \LIDS = LIDS
// Enable OS control of fan speed - Store (One, FCOS) + FCOS = 1
// Force a read of CPU temperature - Store (CPUT, Local0) + Local0 = CPUT /* So that we don't get a warning that Local0 is unused. */ - Increment (Local0) + Local0++ }
PowerResource (FNP0, 0, 0) { Method (_STA) { - If (LLessEqual (\FLVL, 0)) { + If (\FLVL <= 0) { Return (One) } Else { Return (Zero) @@ -83,15 +83,15 @@ } Method (_ON) { If (FCOS) { - Store (One, FSL0) - Store (0, \FLVL) + FSL0 = 1 + \FLVL = 0 Notify (_TZ.THRM, 0x81) } } Method (_OFF) { If (FCOS) { - Store (Zero, FSL0) - Store (1, \FLVL) + FSL0 = 0 + \FLVL = 1 Notify (_TZ.THRM, 0x81) } } @@ -100,7 +100,7 @@ PowerResource (FNP1, 0, 0) { Method (_STA) { - If (LLessEqual (\FLVL, 1)) { + If (\FLVL <= 1) { Return (One) } Else { Return (Zero) @@ -108,15 +108,15 @@ } Method (_ON) { If (FCOS) { - Store (One, FSL1) - Store (1, \FLVL) + FSL1 = 1 + \FLVL = 1 Notify (_TZ.THRM, 0x81) } } Method (_OFF) { If (FCOS) { - Store (Zero, FSL1) - Store (2, \FLVL) + FSL1 = 0 + \FLVL = 2 Notify (_TZ.THRM, 0x81) } } @@ -125,7 +125,7 @@ PowerResource (FNP2, 0, 0) { Method (_STA) { - If (LLessEqual (\FLVL, 2)) { + If (\FLVL <= 2) { Return (One) } Else { Return (Zero) @@ -133,15 +133,15 @@ } Method (_ON) { If (FCOS) { - Store (One, FSL2) - Store (2, \FLVL) + FSL2 = 1 + \FLVL = 2 Notify (_TZ.THRM, 0x81) } } Method (_OFF) { If (FCOS) { - Store (Zero, FSL2) - Store (3, \FLVL) + FSL2 = 0 + \FLVL = 3 Notify (_TZ.THRM, 0x81) } } @@ -150,7 +150,7 @@ PowerResource (FNP3, 0, 0) { Method (_STA) { - If (LLessEqual (\FLVL, 3)) { + If (\FLVL <= 3) { Return (One) } Else { Return (Zero) @@ -158,15 +158,15 @@ } Method (_ON) { If (FCOS) { - Store (One, FSL3) - Store (3, \FLVL) + FSL3 = 1 + \FLVL = 3 Notify (_TZ.THRM, 0x81) } } Method (_OFF) { If (FCOS) { - Store (Zero, FSL3) - Store (4, \FLVL) + FSL3 = 0 + \FLVL = 4 Notify (_TZ.THRM, 0x81) } } @@ -175,7 +175,7 @@ PowerResource (FNP4, 0, 0) { Method (_STA) { - If (LLessEqual (\FLVL, 4)) { + If (\FLVL <= 4) { Return (One) } Else { Return (Zero) @@ -183,15 +183,15 @@ } Method (_ON) { If (FCOS) { - Store (One, FSL4) - Store (4, \FLVL) + FSL4 = 1 + \FLVL = 4 Notify (_TZ.THRM, 0x81) } } Method (_OFF) { If (FCOS) { - Store (Zero, FSL4) - Store (5, \FLVL) + FSL4 = 0 + \FLVL = 5 Notify (_TZ.THRM, 0x81) } } @@ -235,7 +235,7 @@ // AC Power Connected Method (_Q51, 0, NotSerialized) { - Store (One, \PWRS) + \PWRS = 1 Notify (AC, 0x80) \PNOT () } @@ -243,7 +243,7 @@ // AC Power Removed Method (_Q52, 0, NotSerialized) { - Store (Zero, \PWRS) + \PWRS = 0 Notify (AC, 0x80) \PNOT () } @@ -271,14 +271,14 @@ // Lid Switch Event Method (_Q5E, 0, NotSerialized) { - Store (LIDS, \LIDS) + \LIDS = LIDS Notify (_SB.LID0, 0x80) }
// Lid Switch Event Method (_Q5F, 0, NotSerialized) { - Store (LIDS, \LIDS) + \LIDS = LIDS Notify (_SB.LID0, 0x80) }