diff --git a/src/mainboard/google/brya/cfr.c b/src/mainboard/google/brya/cfr.c index 2128145042..31b3274933 100644 --- a/src/mainboard/google/brya/cfr.c +++ b/src/mainboard/google/brya/cfr.c @@ -6,6 +6,32 @@ #include #include +#if CONFIG(BOARD_GOOGLE_TANIKS) || CONFIG(BOARD_GOOGLE_TAEKO) + +enum storage_device { + STORAGE_NVME = 0, + STORAGE_EMMC = 1, +}; + +static const struct sm_object storage_device_opt = SM_DECLARE_ENUM({ + .opt_name = "storage_device", + .ui_name = "Storage Device", + .ui_helptext = "Select which storage device to use (NVMe SSD or eMMC)", + .default_value = STORAGE_NVME, + .values = (const struct sm_enum_value[]) { + { "NVMe SSD", STORAGE_NVME }, + { "eMMC", STORAGE_EMMC }, + SM_ENUM_VALUE_END }, +}); +static struct sm_obj_form devices = { + .ui_name = "Devices", + .obj_list = (const struct sm_object *[]) { + &storage_device_opt, + NULL + }, +}; +#endif + static struct sm_obj_form system = { .ui_name = "System", .obj_list = (const struct sm_object *[]) { @@ -37,6 +63,9 @@ static struct sm_obj_form ec = { static struct sm_obj_form *sm_root[] = { &system, +#if CONFIG(BOARD_GOOGLE_TANIKS) || CONFIG(BOARD_GOOGLE_TAEKO) + &devices, +#endif &ec, NULL }; diff --git a/src/mainboard/google/brya/variants/taeko/Makefile.mk b/src/mainboard/google/brya/variants/taeko/Makefile.mk index 47f0432aeb..f269b09163 100644 --- a/src/mainboard/google/brya/variants/taeko/Makefile.mk +++ b/src/mainboard/google/brya/variants/taeko/Makefile.mk @@ -8,6 +8,7 @@ romstage-y += memory.c ramstage-y += gpio.c +romstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += variant.c diff --git a/src/mainboard/google/brya/variants/taeko/fw_config.c b/src/mainboard/google/brya/variants/taeko/fw_config.c index 5068f84581..fbf214db54 100644 --- a/src/mainboard/google/brya/variants/taeko/fw_config.c +++ b/src/mainboard/google/brya/variants/taeko/fw_config.c @@ -4,6 +4,44 @@ #include #include #include +#include +#include +#include + +enum storage_device { + STORAGE_NVME = 0, + STORAGE_EMMC = 1, +}; + +/* Override fw_config_probe_mainboard_override to check CFR for storage selection */ +bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *result) +{ + /* Check if this is a storage-related probe */ + if (match->field_name) { + /* Read CFR option directly - default to NVMe if not available */ + uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME); + if (strcmp(match->field_name, "BOOT_NVME_MASK") == 0) { + /* NVMe is enabled if storage selection is NVMe */ + *result = (storage_selection == STORAGE_NVME); + if (*result) { + printk(BIOS_INFO, "fw_config: NVMe enabled by CFR\n"); + } + return true; + } + if (strcmp(match->field_name, "BOOT_EMMC_MASK") == 0) { + /* eMMC is enabled if storage selection is eMMC */ + *result = (storage_selection == STORAGE_EMMC); + if (*result) { + printk(BIOS_INFO, "fw_config: eMMC enabled by CFR\n"); + } + return true; + } + } + + /* Not handled - use standard fw_config logic */ + return false; +} + static const struct pad_config dmic_enable_pads[] = { PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC_CLK0_R */ diff --git a/src/mainboard/google/brya/variants/taniks/Makefile.mk b/src/mainboard/google/brya/variants/taniks/Makefile.mk index 61a70ec0ef..a70ba96714 100644 --- a/src/mainboard/google/brya/variants/taniks/Makefile.mk +++ b/src/mainboard/google/brya/variants/taniks/Makefile.mk @@ -6,6 +6,7 @@ romstage-y += gpio.c romstage-y += memory.c ramstage-y += gpio.c +romstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += variant.c diff --git a/src/mainboard/google/brya/variants/taniks/fw_config.c b/src/mainboard/google/brya/variants/taniks/fw_config.c index f79110391c..b29ea56d98 100644 --- a/src/mainboard/google/brya/variants/taniks/fw_config.c +++ b/src/mainboard/google/brya/variants/taniks/fw_config.c @@ -4,6 +4,43 @@ #include #include #include +#include +#include +#include + +enum storage_device { + STORAGE_NVME = 0, + STORAGE_EMMC = 1, +}; + +/* Override fw_config_probe_mainboard_override to check CFR for storage selection */ +bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *result) +{ + /* Check if this is a storage-related probe */ + if (match->field_name) { + /* Read CFR option directly - default to NVMe if not available */ + uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME); + if (strcmp(match->field_name, "BOOT_NVME_MASK") == 0) { + /* NVMe is enabled if storage selection is NVMe */ + *result = (storage_selection == STORAGE_NVME); + if (*result) { + printk(BIOS_INFO, "fw_config: NVMe enabled by CFR\n"); + } + return true; + } + if (strcmp(match->field_name, "BOOT_EMMC_MASK") == 0) { + /* eMMC is enabled if storage selection is eMMC */ + *result = (storage_selection == STORAGE_EMMC); + if (*result) { + printk(BIOS_INFO, "fw_config: eMMC enabled by CFR\n"); + } + return true; + } + } + + /* Not handled - use standard fw_config logic */ + return false; +} static const struct pad_config dmic_enable_pads[] = { PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC_CLK0_R */