mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 11:55:03 +00:00
cros: Update ec_commands to latest version
This file has changed quite a bit in the last 5 years as the capabilities of the ECs have grown. Sync it up with the copy in coreboot commit b9141f2215. The only change is the addition of EC_VBNV_BLOCK_SIZE_V2. This is needed because U-Boot uses the new v2 vboot API and this is not currently fully supported by Chromium OS firmware. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
67b9052264
commit
6f1c0430e8
4 changed files with 3326 additions and 440 deletions
|
@ -27,7 +27,7 @@ static int cros_ec_decode_region(int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
if (0 == strcmp(*argv, "rw"))
|
if (0 == strcmp(*argv, "rw"))
|
||||||
return EC_FLASH_REGION_RW;
|
return EC_FLASH_REGION_ACTIVE;
|
||||||
else if (0 == strcmp(*argv, "ro"))
|
else if (0 == strcmp(*argv, "ro"))
|
||||||
return EC_FLASH_REGION_RO;
|
return EC_FLASH_REGION_RO;
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
}
|
}
|
||||||
printf("rows = %u\n", info.rows);
|
printf("rows = %u\n", info.rows);
|
||||||
printf("cols = %u\n", info.cols);
|
printf("cols = %u\n", info.cols);
|
||||||
printf("switches = %#x\n", info.switches);
|
|
||||||
} else if (0 == strcmp("curimage", cmd)) {
|
} else if (0 == strcmp("curimage", cmd)) {
|
||||||
enum ec_current_image image;
|
enum ec_current_image image;
|
||||||
|
|
||||||
|
@ -177,7 +176,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
region = cros_ec_decode_region(argc - 2, argv + 2);
|
region = cros_ec_decode_region(argc - 2, argv + 2);
|
||||||
if (region == EC_FLASH_REGION_RO)
|
if (region == EC_FLASH_REGION_RO)
|
||||||
cmd = EC_REBOOT_JUMP_RO;
|
cmd = EC_REBOOT_JUMP_RO;
|
||||||
else if (region == EC_FLASH_REGION_RW)
|
else if (region == EC_FLASH_REGION_ACTIVE)
|
||||||
cmd = EC_REBOOT_JUMP_RW;
|
cmd = EC_REBOOT_JUMP_RW;
|
||||||
else
|
else
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
|
@ -473,7 +473,7 @@ int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
|
||||||
p.cmd = EC_VBOOT_HASH_START;
|
p.cmd = EC_VBOOT_HASH_START;
|
||||||
p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
|
p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
|
||||||
p.nonce_size = 0;
|
p.nonce_size = 0;
|
||||||
p.offset = EC_VBOOT_HASH_OFFSET_RW;
|
p.offset = EC_VBOOT_HASH_OFFSET_ACTIVE;
|
||||||
|
|
||||||
if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
|
if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
|
||||||
hash, sizeof(*hash)) < 0)
|
hash, sizeof(*hash)) < 0)
|
||||||
|
@ -894,7 +894,8 @@ int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image,
|
||||||
uint32_t rw_offset, rw_size;
|
uint32_t rw_offset, rw_size;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (cros_ec_flash_offset(dev, EC_FLASH_REGION_RW, &rw_offset, &rw_size))
|
if (cros_ec_flash_offset(dev, EC_FLASH_REGION_ACTIVE, &rw_offset,
|
||||||
|
&rw_size))
|
||||||
return -1;
|
return -1;
|
||||||
if (image_size > (int)rw_size)
|
if (image_size > (int)rw_size)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1045,7 +1046,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config)
|
||||||
if (0 == strcmp(name, "ro")) {
|
if (0 == strcmp(name, "ro")) {
|
||||||
region = EC_FLASH_REGION_RO;
|
region = EC_FLASH_REGION_RO;
|
||||||
} else if (0 == strcmp(name, "rw")) {
|
} else if (0 == strcmp(name, "rw")) {
|
||||||
region = EC_FLASH_REGION_RW;
|
region = EC_FLASH_REGION_ACTIVE;
|
||||||
} else if (0 == strcmp(name, "wp-ro")) {
|
} else if (0 == strcmp(name, "wp-ro")) {
|
||||||
region = EC_FLASH_REGION_WP_RO;
|
region = EC_FLASH_REGION_WP_RO;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -365,7 +365,7 @@ static int process_cmd(struct ec_state *ec,
|
||||||
struct fmap_entry *entry;
|
struct fmap_entry *entry;
|
||||||
int ret, size;
|
int ret, size;
|
||||||
|
|
||||||
entry = &ec->ec_config.region[EC_FLASH_REGION_RW];
|
entry = &ec->ec_config.region[EC_FLASH_REGION_ACTIVE];
|
||||||
|
|
||||||
switch (req->cmd) {
|
switch (req->cmd) {
|
||||||
case EC_VBOOT_HASH_RECALC:
|
case EC_VBOOT_HASH_RECALC:
|
||||||
|
@ -420,7 +420,7 @@ static int process_cmd(struct ec_state *ec,
|
||||||
|
|
||||||
switch (req->region) {
|
switch (req->region) {
|
||||||
case EC_FLASH_REGION_RO:
|
case EC_FLASH_REGION_RO:
|
||||||
case EC_FLASH_REGION_RW:
|
case EC_FLASH_REGION_ACTIVE:
|
||||||
case EC_FLASH_REGION_WP_RO:
|
case EC_FLASH_REGION_WP_RO:
|
||||||
entry = &ec->ec_config.region[req->region];
|
entry = &ec->ec_config.region[req->region];
|
||||||
resp->offset = entry->offset;
|
resp->offset = entry->offset;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue