[coreboot-gerrit] Change in coreboot[master]: ec/lenovo/h8: Support an optional battery page flip delay
Martin Roth (Code Review)
gerrit at coreboot.org
Tue Mar 21 17:45:17 CET 2017
Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/18348 )
Change subject: ec/lenovo/h8: Support an optional battery page flip delay
......................................................................
ec/lenovo/h8: Support an optional battery page flip delay
The Lenovo H8 battery interface uses a paged EC memory area.
Some Thinkpads (in particular the S230U) use a different EC controller
(ENE KB9012) with mostly compatible firmware, which requires an explicit
delay between writing the page register and reading the page data.
Change-Id: Iaeb8c4829efa29139396b519de803f10dd93f03f
Signed-off-by: Tobias Diedrich <ranma+coreboot at tdiedrich.de>
Reviewed-on: https://review.coreboot.org/18348
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter at users.sourceforge.net>
Reviewed-by: Nico Huber <nico.h at gmx.de>
---
M src/ec/lenovo/h8/acpi/battery.asl
1 file changed, 24 insertions(+), 8 deletions(-)
Approvals:
Paul Menzel: Looks good to me, but someone else must approve
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
diff --git a/src/ec/lenovo/h8/acpi/battery.asl b/src/ec/lenovo/h8/acpi/battery.asl
index fef994a..080f247 100644
--- a/src/ec/lenovo/h8/acpi/battery.asl
+++ b/src/ec/lenovo/h8/acpi/battery.asl
@@ -84,6 +84,22 @@
BANA, 128
}
+/*
+ * Switches the battery information page (16 bytes ERAM @0xa0) with an
+ * optional compile-time delay.
+ *
+ * Arg0:
+ * bit7-4: Battery number
+ * bit3-0: Information page number
+ */
+Method(BPAG, 1, NotSerialized)
+{
+ Store(Arg0, PAGE)
+#ifdef BATTERY_PAGE_DELAY_MS
+ Sleep(BATTERY_PAGE_DELAY_MS)
+#endif
+}
+
/* Arg0: Battery
* Arg1: Battery Status Package
* Arg2: charging
@@ -93,9 +109,9 @@
{
Acquire(ECLK, 0xffff)
Store(0, Local0)
- Or(1, Arg0, PAGE)
+ ^BPAG(Or(1, Arg0))
Store(BAMA, Local1)
- Store(Arg0, PAGE) /* Battery dynamic information */
+ ^BPAG(Arg0) /* Battery dynamic information */
/*
* Present rate is a 16bit signed int, positive while charging
@@ -147,12 +163,12 @@
Method(BINF, 2, NotSerialized)
{
Acquire(ECLK, 0xffff)
- Or(1, Arg1, PAGE) /* Battery 0 static information */
+ ^BPAG(Or(1, Arg1)) /* Battery 0 static information */
Xor(BAMA, 1, Index(Arg0, 0))
Store(BAMA, Local0)
- Store(Arg1, PAGE)
+ ^BPAG(Arg1)
Store(BAFC, Local2)
- Or(2, Arg1, PAGE)
+ ^BPAG(Or(2, Arg1))
Store(BADC, Local1)
if (Local0)
@@ -177,13 +193,13 @@
}
Store (SERN, Index (Arg0, 10)) // Serial Number
- Or(4, Arg1, PAGE)
+ ^BPAG(Or(4, Arg1))
Name (TYPE, Buffer() { 0, 0, 0, 0, 0 })
Store(BATY, TYPE)
Store(TYPE, Index (Arg0, 11)) // Battery type
- Or(5, Arg1, PAGE)
+ ^BPAG(Or(5, Arg1))
Store(BAOE, Index (Arg0, 12)) // OEM information
- Or(6, Arg1, PAGE)
+ ^BPAG(Or(6, Arg1))
Store(BANA, Index (Arg0, 9)) // Model number
Release(ECLK)
Return (Arg0)
--
To view, visit https://review.coreboot.org/18348
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaeb8c4829efa29139396b519de803f10dd93f03f
Gerrit-PatchSet: 5
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Tobias Diedrich <ranma+coreboot at tdiedrich.de>
Gerrit-Reviewer: Alexander Couzens <lynxis at fe80.eu>
Gerrit-Reviewer: Arthur Heymans <arthur at aheymans.xyz>
Gerrit-Reviewer: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Nico Huber <nico.h at gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Sven Schnelle <svens at stackframe.org>
Gerrit-Reviewer: Tobias Diedrich <ranma+coreboot at tdiedrich.de>
Gerrit-Reviewer: Vladimir Serbinenko <phcoder at gmail.com>
Gerrit-Reviewer: build bot (Jenkins)
More information about the coreboot-gerrit
mailing list