summaryrefslogtreecommitdiff
path: root/cli_classic.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2011-12-20 00:19:29 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2011-12-20 00:19:29 +0000
commitee3862fe86e592fd3eeae182a38cbdb3f42f7bd5 (patch)
tree7f9db61c7b4868e513c4702cfe57bb35ae695266 /cli_classic.c
parente8c818e1cd78e69a3cb2ad9785a48a858f34415c (diff)
downloadflashrom-ee3862fe86e592fd3eeae182a38cbdb3f42f7bd5.tar.gz
Have all programmer init functions register bus masters/programmers
All programmer types (Parallel, SPI, Opaque) now register themselves into a generic programmer list and probing is now programmer-centric instead of chip-centric. Registering multiple SPI/... masters at the same time is now possible without any problems. Handling multiple flash chips is still unchanged, but now we have the infrastructure to deal with "dual BIOS" and "one flash behind southbridge and one flash behind EC" sanely. A nice side effect is that this patch kills quite a few global variables and improves the situation for libflashrom. Hint for developers: struct {spi,par,opaque}_programmer now have a void *data pointer to store any additional programmer-specific data, e.g. hardware configuration info. Note: flashrom -f -c FOO -r forced_read.bin does not work anymore. We have to find an architecturally clean way to solve this. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1475 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/cli_classic.c b/cli_classic.c
index bb8c29f..543b644 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
struct flashctx flashes[3];
struct flashctx *fill_flash;
const char *name;
- int namelen, opt, i;
+ int namelen, opt, i, j;
int startchip = 0, chipcount = 0, option_index = 0, force = 0;
#if CONFIG_PRINT_WIKI == 1
int list_supported_wiki = 0;
@@ -444,17 +444,21 @@ int main(int argc, char *argv[])
ret = 1;
goto out_shutdown;
}
- tempstr = flashbuses_to_text(buses_supported);
- msg_pdbg("This programmer supports the following protocols: %s.\n",
+ tempstr = flashbuses_to_text(get_buses_supported());
+ msg_pdbg("The following protocols are supported: %s.\n",
tempstr);
free(tempstr);
- for (i = 0; i < ARRAY_SIZE(flashes); i++) {
- startchip = probe_flash(startchip, &flashes[i], 0);
- if (startchip == -1)
- break;
- chipcount++;
- startchip++;
+ for (j = 0; j < registered_programmer_count; j++) {
+ startchip = 0;
+ for (i = 0; i < ARRAY_SIZE(flashes); i++) {
+ startchip = probe_flash(&registered_programmers[j],
+ startchip, &flashes[i], 0);
+ if (startchip == -1)
+ break;
+ chipcount++;
+ startchip++;
+ }
}
if (chipcount > 1) {
@@ -472,6 +476,7 @@ int main(int argc, char *argv[])
printf("Note: flashrom can never write if the flash "
"chip isn't found automatically.\n");
}
+#if 0 // FIXME: What happens for a forced chip read if multiple compatible programmers are registered?
if (force && read_it && chip_to_probe) {
printf("Force read (-f -r -c) requested, pretending "
"the chip is there:\n");
@@ -486,6 +491,7 @@ int main(int argc, char *argv[])
"contain garbage.\n");
return read_flash_to_file(&flashes[0], filename);
}
+#endif
ret = 1;
goto out_shutdown;
} else if (!chip_to_probe) {
@@ -502,7 +508,7 @@ int main(int argc, char *argv[])
check_chip_supported(fill_flash);
size = fill_flash->total_size * 1024;
- if (check_max_decode((buses_supported & fill_flash->bustype), size) &&
+ if (check_max_decode(fill_flash->pgm->buses_supported & fill_flash->bustype, size) &&
(!force)) {
fprintf(stderr, "Chip is too big for this programmer "
"(-V gives details). Use --force to override.\n");