1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 06:01:16 +02:00

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>
This commit is contained in:
Stefan Tauner
2014-08-15 17:17:59 +00:00
parent 9b32de94f5
commit 9e3a6984da
3 changed files with 21 additions and 21 deletions

View File

@ -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;
}