Karthik Ramasubramanian has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84937?usp=email )
Change subject: mb/google/brox: Hint romstage init about upcoming reset ......................................................................
mb/google/brox: Hint romstage init about upcoming reset
Add support for the mainboard to check for any potential firmware component update and hence the assosicated reset. This indication can be used to avoid any redundant resets during the boot flow.
BUG=b:375444631 TEST=Build Brox BIOS image and boot to OS. Ensure that the hints are provided correctly and any redundant resets are filtered out.
Change-Id: Ieed3f9013dee9aa501a3f0403f3a28722a3878f1 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/brox/variants/baseboard/brox/Makefile.mk A src/mainboard/google/brox/variants/baseboard/brox/romstage.c M src/mainboard/google/brox/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/brox/variants/brox/Makefile.mk M src/mainboard/google/brox/variants/brox/variant.c M src/mainboard/google/brox/variants/jubilant/Makefile.mk M src/mainboard/google/brox/variants/jubilant/variant.c M src/mainboard/google/brox/variants/lotso/Makefile.mk M src/mainboard/google/brox/variants/lotso/variant.c 9 files changed, 90 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/84937/1
diff --git a/src/mainboard/google/brox/variants/baseboard/brox/Makefile.mk b/src/mainboard/google/brox/variants/baseboard/brox/Makefile.mk index 3a66958..b3149ba 100644 --- a/src/mainboard/google/brox/variants/baseboard/brox/Makefile.mk +++ b/src/mainboard/google/brox/variants/baseboard/brox/Makefile.mk @@ -4,6 +4,7 @@
romstage-y += memory.c romstage-y += gpio.c +romstage-y += romstage.c romstage-$(CONFIG_MAINBOARD_USE_EARLY_LIBGFXINIT) += gma-mainboard.ads
ramstage-y += gpio.c diff --git a/src/mainboard/google/brox/variants/baseboard/brox/romstage.c b/src/mainboard/google/brox/variants/baseboard/brox/romstage.c new file mode 100644 index 0000000..f493f34 --- /dev/null +++ b/src/mainboard/google/brox/variants/baseboard/brox/romstage.c @@ -0,0 +1,58 @@ +#include <baseboard/variants.h> +#include <cbfs.h> +#include <ec/google/chromeec/ec.h> +#include <security/vboot/vboot_common.h> +#include <security/vboot/misc.h> +#include <soc/romstage.h> + +#define FWVER_SIZE 3 +#define FWVER_TO_INT(MAJOR, MINOR, PATCH) \ + (uint32_t)(((MAJOR) & 0xFF) << 16 | ((MINOR) & 0xFF) << 8 | ((PATCH) & 0xFF)) + +static bool check_auxfw_ver_mismatch(void) +{ + uint8_t *exp_fwver; + size_t exp_fwver_size; + unsigned int num_ports = 0; + struct ec_response_pd_chip_info pd_chip_r = {0}; + const char *fwver_fname = variant_get_auxfw_version_file(); + bool mismatch = false; + int ret; + + ret = google_chromeec_get_num_pd_ports(&num_ports); + if (ret < 0 || !num_ports) { + printk(BIOS_INFO, "%s: Cannot resolve # of USB PD ports\n", __func__); + return mismatch; + } + + ret = google_chromeec_get_pd_chip_infoi(0, 0, &pd_chip_r); + if (ret < 0) { + printk(BIOS_INFO, "%s: Cannot get PD port info\n", __func__); + return mismatch; + } + + /* find bundled fw hash */ + exp_fwver = cbfs_map(fwver_fname, &exp_fwver_size); + if (exp_fwver == NULL || exp_fwver_size != FWVER_SIZE) + return mismatch; + + if (pd_chip_r.fw_version_number != + FWVER_TO_INT(exp_fwver[0], exp_fwver[1], exp_fwver[2])) { + printk(BIOS_INFO, "%s: Expecting Aux FW update and hence a reset\n", __func__); + mismatch = true; + } + + return mismatch; +} + +bool mainboard_expects_another_reset(void) +{ + if (vboot_recovery_mode_enabled()) + return false; + + if (vboot_is_gbb_flag_set(VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC) && + vboot_is_gbb_flag_set(VB2_GBB_FLAG_DISABLE_AUXFW_SOFTWARE_SYNC)) + return false; + + return check_auxfw_ver_mismatch(); +} diff --git a/src/mainboard/google/brox/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/brox/variants/baseboard/include/baseboard/variants.h index a1fbe01..070b2f8 100644 --- a/src/mainboard/google/brox/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/brox/variants/baseboard/include/baseboard/variants.h @@ -60,4 +60,5 @@ void variant_init(void); void variant_finalize(void);
+const char *variant_get_auxfw_version_file(void); #endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/brox/variants/brox/Makefile.mk b/src/mainboard/google/brox/variants/brox/Makefile.mk index 4a7ff71..19eb924 100644 --- a/src/mainboard/google/brox/variants/brox/Makefile.mk +++ b/src/mainboard/google/brox/variants/brox/Makefile.mk @@ -2,6 +2,7 @@
bootblock-y += gpio.c romstage-y += gpio.c +romstage-$(CONFIG_FW_CONFIG) += variant.c ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += variant.c ramstage-y += gpio.c diff --git a/src/mainboard/google/brox/variants/brox/variant.c b/src/mainboard/google/brox/variants/brox/variant.c index 332d152..7ef4973 100644 --- a/src/mainboard/google/brox/variants/brox/variant.c +++ b/src/mainboard/google/brox/variants/brox/variant.c @@ -25,3 +25,12 @@ { return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_BT)); } + +const char *variant_get_auxfw_version_file(void) +{ + if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_BYPASS))) + return "rts5453_retimer_bypass.hash"; + else if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_JHL8040))) + return "rts5453_retimer_jhl8040.hash"; + return NULL; +} diff --git a/src/mainboard/google/brox/variants/jubilant/Makefile.mk b/src/mainboard/google/brox/variants/jubilant/Makefile.mk index 503ef8f..bb7543b 100644 --- a/src/mainboard/google/brox/variants/jubilant/Makefile.mk +++ b/src/mainboard/google/brox/variants/jubilant/Makefile.mk @@ -4,6 +4,7 @@
romstage-y += gpio.c romstage-y += memory.c +romstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += variant.c diff --git a/src/mainboard/google/brox/variants/jubilant/variant.c b/src/mainboard/google/brox/variants/jubilant/variant.c index 5b75380..26140cd 100644 --- a/src/mainboard/google/brox/variants/jubilant/variant.c +++ b/src/mainboard/google/brox/variants/jubilant/variant.c @@ -31,6 +31,15 @@ return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_BT)); }
+const char *variant_get_auxfw_version_file(void) +{ + if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_BYPASS))) + return "rts5453_retimer_bypass.hash"; + else if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_JHL8040))) + return "rts5453_retimer_jhl8040.hash"; + return NULL; +} + static void wwan_out_of_reset(void *unused) { if (fw_config_probe(FW_CONFIG(DB_USB, DB_1A_LTE))) { diff --git a/src/mainboard/google/brox/variants/lotso/Makefile.mk b/src/mainboard/google/brox/variants/lotso/Makefile.mk index a1059a5..dde5215 100644 --- a/src/mainboard/google/brox/variants/lotso/Makefile.mk +++ b/src/mainboard/google/brox/variants/lotso/Makefile.mk @@ -4,6 +4,7 @@ romstage-y += memory.c romstage-y += gpio.c ramstage-y += gpio.c +romstage-$(CONFIG_FW_CONFIG) += variant.c ramstage-$(CONFIG_FW_CONFIG) += variant.c ramstage-y += ramstage.c smm-y += smihandler.c diff --git a/src/mainboard/google/brox/variants/lotso/variant.c b/src/mainboard/google/brox/variants/lotso/variant.c index 066acb2..baf8ee4 100644 --- a/src/mainboard/google/brox/variants/lotso/variant.c +++ b/src/mainboard/google/brox/variants/lotso/variant.c @@ -19,3 +19,12 @@ { return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_BT)); } + +const char *variant_get_auxfw_version_file(void) +{ + if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_BYPASS))) + return "rts5453_retimer_bypass.hash"; + else if (fw_config_probe(FW_CONFIG(RETIMER, RETIMER_JHL8040))) + return "rts5453_retimer_jhl8040.hash"; + return NULL; +}