ec/google/wilco/acpi: Fix issues and clean up

- Disable debug output from read/write methods by default
- Use argument to _REG to disable SCI when EC is unregistered
- Change read/write macros to sync level 2 so they can be called
when a mutex is already held
- Define some missing events

Change-Id: Ic65ebbb6a6151444c47b4aeff7429e186856c49a
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/29760
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Duncan Laurie 2018-11-20 17:27:47 -08:00 committed by Patrick Georgi
parent e68042f021
commit 4c14ca836f
2 changed files with 14 additions and 6 deletions

View File

@ -20,6 +20,7 @@ Device (EC0)
Name (_UID, 1) Name (_UID, 1)
Name (_GPE, EC_SCI_GPI) Name (_GPE, EC_SCI_GPI)
Name (_STA, 0xf) Name (_STA, 0xf)
Name (DBUG, Zero)
Name (_CRS, ResourceTemplate() { Name (_CRS, ResourceTemplate() {
IO (Decode16, IO (Decode16,
@ -44,7 +45,7 @@ Device (EC0)
ECPR = R (APWR) ECPR = R (APWR)
/* Indicate to EC that OS is ready for queries */ /* Indicate to EC that OS is ready for queries */
W (ERDY, One) W (ERDY, Arg1)
/* Tell EC to stop emulating PS/2 mouse */ /* Tell EC to stop emulating PS/2 mouse */
W (PS2M, Zero) W (PS2M, Zero)
@ -71,7 +72,7 @@ Device (EC0)
* Arg0 = EC field structure * Arg0 = EC field structure
* Arg1 = Value to write * Arg1 = Value to write
*/ */
Method (ECRW, 2, Serialized) Method (ECRW, 2, Serialized, 2)
{ {
If (!EREG) { If (!EREG) {
Return (Zero) Return (Zero)
@ -101,11 +102,15 @@ Device (EC0)
} }
Local5 = EBIT (Arg0, Local3) Local5 = EBIT (Arg0, Local3)
Printf ("ECRD %o = %o", Local0, Local5) If (DBUG) {
Printf ("ECRD %o = %o", Local0, Local5)
}
Return (Local5) Return (Local5)
} ElseIf (Local2 == WR) { } ElseIf (Local2 == WR) {
/* Write byte */ /* Write byte */
Printf ("ECWR %o = %o", Local0, Arg1) If (DBUG) {
Printf ("ECWR %o = %o", Local0, Arg1)
}
BYT1 = Arg1 BYT1 = Arg1
} }
Return (Zero) Return (Zero)
@ -115,7 +120,7 @@ Device (EC0)
* Read a field from EC * Read a field from EC
* Arg0 = EC field structure * Arg0 = EC field structure
*/ */
Method (R, 1, Serialized) Method (R, 1, Serialized, 2)
{ {
Return (ECRW (Arg0, Zero)) Return (ECRW (Arg0, Zero))
} }
@ -125,7 +130,7 @@ Device (EC0)
* Arg0 = EC field structure * Arg0 = EC field structure
* Arg1 = Value to write * Arg1 = Value to write
*/ */
Method (W, 2, Serialized) Method (W, 2, Serialized, 2)
{ {
Return (ECRW (Arg0, Arg1)) Return (ECRW (Arg0, Arg1))
} }

View File

@ -81,6 +81,9 @@ Name (WRTC, Package () { 0x09, 0x20, RD }) /* Wake: RTC */
Name (WBAT, Package () { 0x09, 0x80, RD }) /* Wake: Low Battery */ Name (WBAT, Package () { 0x09, 0x80, RD }) /* Wake: Low Battery */
Name (EVT3, Package () { 0x0b, 0xff, RD }) /* Event 3 */ Name (EVT3, Package () { 0x0b, 0xff, RD }) /* Event 3 */
Name (E3CP, Package () { 0x0b, 0x08, RD }) /* CS Power Button */
Name (E3TH, Package () { 0x0b, 0x10, RD }) /* Thermal Event */
Name (EVT4, Package () { 0x0c, 0xff, RD }) /* Event 4 */ Name (EVT4, Package () { 0x0c, 0xff, RD }) /* Event 4 */
Name (BCST, Package () { 0x10, 0xff, RD }) /* BCACHE: BST */ Name (BCST, Package () { 0x10, 0xff, RD }) /* BCACHE: BST */