summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-08-15 17:17:59 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-08-15 17:17:59 +0000
commit9e3a6984da1bb38af37ce4bb54af8f7475b7c766 (patch)
tree409e4bf78b9d726f6aa413933987055b6a1c0439 /cli_classic.c
parent9b32de94f5104cb7fa12816b7fa561b804df6ed8 (diff)
downloadast2050-flashrom-9e3a6984da1bb38af37ce4bb54af8f7475b7c766.zip
ast2050-flashrom-9e3a6984da1bb38af37ce4bb54af8f7475b7c766.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 'cli_classic.c')
-rw-r--r--cli_classic.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 73ab57a..945ad7b 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -91,7 +91,6 @@ static int check_filename(char *filename, char *type)
int main(int argc, char *argv[])
{
- unsigned long size;
/* Probe for up to three flash chips. */
const struct flashchip *chip = NULL;
struct flashctx flashes[6] = {{0}};
@@ -501,9 +500,18 @@ int main(int argc, char *argv[])
print_chip_support_status(fill_flash->chip);
- size = fill_flash->chip->total_size * 1024;
- if (check_max_decode(fill_flash->mst->buses_supported & fill_flash->chip->bustype, size) && (!force)) {
- msg_cerr("Chip is too big for this programmer (-V gives details). Use --force to override.\n");
+ unsigned int limitexceeded = count_max_decode_exceedings(fill_flash);
+ if (limitexceeded > 0 && !force) {
+ enum chipbustype commonbuses = fill_flash->mst->buses_supported & fill_flash->chip->bustype;
+
+ /* 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(commonbuses) > limitexceeded)) {
+ msg_pdbg("There is at least one interface available which could support the size of\n"
+ "the selected flash chip.\n");
+ }
+ msg_cerr("This flash chip is too big for this programmer (--verbose/-V gives details).\n"
+ "Use --force/-f to override at your own risk.\n");
ret = 1;
goto out_shutdown;
}
OpenPOWER on IntegriCloud