summaryrefslogtreecommitdiff
path: root/drivers/misc/cros_ec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 12:22:38 -0600
committerSimon Glass <sjg@chromium.org>2018-10-09 04:40:27 -0600
commita12ef7e26a69213869badc02c0f3267816200024 (patch)
tree4c2c51c62639e3980fa47313ee81888503a3aa02 /drivers/misc/cros_ec.c
parent590cee8315e94e729493d2ecd8a604bcfbfa7d0e (diff)
cros_ec: Update cros_ec_read_hash() to specify the image
Allow selection of which EC image to hash. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc/cros_ec.c')
-rw-r--r--drivers/misc/cros_ec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index 07e662a51b..190505c11c 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -444,13 +444,14 @@ static int cros_ec_wait_on_hash_done(struct udevice *dev,
return 0;
}
-
-int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
+int cros_ec_read_hash(struct udevice *dev, uint hash_offset,
+ struct ec_response_vboot_hash *hash)
{
struct ec_params_vboot_hash p;
int rv;
p.cmd = EC_VBOOT_HASH_GET;
+ p.offset = hash_offset;
if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
hash, sizeof(*hash)) < 0)
return -1;
@@ -473,7 +474,7 @@ int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
p.cmd = EC_VBOOT_HASH_START;
p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
p.nonce_size = 0;
- p.offset = EC_VBOOT_HASH_OFFSET_ACTIVE;
+ p.offset = hash_offset;
if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
hash, sizeof(*hash)) < 0)