diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-08-15 17:17:59 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-08-15 17:17:59 +0000 |
commit | fa6fc8bf35fb077c2bf35790cd1df1e04544ffef (patch) | |
tree | 409e4bf78b9d726f6aa413933987055b6a1c0439 /flashrom.c | |
parent | e8c4e720a2ff9e97fde3dde8a6767a17cd52e96c (diff) | |
download | flashrom-fa6fc8bf35fb077c2bf35790cd1df1e04544ffef.zip flashrom-fa6fc8bf35fb077c2bf35790cd1df1e04544ffef.tar.gz |
Refine handling chips that exceed maximum programmer sizes
- Change check_max_decode() to return the number of (common) busses
where the flash chip exceeds the supported size of the programmer.
- Refine its signature to use a flashctx pointer only.
- Move CLI-related bits to cli_classic.c.
- Rename check_max_decode() to count_max_decode_exceedings() to
better reflect what it (now) really does.
- Refine the messages printed by the caller to better integrate with the new
setup, and simplify them.
Corresponding to flashrom svn r1842.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -1009,9 +1009,13 @@ int generate_testpattern(uint8_t *buf, uint32_t size, int variant) return 0; } -int check_max_decode(enum chipbustype buses, uint32_t size) +/* Returns the number of busses 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) { - int limitexceeded = 0; + 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++; @@ -1045,17 +1049,7 @@ int check_max_decode(enum chipbustype buses, uint32_t size) "probe/read/erase/write may fail. ", size / 1024, max_rom_decode.spi / 1024, "SPI"); } - if (!limitexceeded) - return 0; - /* Sometimes chip and programmer have more than one bus in common, - * and the limit is not exceeded on all buses. Tell the user. - */ - if (bitcount(buses) > limitexceeded) - /* FIXME: This message is designed towards CLI users. */ - msg_pdbg("There is at least one common chip/programmer " - "interface which can support a chip of this size. " - "You can try --force at your own risk.\n"); - return 1; + return limitexceeded; } int probe_flash(struct registered_master *mst, int startchip, struct flashctx *flash, int force) @@ -1079,9 +1073,6 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f continue; } - size = chip->total_size * 1024; - check_max_decode(buses_common, size); - /* Start filling in the dynamic data. */ flash->chip = calloc(1, sizeof(struct flashchip)); if (!flash->chip) { @@ -1091,6 +1082,7 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f memcpy(flash->chip, chip, sizeof(struct flashchip)); flash->mst = mst; + size = flash->chip->total_size * 1024; base = flashbase ? flashbase : (0xffffffff - size + 1); flash->virtual_memory = (chipaddr)programmer_map_flash_region("flash chip", base, size); |