summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/host_command.c7
-rw-r--r--include/ec_commands.h4
-rw-r--r--util/misc_util.c11
3 files changed, 18 insertions, 4 deletions
diff --git a/common/host_command.c b/common/host_command.c
index a036c184e6..51d1a9cf97 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -505,9 +505,12 @@ DECLARE_HOST_COMMAND(EC_CMD_READ_MEMMAP,
static int host_command_get_cmd_versions(struct host_cmd_handler_args *args)
{
const struct ec_params_get_cmd_versions *p = args->params;
+ const struct ec_params_get_cmd_versions_v1 *p_v1 = args->params;
struct ec_response_get_cmd_versions *r = args->response;
- const struct host_command *cmd = find_host_command(p->cmd);
+ const struct host_command *cmd =
+ (args->version == 1) ? find_host_command(p_v1->cmd) :
+ find_host_command(p->cmd);
if (!cmd)
return EC_RES_INVALID_PARAM;
@@ -520,7 +523,7 @@ static int host_command_get_cmd_versions(struct host_cmd_handler_args *args)
}
DECLARE_HOST_COMMAND(EC_CMD_GET_CMD_VERSIONS,
host_command_get_cmd_versions,
- EC_VER_MASK(0));
+ EC_VER_MASK(0) | EC_VER_MASK(1));
/**
* Print debug output for the host command request, before it's processed.
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 0a6858e2f2..c06e3464a0 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -617,6 +617,10 @@ struct ec_params_get_cmd_versions {
uint8_t cmd; /* Command to check */
} __packed;
+struct ec_params_get_cmd_versions_v1 {
+ uint16_t cmd; /* Command to check */
+} __packed;
+
struct ec_response_get_cmd_versions {
/*
* Mask of supported versions; use EC_VER_MASK() to compare with a
diff --git a/util/misc_util.c b/util/misc_util.c
index 005c84e50c..9699ac4a61 100644
--- a/util/misc_util.c
+++ b/util/misc_util.c
@@ -93,16 +93,23 @@ int is_string_printable(const char *buf)
*/
int ec_get_cmd_versions(int cmd, uint32_t *pmask)
{
+ struct ec_params_get_cmd_versions_v1 pver_v1;
struct ec_params_get_cmd_versions pver;
struct ec_response_get_cmd_versions rver;
int rv;
*pmask = 0;
- pver.cmd = cmd;
- rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 0, &pver, sizeof(pver),
+ pver_v1.cmd = cmd;
+ rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 1, &pver_v1, sizeof(pver_v1),
&rver, sizeof(rver));
+ if (rv == -EECRESULT - EC_RES_INVALID_VERSION) {
+ pver.cmd = cmd;
+ rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 0, &pver, sizeof(pver),
+ &rver, sizeof(rver));
+ }
+
if (rv < 0)
return rv;