|
4 | 4 | #include <console/console.h> |
5 | 5 | #include <fw_config.h> |
6 | 6 | #include <gpio.h> |
| 7 | +#include <option.h> |
| 8 | +#include <string.h> |
| 9 | +#include <types.h> |
| 10 | + |
| 11 | +enum storage_device { |
| 12 | + STORAGE_NVME = 0, |
| 13 | + STORAGE_EMMC = 1, |
| 14 | +}; |
| 15 | + |
| 16 | +/* Override fw_config_probe_mainboard_override to check CFR for storage selection */ |
| 17 | +bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *handled) |
| 18 | +{ |
| 19 | + /* Check if this is a storage-related probe */ |
| 20 | + if (match->field_name) { |
| 21 | + if (strcmp(match->field_name, "BOOT_NVME_MASK") == 0) { |
| 22 | + /* Read CFR option directly - default to NVMe if not available */ |
| 23 | + uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME); |
| 24 | + /* NVMe is enabled if storage selection is NVMe */ |
| 25 | + *handled = true; |
| 26 | + if (storage_selection == STORAGE_NVME) { |
| 27 | + printk(BIOS_INFO, "fw_config: NVMe enabled by CFR (selection=%d)\n", |
| 28 | + storage_selection); |
| 29 | + return true; |
| 30 | + } |
| 31 | + printk(BIOS_INFO, "fw_config: NVMe disabled by CFR (selection=%d)\n", |
| 32 | + storage_selection); |
| 33 | + return false; |
| 34 | + } |
| 35 | + if (strcmp(match->field_name, "BOOT_EMMC_MASK") == 0) { |
| 36 | + /* Read CFR option directly - default to NVMe if not available */ |
| 37 | + uint8_t storage_selection = get_uint_option("storage_device", STORAGE_NVME); |
| 38 | + /* eMMC is enabled if storage selection is eMMC */ |
| 39 | + *handled = true; |
| 40 | + if (storage_selection == STORAGE_EMMC) { |
| 41 | + printk(BIOS_INFO, "fw_config: eMMC enabled by CFR (selection=%d)\n", |
| 42 | + storage_selection); |
| 43 | + return true; |
| 44 | + } |
| 45 | + printk(BIOS_INFO, "fw_config: eMMC disabled by CFR (selection=%d)\n", |
| 46 | + storage_selection); |
| 47 | + return false; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /* Not handled - use standard fw_config logic */ |
| 52 | + *handled = false; |
| 53 | + return false; |
| 54 | +} |
| 55 | + |
7 | 56 |
|
8 | 57 | static const struct pad_config dmic_enable_pads[] = { |
9 | 58 | PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC_CLK0_R */ |
|
0 commit comments