Sean Rhodes has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84734?usp=email )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: ec/starlabs/merlin: Always use ECRD and ECWR when accessing EC memory ......................................................................
ec/starlabs/merlin: Always use ECRD and ECWR when accessing EC memory
Ensure any reads or writes to the EC memory, are performed with ECRD (Read) and ECWR (Write) as these methods use a mutex.
Also, use local variables to cache reads of the same variable within a given ACPI method.
This solves: Initialized Arguments for Method [ECRD]: (1 arguments defined for method invocation) Arg0: 00000000967261a4 [RefOf] <Node> Name ECPS RegionField 000000007d4b8073
ACPI Error: Aborting method _SB.PCI0.LPCB.EC.ECRD due to previous error (AE_BAD_PARAMETER) (20230628/psparse-529) ACPI Error: Aborting method _SB.PCI0.LPCB.EC.ADP1._PSR due to previous error (AE_BAD_PARAMETER) (20230628/psparse-529)
Change-Id: I0bbb538017cc004bff1989a8017ccfcd1ba9ab5c Signed-off-by: Sean Rhodes sean@starlabs.systems Reviewed-on: https://review.coreboot.org/c/coreboot/+/84734 Reviewed-by: Matt DeVillier matt.devillier@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/ec/starlabs/merlin/acpi/battery.asl M src/ec/starlabs/merlin/acpi/ec.asl M src/ec/starlabs/merlin/acpi/suspend.asl M src/ec/starlabs/merlin/variants/apl/events.asl M src/ec/starlabs/merlin/variants/cezanne/events.asl M src/ec/starlabs/merlin/variants/glk/events.asl M src/ec/starlabs/merlin/variants/glkr/events.asl M src/ec/starlabs/merlin/variants/kbl/events.asl M src/ec/starlabs/merlin/variants/merlin/events.asl 9 files changed, 46 insertions(+), 41 deletions(-)
Approvals: Matt DeVillier: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/ec/starlabs/merlin/acpi/battery.asl b/src/ec/starlabs/merlin/acpi/battery.asl index ee800ed..10fea6a 100644 --- a/src/ec/starlabs/merlin/acpi/battery.asl +++ b/src/ec/starlabs/merlin/acpi/battery.asl @@ -9,7 +9,7 @@ // Battery Status // 0x80 BIT1 0x01 = Present // 0x80 BIT1 0x00 = Not Present - If (ECPS & 0x02) + If (ECRD (RefOf(ECPS)) & 0x02) { Return (0x1F) } @@ -34,20 +34,22 @@ CONFIG_EC_STARLABS_BATTERY_TYPE, // 11: Battery Type CONFIG_EC_STARLABS_BATTERY_OEM // 12: OEM Information }) + Method (_BIF, 0, NotSerialized) { - If (B1DC) { - SBIF [1] = B1DC + Local0 = ECRD(RefOf(B1DC)) + If (Local0) { + SBIF [1] = Local0 If (B1FC != 0xffff) { - SBIF [2] = B1FC + SBIF [2] = ECRD(RefOf(B1FC)) } Else { - SBIF [2] = B1DC + SBIF [2] = Local0 } - SBIF [4] = B1DV - SBIF [5] = B1DC / 5 // 20% - SBIF [6] = B1DC / 20 // 5% - SBIF [7] = B1DC / 500 // 0.2% - SBIF [8] = B1DC / 500 // 0.2% + SBIF [4] = ECRD(RefOf(B1DV)) + SBIF [5] = Local0 / 5 // 20% + SBIF [6] = Local0 / 20 // 5% + SBIF [7] = Local0 / 500 // 0.2% + SBIF [8] = Local0 / 500 // 0.2% } Return (SBIF) } @@ -83,21 +85,22 @@ }) Method (_BIX, 0, NotSerialized) { - If (B1DC) { - XBIF [2] = B1DC + Local0 = ECRD(RefOf(B1DC)) + If (Local0) { + XBIF [2] = Local0 If (B1FC != 0xffff) { - XBIF [3] = B1FC + XBIF [3] = ECRD(RefOf(B1FC)) } Else { - XBIF [3] = B1DC + XBIF [3] = Local0 } - XBIF [5] = B1DV - XBIF [6] = B1DC / 5 // 20% - XBIF [7] = B1DC / 20 // 5% + XBIF [5] = ECRD(RefOf(B1DV)) + XBIF [6] = Local0 / 5 // 20% + XBIF [7] = Local0 / 20 // 5% If (B1CC != 0xffff) { - XBIF [8] = B1CC + XBIF [8] = ECRD(RefOf(B1CC)) } - XBIF [14] = B1DC / 500 // 0.2% - XBIF [15] = B1DC / 500 // 0.2% + XBIF [14] = Local0 / 500 // 0.2% + XBIF [15] = Local0 / 500 // 0.2% } Return (XBIF) } @@ -111,14 +114,16 @@ }) Method (_BST, 0, NotSerialized) { - PKG1[0] = (B1ST & 0x07) - PKG1[1] = B1PR - If (B1RC != 0xffff) { - PKG1[2] = B1RC + PKG1[0] = (ECRD(RefOf(B1ST)) & 0x07) + PKG1[1] = ECRD(RefOf(B1PR)) + + Local0 = ECRD(RefOf(B1RC)) + If (Local0 != 0xffff) { + PKG1[2] = Local0 } Else { - PKG1[2] = (B1RP * B1DC) / 100 + PKG1[2] = (ECRD(RefOf(B1RP)) * ECRD(RefOf(B1DC))) / 100 } - PKG1[3] = B1PV + PKG1[3] = ECRD(RefOf(B1PV)) Return (PKG1) } Method (_PCL, 0, NotSerialized) diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl index 7eec057..1219b82 100644 --- a/src/ec/starlabs/merlin/acpi/ec.asl +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -147,10 +147,10 @@ ECAV = 0x01
// Initialise the Lid State - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE))
// Initialise the OS State - OSFG = 0x01 + ECWR(0x01, RefOf(OSFG))
// Initialise the Power State PWRS = (ECRD (RefOf(ECPS)) & 0x01) diff --git a/src/ec/starlabs/merlin/acpi/suspend.asl b/src/ec/starlabs/merlin/acpi/suspend.asl index e0e89a3..2039b34 100644 --- a/src/ec/starlabs/merlin/acpi/suspend.asl +++ b/src/ec/starlabs/merlin/acpi/suspend.asl @@ -68,7 +68,7 @@ * Disable ACPI support. * This should always be the last action before entering S4 or S5. */ - _SB.PCI0.LPCB.EC.OSFG = 0x00 + _SB.PCI0.LPCB.EC.ECWR(0x00, RefOf(_SB.PCI0.LPCB.EC.OSFG)) }
Method (RWAK, 1, Serialized) @@ -77,7 +77,7 @@ * Enable ACPI support. * This should always be the first action when exiting S4 or S5. */ - _SB.PCI0.LPCB.EC.OSFG = 0x01 + _SB.PCI0.LPCB.EC.ECWR(0x01, RefOf(_SB.PCI0.LPCB.EC.OSFG))
/* Restore EC settings from CMOS */ Switch (ToInteger (_SB.PCI0.LPCB.TPLC)) diff --git a/src/ec/starlabs/merlin/variants/apl/events.asl b/src/ec/starlabs/merlin/variants/apl/events.asl index 57da405..85ce767 100644 --- a/src/ec/starlabs/merlin/variants/apl/events.asl +++ b/src/ec/starlabs/merlin/variants/apl/events.asl @@ -2,13 +2,13 @@
Method (_Q0D, 0, NotSerialized) // Event: Lid Opened { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
Method (_Q0C, 0, NotSerialized) // Event: Lid Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
diff --git a/src/ec/starlabs/merlin/variants/cezanne/events.asl b/src/ec/starlabs/merlin/variants/cezanne/events.asl index 37b84b7..4c9608c 100644 --- a/src/ec/starlabs/merlin/variants/cezanne/events.asl +++ b/src/ec/starlabs/merlin/variants/cezanne/events.asl @@ -74,13 +74,13 @@
Method (_Q0C, 0, NotSerialized) // Event: Lid Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
Method (_Q0D, 0, NotSerialized) // Event: Lid Opened { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
diff --git a/src/ec/starlabs/merlin/variants/glk/events.asl b/src/ec/starlabs/merlin/variants/glk/events.asl index 46aebe4..f43dc36 100644 --- a/src/ec/starlabs/merlin/variants/glk/events.asl +++ b/src/ec/starlabs/merlin/variants/glk/events.asl @@ -2,13 +2,13 @@
Method (_Q0D, 0, NotSerialized) // Event: Lid Opened { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
Method (_Q0C, 0, NotSerialized) // Event: Lid Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
diff --git a/src/ec/starlabs/merlin/variants/glkr/events.asl b/src/ec/starlabs/merlin/variants/glkr/events.asl index 556da66..68f5614 100644 --- a/src/ec/starlabs/merlin/variants/glkr/events.asl +++ b/src/ec/starlabs/merlin/variants/glkr/events.asl @@ -2,13 +2,13 @@
Method (_Q0D, 0, NotSerialized) // Event: Lid Opened { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
Method (_Q0C, 0, NotSerialized) // Event: Lid Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
diff --git a/src/ec/starlabs/merlin/variants/kbl/events.asl b/src/ec/starlabs/merlin/variants/kbl/events.asl index 5e80fd0..c792d9a 100644 --- a/src/ec/starlabs/merlin/variants/kbl/events.asl +++ b/src/ec/starlabs/merlin/variants/kbl/events.asl @@ -2,13 +2,13 @@
Method (_Q0D, 0, NotSerialized) // Event: Lid Opened { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
Method (_Q0C, 0, NotSerialized) // Event: Lid Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }
diff --git a/src/ec/starlabs/merlin/variants/merlin/events.asl b/src/ec/starlabs/merlin/variants/merlin/events.asl index 38a4971..64bb0d0 100644 --- a/src/ec/starlabs/merlin/variants/merlin/events.asl +++ b/src/ec/starlabs/merlin/variants/merlin/events.asl @@ -22,6 +22,6 @@
Method (_Q0C, 0, NotSerialized) // Event: Lid Opened or Closed { - \LIDS = LSTE + \LIDS = ECRD(RefOf(LSTE)) Notify (LID0, 0x80) }