From fc7b41d370fa02cc97ae0e13dddf65e76dcf46b2 Mon Sep 17 00:00:00 2001 From: Elyes HAOUAS Date: Sun, 20 Sep 2020 09:30:58 +0200 Subject: [PATCH] mb/getac/p470/acpi: Convert 'battery.asl' to ASL 2.0 syntax IASL optimizes the code differently, which changes the binary. However, the generated `build/dsdt.dsl` remains identical. Change-Id: Ifcc8bf4022838056bf1fff853eb2027af684064e Signed-off-by: Elyes HAOUAS Reviewed-on: https://review.coreboot.org/c/coreboot/+/45554 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/getac/p470/acpi/battery.asl | 162 +++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/mainboard/getac/p470/acpi/battery.asl b/src/mainboard/getac/p470/acpi/battery.asl index d7b642aab5..4eca3f0109 100644 --- a/src/mainboard/getac/p470/acpi/battery.asl +++ b/src/mainboard/getac/p470/acpi/battery.asl @@ -18,10 +18,10 @@ Scope(\_SB) { Method(_STA, 0) { Sleep(120) - If(\_SB.PCI0.LPCB.EC0.BAT) { - Return(0x1f) + If (\_SB.PCI0.LPCB.EC0.BAT) { + Return (0x1f) } Else { - Return(0x0f) + Return (0x0f) } } @@ -45,67 +45,67 @@ Scope(\_SB) { }) // Is battery there? - Store(_STA(), Local0) - And(Local0, 0x10, Local0) - If(LNot(Local0)) { + Local0 = _STA () + Local0 &= 0x10 + If (!Local0) { Return (PBIF) } - Store(\_SB.PCI0.LPCB.EC0.BDC0, Index(PBIF, 1)) - Store(\_SB.PCI0.LPCB.EC0.BDV0, Index(PBIF, 4)) + PBIF [1] = \_SB.PCI0.LPCB.EC0.BDC0 + PBIF [4] = \_SB.PCI0.LPCB.EC0.BDV0 - Store(\_SB.PCI0.LPCB.EC0.BFC0, Local0) - Store(Local0, Index(PBIF, 2)) + Local0 = \_SB.PCI0.LPCB.EC0.BFC0 + PBIF [2] = Local0 - Divide(Local0, 10, , Local2) - Store(Local2, Index(PBIF, 5)) + Local2 = Local0 / 10 + PBIF [5] = Local2 - Divide(Local0, 20, , Local2) - Store(Local2, Index(PBIF, 6)) + Local2 = Local0 / 20 + PBIF [6] = Local2 - If(\_SB.PCI0.LPCB.EC0.BTYP) { - Store(NIMH, Index(PBIF, 11)) + If (\_SB.PCI0.LPCB.EC0.BTYP) { + PBIF [11] = NIMH } Else { - Store(LION, Index(PBIF, 11)) + PBIF [11] = LION } - Return(PBIF) + Return (PBIF) } /* Battery Status */ Method(_BST, 0) { - If(\_SB.PCI0.LPCB.EC0.BAT) { - Store(\_SB.PCI0.LPCB.EC0.BPV0, Index(PBST, 3)) + If (\_SB.PCI0.LPCB.EC0.BAT) { + PBST [3] = \_SB.PCI0.LPCB.EC0.BPV0 - Multiply(\_SB.PCI0.LPCB.EC0.BRC0, 100, Local3) - Divide(Local3, \_SB.PCI0.LPCB.EC0.BFC0, , Local0) - Multiply(\_SB.PCI0.LPCB.EC0.BFC0, Local0, Local3) - Divide(Local3, 0x64, , Local0) - Increment(Local0) - Store(Local0, Index(PBST, 2)) + Local3 = \_SB.PCI0.LPCB.EC0.BRC0 * 100 + Local0 = Local3 / \_SB.PCI0.LPCB.EC0.BFC0 + Local3 = \_SB.PCI0.LPCB.EC0.BFC0 * Local0 + Local0 = Local3 / 100 + Local0++ + PBST [2] = Local0 - Store (\_SB.PCI0.LPCB.EC0.BRC0, Local3) - Store (\_SB.PCI0.LPCB.EC0.BPR0, Local0) - And (Not (Local0), 0xFFFF, Local0) - Store (Local0, Index(PBST,1)) + Local3 = \_SB.PCI0.LPCB.EC0.BRC0 + Local0 = \_SB.PCI0.LPCB.EC0.BPR0 + Local0 = ~Local0 & 0xFFFF + PBST [1] = Local0 // AC Power connected? - If(\_SB.PCI0.LPCB.EC0.ADP) { - If(\_SB.PCI0.LPCB.EC0.CHRG) { - Store(2, Index(PBST, 0)) + If (\_SB.PCI0.LPCB.EC0.ADP) { + If (\_SB.PCI0.LPCB.EC0.CHRG) { + PBST [0] = 2 } Else { - Store(0, Index(PBST, 0)) + PBST [0] = 0 } } Else { - If(LLess(Local3, 25)) { - Store(5, Index(PBST, 0)) + If (Local3 < 25) { + PBST [0] = 5 } Else { - Store(1, Index(PBST, 0)) + PBST [0] = 1 } } } - Return(PBST) + Return (PBST) } } @@ -123,10 +123,10 @@ Scope(\_SB) { Method(_STA, 0) { Sleep(120) - If(\_SB.PCI0.LPCB.EC0.BAT2) { - Return(0x1f) + If (\_SB.PCI0.LPCB.EC0.BAT2) { + Return (0x1f) } Else { - Return(0x0f) + Return (0x0f) } } @@ -150,67 +150,67 @@ Scope(\_SB) { }) // Is battery there? - Store(_STA(), Local0) - And(Local0, 0x10, Local0) - If(LNot(Local0)) { + Local0 = _STA () + Local0 &= 0x10 + If (!Local0) { Return (PBIF) } - Store(\_SB.PCI0.LPCB.EC0.BDC2, Index(PBIF, 1)) - Store(\_SB.PCI0.LPCB.EC0.BDV2, Index(PBIF, 4)) + PBIF [1] = \_SB.PCI0.LPCB.EC0.BDC2 + PBIF [4] = \_SB.PCI0.LPCB.EC0.BDV2 - Store(\_SB.PCI0.LPCB.EC0.BFC2, Local0) - Store(Local0, Index(PBIF, 2)) + Local0 = \_SB.PCI0.LPCB.EC0.BFC2 + PBIF [2] = Local0 - Divide(Local0, 10, , Local2) - Store(Local2, Index(PBIF, 5)) + Local2 = Local0 / 10 + PBIF [5] = Local2 - Divide(Local0, 20, , Local2) - Store(Local2, Index(PBIF, 6)) + Local2 = Local0 / 20 + PBIF [6] = Local2 - If(\_SB.PCI0.LPCB.EC0.BTY2) { - Store(NIMH, Index(PBIF, 11)) + If (\_SB.PCI0.LPCB.EC0.BTY2) { + PBIF [11] = NIMH } Else { - Store(LION, Index(PBIF, 11)) + PBIF [11] = LION } - Return(PBIF) + Return (PBIF) } /* Battery Status */ Method(_BST, 0) { - If(\_SB.PCI0.LPCB.EC0.BAT2) { - Store(\_SB.PCI0.LPCB.EC0.BPV2, Index(PBST, 3)) + If (\_SB.PCI0.LPCB.EC0.BAT2) { + PBST [3] = \_SB.PCI0.LPCB.EC0.BPV2 - Multiply(\_SB.PCI0.LPCB.EC0.BRC2, 100, Local3) - Divide(Local3, \_SB.PCI0.LPCB.EC0.BFC2, , Local0) - Multiply(\_SB.PCI0.LPCB.EC0.BFC2, Local0, Local3) - Divide(Local3, 0x64, , Local0) - Increment(Local0) - Store(Local0, Index(PBST, 2)) + Local3 = \_SB.PCI0.LPCB.EC0.BRC2 * 100 + Local0 = Local3 / \_SB.PCI0.LPCB.EC0.BRC2 + Local3 = \_SB.PCI0.LPCB.EC0.BFC2 * Local0 + Local0 = Local3 / 100 + Local0++ + PBST [2] = Local0 - Store (\_SB.PCI0.LPCB.EC0.BRC2, Local3) - Store (\_SB.PCI0.LPCB.EC0.BPR2, Local0) - And (Not (Local0), 0xFFFF, Local0) - Store (Local0, Index(PBST,1)) + Local3 = \_SB.PCI0.LPCB.EC0.BRC2 + Local0 = \_SB.PCI0.LPCB.EC0.BPR2 + Local0 = ~Local0 & 0xFFFF + PBST [1] = Local0 // AC Power connected? - If(\_SB.PCI0.LPCB.EC0.ADP) { - If(\_SB.PCI0.LPCB.EC0.CRG2) { - Store(2, Index(PBST, 0)) + If (\_SB.PCI0.LPCB.EC0.ADP) { + If (\_SB.PCI0.LPCB.EC0.CRG2) { + PBST [0] = 2 } Else { - Store(0, Index(PBST, 0)) + PBST [0] = 0 } } Else { - If(LLess(Local3, 25)) { - Store(5, Index(PBST, 0)) + If (Local3 < 25) { + PBST [0] = 5 } Else { - Store(1, Index(PBST, 0)) + PBST [0] = 1 } } } - Return(PBST) + Return (PBST) } } @@ -223,12 +223,12 @@ Scope(\_SB) { Name (ACST, 0x00) Method (_PSR, 0) { - If(ACFG) { - Store(ACST, Local0) + If (ACFG) { + Local0 = ACST } Else { - Store(\_SB.PCI0.LPCB.EC0.ADP, Local0) - Store(Local0, ACST) - Store(1, ACFG) + Local0 = \_SB.PCI0.LPCB.EC0.ADP + ACST = Local0 + ACFG = 1 } Sleep(120) Return (Local0)