diff options
author | Sean Rhodes <sean@starlabs.systems> | 2023-09-20 14:51:57 +0100 |
---|---|---|
committer | Matt DeVillier <matt.devillier@amd.corp-partner.google.com> | 2023-10-24 15:39:47 +0000 |
commit | ded5a601b5f8c5eaf57dae4088f9264dc55991c6 (patch) | |
tree | 07326cee85fbd86dde5a1f0e2a2d1b7d7b4974fb /src/ec | |
parent | 8902dfa2bdf33b8ae69fa0d5161b28f67f8c0881 (diff) |
ec/starlabs/merlin/ite: Adjust the mirror flag handling
In EC versions older than 1.18, if the mirror flag was enabled, the
EC would mirror once the system reached S5.
When a mirror is successful, the system will automatically power
on, as it acts like it's been in G3. This led to machines turning on
when the intention was them to be off.
In 1.18 and later, they're installed when turning on. The result was
slower boot times when mirroring, but no unwanted powering on.
Because of this, coreboot no longer needs to power off when setting
the mirror flag.
Change-Id: I973c1ecd59f32d3353ca392769b44aadf5fcc9c3
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78200
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/starlabs/merlin/ec.h | 2 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/ite.c | 41 |
2 files changed, 7 insertions, 36 deletions
diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h index 2fe5ec5128..05288165fd 100644 --- a/src/ec/starlabs/merlin/ec.h +++ b/src/ec/starlabs/merlin/ec.h @@ -102,8 +102,6 @@ #define MIRROR_DISABLED 0x00 #define MIRROR_ENABLED 0xaa -#define MIRROR_ATTEMPTS 1 - uint16_t ec_get_version(void); void ec_mirror_flag(void); diff --git a/src/ec/starlabs/merlin/ite.c b/src/ec/starlabs/merlin/ite.c index d7ae168af1..daf58733d9 100644 --- a/src/ec/starlabs/merlin/ite.c +++ b/src/ec/starlabs/merlin/ite.c @@ -27,39 +27,6 @@ static uint8_t get_ec_value_from_option(const char *name, return lut[index]; } -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) - return; - - printk(BIOS_DEBUG, "ITE: mirror_flag_counter = %u\n", cmos_mirror_flag_counter); - - /* Avoid boot loops by only trying a state change once */ - if (cmos_mirror_flag_counter < MIRROR_ATTEMPTS) { - cmos_mirror_flag_counter++; - set_uint_option("mirror_flag_counter", cmos_mirror_flag_counter); - printk(BIOS_DEBUG, "ITE: Mirror attempt %u/%u.\n", cmos_mirror_flag_counter, - MIRROR_ATTEMPTS); - - /* 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(); - } else { - /* - * If the mirror flags fails after 1 attempt, it will - * likely need a cold boot, or recovering. - */ - printk(BIOS_ERR, "ITE: Failed to mirror the EC in %u attempts!\n", - MIRROR_ATTEMPTS); - } -} - - void ec_mirror_flag(void) { /* @@ -74,12 +41,18 @@ void ec_mirror_flag(void) */ uint16_t ec_version = ec_get_version(); + /* Full mirror support was added in EC 1.18 (0x0112) */ + if (ec_version < 0x0112) + return; + if (CONFIG(EC_STARLABS_MIRROR_SUPPORT) && (CONFIG(DRIVERS_INTEL_USB4_RETIMER) || get_uint_option("mirror_flag", 0)) && (ec_version != CONFIG_EC_STARLABS_MIRROR_VERSION)) { + printk(BIOS_ERR, "ITE: EC version 0x%x doesn't match coreboot version 0x%x.\n", ec_version, CONFIG_EC_STARLABS_MIRROR_VERSION); - ec_mirror_with_count(); + + ec_write(ECRAM_MIRROR_FLAG, MIRROR_ENABLED); } } |