tree/acpi: Replace Divide(a,b,c,d) with ASL 2.0 syntax

Replace `Divide (a, b, c, d)` with these instructions:

  c = a % b
  d = a / b

Change-Id: I44366be5b5145a5d19f85df7a2f338866cb9c8b0
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71515
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Felix Singer 2022-12-25 16:54:45 +01:00 committed by Elyes Haouas
parent eaa31d95c2
commit 8171364d06
2 changed files with 10 additions and 4 deletions

View File

@ -42,8 +42,12 @@ Mutex (BTMX, 0x00)
Method (ITLB, 0, NotSerialized) Method (ITLB, 0, NotSerialized)
{ {
Divide ((NLB1 + 0x09), 0x0A, Local0, Local1) Local0 = (NLB1 + 9) % 0x0a
Divide ((0x96 + 0x09), 0x0A, Local0, Local2) Local1 = (NLB1 + 9) / 0x0a
Local0 = (0x96 + 9) % 0x0a
Local2 = (0x96 + 9) / 0x0a
Local0 = Local0 Local0 = Local0
LB1 = Local1 LB1 = Local1
LB2 = Local2 LB2 = Local2
@ -229,7 +233,8 @@ Method (\ISTR, 2, Serialized)
While (Local1) While (Local1)
{ {
Local1-- Local1--
Divide (Local0, 10, Local2, Local0) Local2 = Local0 % 10
Local0 = Local0 / 10
NUMB[Local1] = Local2 + 48 NUMB[Local1] = Local2 + 48
} }
ToString (NUMB, Arg1, Local3) ToString (NUMB, Arg1, Local3)

View File

@ -189,7 +189,8 @@ Method (GBIF, 3, NotSerialized)
Local6 = 4 Local6 = 4
While (Local7) While (Local7)
{ {
Divide (Local7, 10, Local5, Local7) Local5 = Local7 % 10
Local7 = Local7 / 10
SERN[Local6] = (Local5 + 0x30) // Add 0x30 to get numeric ASCII SERN[Local6] = (Local5 + 0x30) // Add 0x30 to get numeric ASCII
Local6-- Local6--
} }