summaryrefslogtreecommitdiff
path: root/src/ec/starlabs
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2024-03-18 13:35:40 +0000
committerFelix Held <felix-coreboot@felixheld.de>2024-06-07 18:52:46 +0000
commit7c4cc60a6c41dbe6b9991eb54e4a01d4594a9795 (patch)
tree57113db4120a065d3f2c02daf101bd410dc5bdce /src/ec/starlabs
parent111fec8646a456ec8b1125cd9f24a3370ebce510 (diff)
ec/starlabs/merlin/battery: Check values are valid before using them
Change-Id: I559aca98044b7f0e6b08c475b5383c014bb4cd3f Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81407 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/starlabs')
-rw-r--r--src/ec/starlabs/merlin/acpi/battery.asl24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ec/starlabs/merlin/acpi/battery.asl b/src/ec/starlabs/merlin/acpi/battery.asl
index 197be64f50..262969a338 100644
--- a/src/ec/starlabs/merlin/acpi/battery.asl
+++ b/src/ec/starlabs/merlin/acpi/battery.asl
@@ -38,13 +38,17 @@ Device (BAT0)
{
If (B1DC) {
SBIF [1] = B1DC
- SBIF [2] = B1FC
+ If (B1FC != 0xffff) {
+ SBIF [2] = B1FC
+ }
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 [10] = B1SN
+ If (B1SN != 0xffff) {
+ SBIF [10] = B1SN
+ }
}
Return (SBIF)
}
@@ -82,14 +86,20 @@ Device (BAT0)
{
If (B1DC) {
XBIF [2] = B1DC
- XBIF [3] = B1FC
+ If (B1FC != 0xffff) {
+ XBIF [3] = B1FC
+ }
XBIF [5] = B1DV
XBIF [6] = B1DC / 5 // 20%
XBIF [7] = B1DC / 20 // 5%
- XBIF [8] = B1CC
+ If (B1CC != 0xffff) {
+ XBIF [8] = B1CC
+ }
XBIF [14] = B1DC / 500 // 0.2%
XBIF [15] = B1DC / 500 // 0.2%
- XBIF [17] = B1SN
+ If (B1SN != 0xffff) {
+ XBIF [17] = B1SN
+ }
}
Return (XBIF)
}
@@ -105,7 +115,9 @@ Device (BAT0)
{
PKG1[0] = (B1ST & 0x07)
PKG1[1] = B1PR
- PKG1[2] = B1RC
+ If (B1RC != 0xffff) {
+ PKG1[2] = B1RC
+ }
PKG1[3] = B1PV
Return (PKG1)
}