diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2022-06-28 12:06:22 -0600 |
---|---|---|
committer | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2022-07-13 16:08:56 +0000 |
commit | 7c97e1255c9cdff4f0cf64f5215b4fe2dfa4b37e (patch) | |
tree | 805ebac8f8a63e955c24ac5664586fe48a955ffc /src/mainboard | |
parent | 58f80bac479d5d34c1b4f7f15b8ebf4e6996b3bb (diff) |
mb/google/brya/acpi: Update GPIO polling method
The preferred way of polling in ACPI I've seen is usually to just
divide the sleep into N chunks, and ignore the time taken in between.
This works in practice (validated with Timer calls before and after).
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I4a2cd82cea05c539eff30b9b9d6ef18550d17686
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65484
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Robert Zieba <robertzieba@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/brya/acpi/utility.asl | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mainboard/google/brya/acpi/utility.asl b/src/mainboard/google/brya/acpi/utility.asl index 4fc03e83e1..1999d33348 100644 --- a/src/mainboard/google/brya/acpi/utility.asl +++ b/src/mainboard/google/brya/acpi/utility.asl @@ -8,14 +8,22 @@ */ Method (GPPL, 3, Serialized) { - Local0 = GRXS (Arg0) - Local7 = Arg2 * 10000 - Local7 = Timer + Local7 - While (Local0 != Arg1 && Timer < Local7) + Local0 = 0 + While (Local0 < Arg2) { - Stall (10) - Local0 = \_SB.PCI0.GRXS (Arg0) + If (\_SB.PCI0.GRXS (Arg0) == Arg1) { + Return (0) + } Else { + Local0++ + } + Sleep (1) } + + If (Local0 == Arg2) { + Printf("[ERROR] GPPL for %o timed out", Arg0) + } + + Return (0xFF) } /* Convert from 32-bit integer to 4-byte buffer (little-endian) */ |