diff options
author | Edward O'Callaghan <quasisec@google.com> | 2023-03-06 11:25:52 +1100 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2023-04-06 04:43:29 +0000 |
commit | 67b5526d5c46bfc4d70fb288b9227097fc113e30 (patch) | |
tree | abb7854554929194daf7e22bc4cd9a052f72e78b /chipset_enable.c | |
parent | 3ed016f08faa011736443f3b39bf68187d974781 (diff) | |
download | flashrom-67b5526d5c46bfc4d70fb288b9227097fc113e30.tar.gz flashrom-67b5526d5c46bfc4d70fb288b9227097fc113e30.tar.bz2 flashrom-67b5526d5c46bfc4d70fb288b9227097fc113e30.zip |
internal: Move laptop_ok into board_cfg
Due to how internal is structured around chipset_flash_enable()
entry we need to prepare a crafted programmer_cfg that contains
a board_enable substructure with data derived from the board_enable
subsystem. While this is certainly not perfection, it does make
clear the relationships between board_enable into chipset_flash_enable
and subsequently the overall internal programmer initialisation
in a RAII fashion at the type level over closure upon global
state that is impossible to reason about.
Also flip predicate in report_nonwl_laptop_detected() and
return early with the trivial base-case.
TEST=`$ sudo ./flashrom -p internal --flash-name`.
Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/73456
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
Diffstat (limited to 'chipset_enable.c')
-rw-r--r-- | chipset_enable.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chipset_enable.c b/chipset_enable.c index 37a48fc9..16ef0f46 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -826,7 +826,7 @@ static int enable_flash_ich_spi(const struct programmer_cfg *cfg, struct pci_dev /* Suppress unknown laptop warning if we booted from SPI. */ if (boot_buses & BUS_SPI) - g_laptop_ok = true; + cfg->bcfg->laptop_ok = true; return 0; } @@ -971,7 +971,7 @@ static int enable_flash_pch100_or_c620(const struct programmer_cfg *cfg, /* Suppress unknown laptop warning if we booted from SPI. */ if (!ret && (boot_buses & BUS_SPI)) - g_laptop_ok = true; + cfg->bcfg->laptop_ok = true; _freepci_ret: pci_free_dev(spi_dev); @@ -1087,7 +1087,7 @@ static int enable_flash_silvermont(const struct programmer_cfg *cfg, struct pci_ /* Suppress unknown laptop warning if we booted from SPI. */ if (boot_buses & BUS_SPI) - g_laptop_ok = true; + cfg->bcfg->laptop_ok = true; return 0; } @@ -1676,7 +1676,7 @@ static int enable_flash_mcp6x_7x(const struct programmer_cfg *cfg, struct pci_de /* Suppress unknown laptop warning if we booted from SPI. */ if (!ret && want_spi) - g_laptop_ok = true; + cfg->bcfg->laptop_ok = true; return ret; } |