Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/68438 )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: flashrom.c: Move count_max_decode_exceeding() to cli ......................................................................
flashrom.c: Move count_max_decode_exceeding() to cli
The count_max_decode_exceeding() function is only ever called within the cli_classic logic so move it there and make it static. This further cleans up the flashrom.c symbol namespace.
Change-Id: If050eab7db8560676c03d5005a2b391313a0d642 Signed-off-by: Edward O'Callaghan quasisec@google.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/68438 Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M cli_classic.c M flashrom.c M include/programmer.h 3 files changed, 60 insertions(+), 44 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/cli_classic.c b/cli_classic.c index d258cb4..b66094c 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -516,6 +516,49 @@ return ret; }
+/* Returns the number of buses commonly supported by the current programmer and flash chip where the latter + * can not be completely accessed due to size/address limits of the programmer. */ +static unsigned int count_max_decode_exceedings(const struct flashctx *flash) +{ + unsigned int limitexceeded = 0; + uint32_t size = flash->chip->total_size * 1024; + enum chipbustype buses = flash->mst->buses_supported & flash->chip->bustype; + + if ((buses & BUS_PARALLEL) && (max_rom_decode.parallel < size)) { + limitexceeded++; + msg_pdbg("Chip size %u kB is bigger than supported " + "size %u kB of chipset/board/programmer " + "for %s interface, " + "probe/read/erase/write may fail. ", size / 1024, + max_rom_decode.parallel / 1024, "Parallel"); + } + if ((buses & BUS_LPC) && (max_rom_decode.lpc < size)) { + limitexceeded++; + msg_pdbg("Chip size %u kB is bigger than supported " + "size %u kB of chipset/board/programmer " + "for %s interface, " + "probe/read/erase/write may fail. ", size / 1024, + max_rom_decode.lpc / 1024, "LPC"); + } + if ((buses & BUS_FWH) && (max_rom_decode.fwh < size)) { + limitexceeded++; + msg_pdbg("Chip size %u kB is bigger than supported " + "size %u kB of chipset/board/programmer " + "for %s interface, " + "probe/read/erase/write may fail. ", size / 1024, + max_rom_decode.fwh / 1024, "FWH"); + } + if ((buses & BUS_SPI) && (max_rom_decode.spi < size)) { + limitexceeded++; + msg_pdbg("Chip size %u kB is bigger than supported " + "size %u kB of chipset/board/programmer " + "for %s interface, " + "probe/read/erase/write may fail. ", size / 1024, + max_rom_decode.spi / 1024, "SPI"); + } + return limitexceeded; +} + int main(int argc, char *argv[]) { const struct flashchip *chip = NULL; diff --git a/flashrom.c b/flashrom.c index 624c463..0f982c9 100644 --- a/flashrom.c +++ b/flashrom.c @@ -630,49 +630,6 @@ return first_len; }
-/* Returns the number of buses commonly supported by the current programmer and flash chip where the latter - * can not be completely accessed due to size/address limits of the programmer. */ -unsigned int count_max_decode_exceedings(const struct flashctx *flash) -{ - unsigned int limitexceeded = 0; - uint32_t size = flash->chip->total_size * 1024; - enum chipbustype buses = flash->mst->buses_supported & flash->chip->bustype; - - if ((buses & BUS_PARALLEL) && (max_rom_decode.parallel < size)) { - limitexceeded++; - msg_pdbg("Chip size %u kB is bigger than supported " - "size %u kB of chipset/board/programmer " - "for %s interface, " - "probe/read/erase/write may fail. ", size / 1024, - max_rom_decode.parallel / 1024, "Parallel"); - } - if ((buses & BUS_LPC) && (max_rom_decode.lpc < size)) { - limitexceeded++; - msg_pdbg("Chip size %u kB is bigger than supported " - "size %u kB of chipset/board/programmer " - "for %s interface, " - "probe/read/erase/write may fail. ", size / 1024, - max_rom_decode.lpc / 1024, "LPC"); - } - if ((buses & BUS_FWH) && (max_rom_decode.fwh < size)) { - limitexceeded++; - msg_pdbg("Chip size %u kB is bigger than supported " - "size %u kB of chipset/board/programmer " - "for %s interface, " - "probe/read/erase/write may fail. ", size / 1024, - max_rom_decode.fwh / 1024, "FWH"); - } - if ((buses & BUS_SPI) && (max_rom_decode.spi < size)) { - limitexceeded++; - msg_pdbg("Chip size %u kB is bigger than supported " - "size %u kB of chipset/board/programmer " - "for %s interface, " - "probe/read/erase/write may fail. ", size / 1024, - max_rom_decode.spi / 1024, "SPI"); - } - return limitexceeded; -} - void unmap_flash(struct flashctx *flash) { if (flash->virtual_registers != (chipaddr)ERROR_PTR) { diff --git a/include/programmer.h b/include/programmer.h index 9603443..386e6ec 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -286,7 +286,6 @@ extern struct decode_sizes max_rom_decode; extern bool programmer_may_write; extern unsigned long flashbase; -unsigned int count_max_decode_exceedings(const struct flashctx *flash); char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name);
/* spi.c */