diff options
author | Rizwan Qureshi <rizwan.qureshi@intel.com> | 2019-12-27 21:41:07 +0530 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2019-12-29 00:34:21 +0000 |
commit | cf425783c8896173a74103bd4936d0c205954f83 (patch) | |
tree | ec77aa1f6fbbb7edd77543d4c6672e1443334171 /src | |
parent | a76cf28279bee4359991c429fe00ccb514cc8d00 (diff) |
ec/google/chromeec: ignore LIMIT_POWER based on command code in response
Assume that LIMIT_POWER is not requested if the ec does not support it.
Do this by checking the command code in the response message instead
of return value.
BUG=b:146165519
BRANCH=None
TEST=Boot puff with EC which does not support LIMIT_POWER param.
Change-Id: Ib2f5f69a53f204acebfab3e36aab2960eeec1204
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37947
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/ec/google/chromeec/ec.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index de43eb5b74..b6020a3a62 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -760,14 +760,19 @@ int google_chromeec_read_limit_power_request(int *limit_power) int rv; rv = google_chromeec_command(&cmd); - if (rv == -EC_RES_INVALID_PARAM || rv == -EC_RES_INVALID_COMMAND) { + + if (rv != 0 && (cmd.cmd_code == EC_RES_INVALID_COMMAND || + cmd.cmd_code == EC_RES_INVALID_PARAM)) { printk(BIOS_INFO, "PARAM_LIMIT_POWER not supported by EC.\n"); *limit_power = 0; return 0; + } else if (rv != 0) { + return -1; } *limit_power = resp.get_param.value; - return rv; + + return 0; } int google_chromeec_get_protocol_info( |