From 899e4ec810a1e2f3d377bc2095ba3d25b234a797 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Fri, 29 Apr 2016 18:39:01 +0200 Subject: Kill doit() No words can describe this feeling. v2: Rejoice while removing more, orphaned code (layout.c). Change-Id: Id81177c50b4410e68dcf8ebab48386a94cd9b714 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/17949 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- cli_classic.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'cli_classic.c') diff --git a/cli_classic.c b/cli_classic.c index 984a4dac..00baf490 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -530,24 +530,28 @@ int main(int argc, char *argv[]) goto out_shutdown; } - /* Always verify write operations unless -n is used. */ - if (write_it && !dont_verify_it) - verify_it = 1; + if (layoutfile) + flashrom_layout_set(fill_flash, get_global_layout()); - /* Map the selected flash chip again. */ - if (map_flash(fill_flash) != 0) { - ret = 1; - goto out_shutdown; - } + flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE, !!force); + flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE_BOARDMISMATCH, !!force_boardmismatch); + flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_AFTER_WRITE, !dont_verify_it); + flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, true); /* FIXME: We should issue an unconditional chip reset here. This can be * done once we have a .reset function in struct flashchip. * Give the chip time to settle. */ programmer_delay(100000); - ret |= doit(fill_flash, force, filename, read_it, write_it, erase_it, verify_it); + if (read_it) + ret = do_read(fill_flash, filename); + else if (erase_it) + ret = do_erase(fill_flash); + else if (write_it) + ret = do_write(fill_flash, filename); + else if (verify_it) + ret = do_verify(fill_flash, filename); - unmap_flash(fill_flash); out_shutdown: programmer_shutdown(); out: -- cgit v1.2.3