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@tdiedrich.de> Reviewed-on: https://review.coreboot.org/18348 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
parent
b4d0757855
commit
1583dbd7b7
|
@ -84,6 +84,22 @@ Field (ERAM, ByteAcc, NoLock, Preserve)
|
||||||
BANA, 128
|
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
|
/* Arg0: Battery
|
||||||
* Arg1: Battery Status Package
|
* Arg1: Battery Status Package
|
||||||
* Arg2: charging
|
* Arg2: charging
|
||||||
|
@ -93,9 +109,9 @@ Method(BSTA, 4, NotSerialized)
|
||||||
{
|
{
|
||||||
Acquire(ECLK, 0xffff)
|
Acquire(ECLK, 0xffff)
|
||||||
Store(0, Local0)
|
Store(0, Local0)
|
||||||
Or(1, Arg0, PAGE)
|
^BPAG(Or(1, Arg0))
|
||||||
Store(BAMA, Local1)
|
Store(BAMA, Local1)
|
||||||
Store(Arg0, PAGE) /* Battery dynamic information */
|
^BPAG(Arg0) /* Battery dynamic information */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Present rate is a 16bit signed int, positive while charging
|
* Present rate is a 16bit signed int, positive while charging
|
||||||
|
@ -147,12 +163,12 @@ Method(BSTA, 4, NotSerialized)
|
||||||
Method(BINF, 2, NotSerialized)
|
Method(BINF, 2, NotSerialized)
|
||||||
{
|
{
|
||||||
Acquire(ECLK, 0xffff)
|
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))
|
Xor(BAMA, 1, Index(Arg0, 0))
|
||||||
Store(BAMA, Local0)
|
Store(BAMA, Local0)
|
||||||
Store(Arg1, PAGE)
|
^BPAG(Arg1)
|
||||||
Store(BAFC, Local2)
|
Store(BAFC, Local2)
|
||||||
Or(2, Arg1, PAGE)
|
^BPAG(Or(2, Arg1))
|
||||||
Store(BADC, Local1)
|
Store(BADC, Local1)
|
||||||
|
|
||||||
if (Local0)
|
if (Local0)
|
||||||
|
@ -177,13 +193,13 @@ Method(BINF, 2, NotSerialized)
|
||||||
}
|
}
|
||||||
Store (SERN, Index (Arg0, 10)) // Serial Number
|
Store (SERN, Index (Arg0, 10)) // Serial Number
|
||||||
|
|
||||||
Or(4, Arg1, PAGE)
|
^BPAG(Or(4, Arg1))
|
||||||
Name (TYPE, Buffer() { 0, 0, 0, 0, 0 })
|
Name (TYPE, Buffer() { 0, 0, 0, 0, 0 })
|
||||||
Store(BATY, TYPE)
|
Store(BATY, TYPE)
|
||||||
Store(TYPE, Index (Arg0, 11)) // Battery type
|
Store(TYPE, Index (Arg0, 11)) // Battery type
|
||||||
Or(5, Arg1, PAGE)
|
^BPAG(Or(5, Arg1))
|
||||||
Store(BAOE, Index (Arg0, 12)) // OEM information
|
Store(BAOE, Index (Arg0, 12)) // OEM information
|
||||||
Or(6, Arg1, PAGE)
|
^BPAG(Or(6, Arg1))
|
||||||
Store(BANA, Index (Arg0, 9)) // Model number
|
Store(BANA, Index (Arg0, 9)) // Model number
|
||||||
Release(ECLK)
|
Release(ECLK)
|
||||||
Return (Arg0)
|
Return (Arg0)
|
||||||
|
|
Loading…
Reference in New Issue