vboot_ec:Read try slot from BBRAM

This patch makes EC read the slot to verify and jump to from the
battery backed up RAM (BBRAM).

BUG=b:38462249
BRANCH=none
TEST=Boot Fizz

Change-Id: I0c78861ea3ccdc45d0aa08e690e3a68f53658409
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/518255
This commit is contained in:
Daisuke Nojiri
2017-05-30 13:41:13 -07:00
committed by chrome-bot
parent c74c078592
commit 031dccad78
4 changed files with 11 additions and 1 deletions

View File

@@ -184,6 +184,10 @@ static int bbram_idx_lookup(enum system_bbram_idx idx)
return BBRM_DATA_INDEX_PD0;
if (idx == SYSTEM_BBRAM_IDX_PD1)
return BBRM_DATA_INDEX_PD1;
#endif
#ifdef CONFIG_VBOOT_EC
if (idx == SYSTEM_BBRAM_IDX_TRY_SLOT)
return BBRM_DATA_INDEX_TRY_SLOT;
#endif
return -1;
}

View File

@@ -19,6 +19,7 @@ enum bbram_data_index {
BBRM_DATA_INDEX_WAKE = 8, /* Wake reasons for hibernate */
BBRM_DATA_INDEX_PD0 = 12, /* USB-PD saved port0 state */
BBRM_DATA_INDEX_PD1 = 13, /* USB-PD saved port1 state */
BBRM_DATA_INDEX_TRY_SLOT = 14, /* Vboot EC try slot */
BBRM_DATA_INDEX_VBNVCNTXT = 16, /* VbNvContext for ARM arch */
BBRM_DATA_INDEX_RAMLOG = 32, /* RAM log for Booter */
BBRM_DATA_INDEX_PANIC_FLAGS = 35, /* Flag to indicate validity of

View File

@@ -48,9 +48,13 @@ static int verify_slot(int slot)
static int verify_rw(void)
{
uint8_t slot = VBOOT_EC_SLOT_A;
uint8_t slot;
/* 1. Read BBRAM to decide which slot to verify */
if (system_get_bbram(SYSTEM_BBRAM_IDX_TRY_SLOT, &slot)) {
CPRINTS("Failed to read try slot");
slot = VBOOT_EC_SLOT_A;
}
/* 2. Verify the slot */
return verify_slot(slot);
}

View File

@@ -307,6 +307,7 @@ enum system_bbram_idx {
/* PD state for CONFIG_USB_PD_DUAL_ROLE uses one byte per port */
SYSTEM_BBRAM_IDX_PD0,
SYSTEM_BBRAM_IDX_PD1,
SYSTEM_BBRAM_IDX_TRY_SLOT,
};
/**