HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46103 )
Change subject: ec/quanta/ene_kb3940q: Convert to ASL 2.0 syntax ......................................................................
ec/quanta/ene_kb3940q: Convert to ASL 2.0 syntax
Change-Id: Ifc90fb7707c07f2f364e1fdd710fe52522e8ab5e Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/ec/quanta/ene_kb3940q/acpi/ac.asl M src/ec/quanta/ene_kb3940q/acpi/battery.asl M src/ec/quanta/ene_kb3940q/acpi/ec.asl 3 files changed, 60 insertions(+), 61 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46103/1
diff --git a/src/ec/quanta/ene_kb3940q/acpi/ac.asl b/src/ec/quanta/ene_kb3940q/acpi/ac.asl index b086bf5..cc14b33 100644 --- a/src/ec/quanta/ene_kb3940q/acpi/ac.asl +++ b/src/ec/quanta/ene_kb3940q/acpi/ac.asl @@ -9,7 +9,7 @@
Method (_PSR) { - Store(ADPT, Local0) + Local0 = ADPT Return(Local0) }
diff --git a/src/ec/quanta/ene_kb3940q/acpi/battery.asl b/src/ec/quanta/ene_kb3940q/acpi/battery.asl index 09c1b29..b5a7db7 100644 --- a/src/ec/quanta/ene_kb3940q/acpi/battery.asl +++ b/src/ec/quanta/ene_kb3940q/acpi/battery.asl @@ -44,13 +44,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 }
// Device insertion/removal control method that returns a device's status. @@ -68,18 +68,18 @@ Method (_BIF, 0, Serialized) { // Update fields from EC - Store (BDC0, Index (PBIF, 1)) // Batt Design Capacity - Store (BFC0, Index (PBIF, 2)) // Batt Last Full Charge Capacity - Store (BDV0, Index (PBIF, 4)) // Batt Design Voltage - Divide(BFC0, 0x64, , Local1) - Multiply(Local1, 0x0A, Local0) - Store(Local0, Index(PBIF, 5)) - Multiply(Local1, 0x05, Local0) - Store (Local0, Index (PBIF, 6)) - Store (ToString(Concatenate(BATD, 0x00)), Index (PBIF, 9)) // Model Number - Store (ToDecimalString(BSN0), Index (PBIF, 10)) // Serial Number - Store (ToString(Concatenate(BCHM, 0x00)), Index (PBIF, 11)) // Battery Type - Store (\BATV, Index (PBIF, 12)) // OEM information + PBIF [1] = BDC0 // Batt Design Capacity + PBIF [2] = BFC0 // Batt Last Full Charge Capacity + PBIF [4] = BDV0 // Batt Design Voltage + Local1 = BFC0 / 100 + Local0 *= 10 + PBIF [5] = Local0 + Local0 = Local1 * 5 + PBIF [6] = Local0 + PBIF [9] = ToString (Concatenate (BATD, 0x00)) // Model Number + PBIF [10] = ToDecimalString(BSN0) // Serial Number + PBIF [11] = ToString (Concatenate (BCHM, 0x00)) // Battery Type + PBIF [12] = \BATV // OEM information
Return (PBIF) } @@ -95,45 +95,44 @@ //
// Get battery state from EC - Store (BST0, Local0) - Store (Local0, Index (PBST, 0)) + Local0 = BST0 + PBST [0] = Local0
// // 1: BATTERY PRESENT RATE/CURRENT // - Store (BPC0, Local1) - If (LAnd (Local1, 0x8000)) { - Xor (Local1, 0xFFFF, Local1) - Increment (Local1) + Local1 = BPC0 + If (Local1 && 0x8000) { + Local1 ^= 0xFFFF + Local1++ } - Store (Local1, Index (PBST, 1)) + PBST [1] = Local1
// // 2: BATTERY REMAINING CAPACITY // Store (BRC0, Local1)
- If (LAnd (BFWK, LAnd (ADPT, LNot (Local0)))) { + If (BFWK && ADPT && !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 (BFC0, Local2) + Local2 = BFC0
// 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 (BPV0, Index (PBST, 3)) + PBST [3] = BPV0
Return (PBST) } diff --git a/src/ec/quanta/ene_kb3940q/acpi/ec.asl b/src/ec/quanta/ene_kb3940q/acpi/ec.asl index 9d8cc28..d43ec27 100644 --- a/src/ec/quanta/ene_kb3940q/acpi/ec.asl +++ b/src/ec/quanta/ene_kb3940q/acpi/ec.asl @@ -122,26 +122,26 @@ Method (_REG, 2, NotSerialized) { // Initialize AC power state - Store (ADPT, \PWRS) + \PWRS = ADPT
// Initialize LID switch state - Store (LIDF, \LIDS) + \LIDS = LIDF
// Force a read of CPU temperature - Store (CTMP, Local0) + Local0 = CTMP
// Use Local0 to avoid iasl warning: Method Local is set but never used - And(Local0, Ones, Local0) + Local0 &= Ones
// Find and program number of P-States - Store (SizeOf (_SB.CP00._PSS), MPST) - Store ("Programming number of P-states: ", Debug) - Store (MPST, Debug) + MPST = SizeOf (_SB.CP00._PSS) + Debug = "Programming number of P-states: " + Debug = MPST
// Find and program the current P-State - Store(_SB.CP00._PPC, NPST) - Store ("Programming Current P-state: ", Debug) - Store (NPST, Debug) + NPST = _SB.CP00._PPC + Debug = "Programming Current P-state: " + Debug = NPST }
/* @@ -163,51 +163,51 @@ // Wifi Button Event Method (_Q07) { - Store ("Wifi Button Event 0x07", Debug) + Debug = "Wifi Button Event 0x07" }
// Thermal Event Method (_Q08) { - Store ("Thermal Event 0x08", Debug) + Debug = "Thermal Event 0x08" Notify(_TZ.THRM, 0x80) }
// Pstate Down Method (_Q0E) { - Store ("Pstate Event 0x0E", Debug) + Debug = "Pstate Event 0x0E"
- Store(_SB.CP00._PPC, Local0) - Subtract(PPCM, 0x01, Local1) + Local0 = _SB.CP00._PPC + Local1 = PPCM - 1
- If(LLess(Local0, Local1)) { - Increment(Local0) + If (Local0 < Local1) { + Local0++ \PPCN () }
- Store(Local0, NPST) + NPST = Local0 }
// Pstate Up Method (_Q0F) { - Store ("Pstate Event 0x0F", Debug) - Store(_SB.CP00._PPC, Local0) + Debug = "Pstate Event 0x0F" + Local0 = _SB.CP00._PPC
If(Local0) { - Decrement(Local0) + Local0-- \PPCN () }
- Store(Local0, NPST) + NPST = Local0 }
// AC Power Connected Method (_Q10, 0, NotSerialized) { - Store ("AC Insertion Event 0x10", Debug) - Store (One, \PWRS) + Debug = "AC Insertion Event 0x10" + \PWRS = 1 Notify (AC, 0x80) Notify (BATX, 0x80) \PNOT () @@ -216,8 +216,8 @@ // AC Power Removed Method (_Q11, 0, NotSerialized) { - Store ("AC Detach Event 0x11", Debug) - Store (Zero, \PWRS) + Debug = "AC Detach Event 0x11" + \PWRS = 0 Notify (AC, 0x80) Notify (BATX, 0x80) \PNOT () @@ -226,7 +226,7 @@ // Battery State Change - Attach Event Method (_Q12, 0, NotSerialized) { - Store ("Battery Insertion Event 0x12", Debug) + Debug = "Battery Insertion Event 0x12"
Notify (BATX, 0x81) Notify (BATX, 0x80) @@ -236,7 +236,7 @@ // Battery State Change - Detach Event Method (_Q13, 0, NotSerialized) { - Store ("Battery Detach Event 0x13", Debug) + Debug = "Battery Detach Event 0x13"
Notify (BATX, 0x81) Notify (BATX, 0x80) @@ -247,7 +247,7 @@ // Battery State Change Event Method (_Q14, 0, NotSerialized) { - Store ("Battery State Change Event 0x14", Debug) + Debug = "Battery State Change Event 0x14"
Notify (BATX, 0x80) } @@ -255,9 +255,9 @@ // Lid Switch Event Method (_Q06) { - Store ("Lid Switch Event 0x06", Debug) + Debug = "Lid Switch Event 0x06" sleep(20) - Store (LIDF, \LIDS) + \LIDS = LIDF Notify (_SB.LID0, 0x80) }