summaryrefslogtreecommitdiff
path: root/src/vendorcode/google/chromeos
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2019-05-08 15:09:29 -0600
committerDuncan Laurie <dlaurie@chromium.org>2019-05-09 15:34:53 +0000
commit643daed6b54970da4d83055649b6abc2a198a840 (patch)
tree270e043009575af9b30ed42c1755b657094f29a0 /src/vendorcode/google/chromeos
parent24047fefdac1d5abc1298a0da20340dc3d7eda48 (diff)
downloadcoreboot-643daed6b54970da4d83055649b6abc2a198a840.tar.xz
vendorcode/google/chromeos: Use explicit zero check in ACPI code
The ASL 2.0 syntax for "!X" resolves to "LNot(X)" which will evaluate the object as an integer and turn into a boolean. This may not do the right thing if the object is actually a string and it can lead to unexpected behavior. Instead be specific about the object type and check for zero or an empty string depending on what is being returned. This fixes an issue where some VPD keys were causing the search to stop and miss subsequent entries. Change-Id: I1688842964f9c2f81ca31073da9c2d71a8c81767 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32694 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/vendorcode/google/chromeos')
-rw-r--r--src/vendorcode/google/chromeos/acpi/amac.asl3
-rw-r--r--src/vendorcode/google/chromeos/acpi/vpd.asl10
2 files changed, 7 insertions, 6 deletions
diff --git a/src/vendorcode/google/chromeos/acpi/amac.asl b/src/vendorcode/google/chromeos/acpi/amac.asl
index 51159f5124..c87862f6ff 100644
--- a/src/vendorcode/google/chromeos/acpi/amac.asl
+++ b/src/vendorcode/google/chromeos/acpi/amac.asl
@@ -42,6 +42,7 @@ Scope (\_SB)
/* Get "dock_passthru" value from RW_VPD */
Local0 = \VPD.VPDF ("RW", "dock_passthru")
+ Local1 = Zero
Switch (ToString (Local0))
{
Case ("ethernet_mac0") {
@@ -55,7 +56,7 @@ Scope (\_SB)
Local1 = \VPD.VPDF ("RO", "dock_mac")
}
}
- If (!Local1) {
+ If (Local1 == Zero) {
Return (Zero)
}
Printf ("MAC address returned from VPD: %o", Local1)
diff --git a/src/vendorcode/google/chromeos/acpi/vpd.asl b/src/vendorcode/google/chromeos/acpi/vpd.asl
index 3b262f75a8..8f8b0e571d 100644
--- a/src/vendorcode/google/chromeos/acpi/vpd.asl
+++ b/src/vendorcode/google/chromeos/acpi/vpd.asl
@@ -139,7 +139,7 @@ Device (VPD)
Local1 <<= 7
Local1 |= Local2 & 0x7f
}
- If (!Local1) {
+ If (Local1 == Zero) {
Return (Zero)
}
@@ -162,7 +162,7 @@ Device (VPD)
*/
Method (VPDS, 0, Serialized)
{
- Name (VPKV, Package () { Zero, Zero })
+ Name (VPKV, Package () { "", "" })
/* Read the VPD type and ensure it is a string */
If (^VPRB () != ^VPES) {
@@ -193,14 +193,14 @@ Device (VPD)
/* End address of VPD region */
^VEND = ^VPTR + DerefOf (Local0[1])
- If (!^VPTR || !^VEND) {
+ If (^VPTR == Zero || ^VEND == Zero) {
Printf ("Unable to find VPD region")
Return (Zero)
}
/* Verify VPD info header and save size */
Local0 = VVPD (^VPTR)
- If (!Local0) {
+ If (Local0 == Zero) {
Printf ("VPD region %o did not verify", Arg0)
Return (Zero)
}
@@ -213,7 +213,7 @@ Device (VPD)
While (Local1 != ToString (Arg1)) {
Local2 = VPDS ()
Local1 = DerefOf (Local2[0])
- If (!Local1) {
+ If (Local1 == "") {
Printf ("VPD KEY %o not found", Arg1)
Return (Zero)
}