diff options
Diffstat (limited to 'cli_classic.c')
-rw-r--r-- | cli_classic.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cli_classic.c b/cli_classic.c index d258cb4c8..b66094ccd 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -516,6 +516,49 @@ _free_ret: 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; |