updater: Add quirk for wilco devices
The ME unlock needs a different pattern for these devices. BUG=b:135216986 BRANCH=none TEST=test update from unlocked to locked image on sarien Change-Id: I928ee3de522937d5b972daaec4460dcc731b495e Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659534 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
parent
01b1a94bcc
commit
24db29e174
|
@ -74,6 +74,7 @@ enum quirk_types {
|
|||
QUIRK_ENLARGE_IMAGE,
|
||||
QUIRK_MIN_PLATFORM_VERSION,
|
||||
QUIRK_UNLOCK_ME_FOR_UPDATE,
|
||||
QUIRK_UNLOCK_WILCO_ME_FOR_UPDATE,
|
||||
QUIRK_DAISY_SNOW_DUAL_MODEL,
|
||||
QUIRK_EVE_SMM_STORE,
|
||||
QUIRK_ALLOW_EMPTY_WLTAG,
|
||||
|
|
|
@ -37,6 +37,11 @@ static const struct quirks_record quirks_records[] = {
|
|||
{ .match = "Google_Eve.",
|
||||
.quirks = "unlock_me_for_update,eve_smm_store" },
|
||||
|
||||
{ .match = "Google_Sarien.",
|
||||
.quirks = "unlock_wilco_me_for_update" },
|
||||
{ .match = "Google_Arcada.",
|
||||
.quirks = "unlock_wilco_me_for_update" },
|
||||
|
||||
{ .match = "Google_Poppy.", .quirks = "min_platform_version=6" },
|
||||
{ .match = "Google_Scarlet.", .quirks = "min_platform_version=1" },
|
||||
|
||||
|
@ -141,6 +146,36 @@ static int quirk_unlock_me_for_update(struct updater_config *cfg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Quirk to unlock a firmware image with SI_ME (management engine) when updating
|
||||
* so the system has a chance to make sure SI_ME won't be corrupted on next boot
|
||||
* before locking the Flash Master values in SI_DESC.
|
||||
* Returns 0 on success, otherwise failure.
|
||||
*/
|
||||
static int quirk_unlock_wilco_me_for_update(struct updater_config *cfg)
|
||||
{
|
||||
struct firmware_section section;
|
||||
struct firmware_image *image_to = &cfg->image;
|
||||
const int flash_master_offset = 128;
|
||||
const uint8_t flash_master[] = {
|
||||
0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff
|
||||
};
|
||||
|
||||
find_firmware_section(§ion, image_to, FMAP_SI_DESC);
|
||||
if (section.size < flash_master_offset + ARRAY_SIZE(flash_master))
|
||||
return 0;
|
||||
if (memcmp(section.data + flash_master_offset, flash_master,
|
||||
ARRAY_SIZE(flash_master)) == 0) {
|
||||
VB2_DEBUG("Target ME not locked.\n");
|
||||
return 0;
|
||||
}
|
||||
INFO("Changed Flash Master Values to unlocked.\n");
|
||||
memcpy(section.data + flash_master_offset, flash_master,
|
||||
ARRAY_SIZE(flash_master));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks and returns 0 if the platform version of current system is larger
|
||||
* or equal to given number, otherwise non-zero.
|
||||
|
@ -329,6 +364,11 @@ void updater_register_quirks(struct updater_config *cfg)
|
|||
"(also known as Board ID version).";
|
||||
quirks->apply = quirk_min_platform_version;
|
||||
|
||||
quirks = &cfg->quirks[QUIRK_UNLOCK_WILCO_ME_FOR_UPDATE];
|
||||
quirks->name = "unlock_wilco_me_for_update";
|
||||
quirks->help = "Unlock ME for safe lockdown.";
|
||||
quirks->apply = quirk_unlock_wilco_me_for_update;
|
||||
|
||||
quirks = &cfg->quirks[QUIRK_UNLOCK_ME_FOR_UPDATE];
|
||||
quirks->name = "unlock_me_for_update";
|
||||
quirks->help = "b/35568719; only lock management engine in "
|
||||
|
|
Loading…
Reference in New Issue