ec/ene_kb3940q: correct ACPI battery data fed into ToString()

ToString() requires the input buffer data to be null-terminated,
but the data returned by the EC is not, leading Windows to fail
to report any battery data at all.  Correct this by concatenating
a null terminator (0x00) to the end of the buffer data before
inputting to ToString() where needed

TEST: boot Windows on google/butterfly, observe battery data
reported correctly.

Change-Id: I395cc7fbdf26c8cc816e47107e552c0533580fa1
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/19961
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Matt DeVillier 2017-02-17 19:48:56 -06:00 committed by Martin Roth
parent 32a618b03b
commit af4c0a431c
1 changed files with 2 additions and 2 deletions

View File

@ -90,9 +90,9 @@ Device (BATX)
Store(Local0, Index(PBIF, 5)) Store(Local0, Index(PBIF, 5))
Multiply(Local1, 0x05, Local0) Multiply(Local1, 0x05, Local0)
Store (Local0, Index (PBIF, 6)) Store (Local0, Index (PBIF, 6))
Store (ToString(BATD), Index (PBIF, 9)) // Model Number Store (ToString(Concatenate(BATD, 0x00)), Index (PBIF, 9)) // Model Number
Store (ToDecimalString(BSN0), Index (PBIF, 10)) // Serial Number Store (ToDecimalString(BSN0), Index (PBIF, 10)) // Serial Number
Store (ToString(BCHM), Index (PBIF, 11)) // Battery Type Store (ToString(Concatenate(BCHM, 0x00)), Index (PBIF, 11)) // Battery Type
Store (\BATV, Index (PBIF, 12)) // OEM information Store (\BATV, Index (PBIF, 12)) // OEM information
Return (PBIF) Return (PBIF)