HAOUAS Elyes has uploaded this change for review.

View Change

drivers/intel/gma/acpi: Convert 'configure_brightness_levels.asl' to ASL+ syntax

Generated build/dsdt.dsl are same.

Change-Id: I8789ee129d1c42a36f30344655286b3c55f4f2c7
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
---
M src/drivers/intel/gma/acpi/configure_brightness_levels.asl
1 file changed, 27 insertions(+), 29 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/45782/1
diff --git a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
index 0ab93d8..9db6bfb 100644
--- a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
+++ b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
@@ -42,48 +42,48 @@
*/
Method (XBCM, 1, Serialized)
{
- If (LEqual(ASLS, Zero))
+ If (ASLS == 0)
{
Return (Ones)
}
- If (LEqual(And(MBOX, 0x4), Zero))
+ If ((MBOX & 0x4) == 0)
{
Return (Ones)
}

/* Always keep BCLP up to date, even if driver is not ready.
It requires a full 8-bit brightness value. 255 = 100% */
- Store (Divide (Multiply (Arg0, 255), 100), Local1)
- If (LGreater(Local1, 255)) {
- Store (255, Local1)
+ Local1 = (Arg0 * 255) / 100
+ If (Local1 > 255) {
+ Local1 = 255
}
/* also set valid bit */
- Store (Or (Local1, 0x80000000), BCLP)
+ BCLP = Local1 | 0x80000000

- If (LEqual(ARDY, Zero))
+ If (ARDY == 0)
{
Return (Ones)
}

/* Request back-light change */
- Store (0x2, ASLC)
+ ASLC = 0x2
/* Trigger IRQ */
- Store (0x1, ASLE)
+ ASLE = 0x1

- Store (0x20, Local0)
- While (LGreater(Local0, Zero))
+ Local0 = 0x20
+ While (Local0 > 0)
{
Sleep (1)
- If (LEqual (And (ASLC, 0x2), 0)) {
+ If ((ASLC & 0x2) == 0) {
/* Request has been processed, check status: */
- And (ShiftRight (ASLC, 12), 0x3, Local1)
- If (LEqual (Local1, 0)) {
+ Local1 = (ASLC >> 12) & 0x3
+ If (Local1 == 0) {
Return (Zero)
} Else {
Return (Ones)
}
}
- Decrement (Local0)
+ Local0--
}

Return (Ones)
@@ -100,12 +100,12 @@
/* Divide round closest */
Method (DRCL, 2)
{
- Return (Divide (Add (Arg0, Divide (Arg1, 2)), Arg1))
+ Return ((Arg0 + (Arg1 / 0x02)) / Arg1)
}

Method (XBCM, 1, NotSerialized)
{
- Store (DRCL (Multiply (Arg0, BCLM), 100), BCLV)
+ BCLV = DRCL ((Arg0 * BCLM), 100)
}

/* Find value closest to BCLV in BRIG (which must be ordered) */
@@ -117,26 +117,24 @@
Return (Zero)
}
/* Local0: current percentage */
- Store (DRCL (Multiply (BCLV, 100), BCLM), Local0)
+ Local0 = DRCL ((BCLV * 0x64), BCLM)

/* Local1: loop index (selectable values start at 2 in BRIG) */
- Store (2, Local1)
- While (LLess (Local1, Subtract (SizeOf (BRIG), 1))) {
+ Local1 = 2
+ While (Local1 < (SizeOf (BRIG) -1)) {
/* Local[23]: adjacent values in BRIG */
- Store (DeRefOf (Index (BRIG, Local1)), Local2)
- Store (DeRefOf (Index (BRIG, Add (Local1, 1))), Local3)
-
- If (LLess (Local0, Local3)) {
- If (LOr (LLess (Local0, Local2),
- LLess (Subtract (Local0, Local2),
- Subtract (Local3, Local0)))) {
+ Local2 = DerefOf (BRIG [Local1])
+ Local3 = DerefOf (BRIG [(Local1 + 1)])
+ If (Local0 < Local3) {
+ If ((Local0 < Local2) ||
+ ((Local0 - Local2) < (Local3 - Local0))) {
Return (Local2)
} Else {
Return (Local3)
}
}

- Increment (Local1)
+ Local1++
}

/* Didn't find greater/equal value: use the last */
@@ -146,7 +144,7 @@

Method (XBCM, 1, NotSerialized)
{
- If (LEqual(^BOX3.XBCM (Arg0), Ones))
+ If (^BOX3.XBCM (Arg0) == Ones)
{
^LEGA.XBCM (Arg0)
}

To view, visit change 45782. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I8789ee129d1c42a36f30344655286b3c55f4f2c7
Gerrit-Change-Number: 45782
Gerrit-PatchSet: 1
Gerrit-Owner: HAOUAS Elyes <ehaouas@noos.fr>
Gerrit-MessageType: newchange