ec/starlabs/merlin/ite: Don't attempt EC mirror without a counter

If the variable `mirror_flag_attempts` isn't accessible, or doesn't
have a value, don't attempt to mirror the EC.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: Ia39b2ce4ffcb8db3a335449c8bdb0d5c8a28a52c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76581
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Sean Rhodes 2023-07-18 12:07:29 +01:00 committed by Felix Held
parent e4fd561ab7
commit 981e61bde9
1 changed files with 16 additions and 23 deletions

View File

@ -31,7 +31,9 @@ static void ec_mirror_with_count(void)
{
unsigned int cmos_mirror_flag_counter = get_uint_option("mirror_flag_counter", UINT_MAX);
if (cmos_mirror_flag_counter != UINT_MAX) {
if (cmos_mirror_flag_counter == UINT_MAX)
return;
printk(BIOS_DEBUG, "ITE: mirror_flag_counter = %u\n", cmos_mirror_flag_counter);
/* Avoid boot loops by only trying a state change once */
@ -55,15 +57,6 @@ static void ec_mirror_with_count(void)
printk(BIOS_ERR, "ITE: Failed to mirror the EC in %u attempts!\n",
MIRROR_ATTEMPTS);
}
} else {
printk(BIOS_DEBUG, "ITE: Powering Off");
/* Write the EC mirror flag */
ec_write(ECRAM_MIRROR_FLAG, MIRROR_ENABLED);
/* Check what has been written */
if (ec_read(ECRAM_MIRROR_FLAG) == MIRROR_ENABLED)
poweroff();
}
}