diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2017-07-28 16:46:30 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-08-01 13:57:44 +1000 |
commit | b9454866da48a68305b639c142d649b9cb9cf005 (patch) | |
tree | 4895e03583072e2f6878ac40854f5219eb705d26 /external/pflash | |
parent | ddfbfd18f714c30f758c9a5f2bb13ce3c3f6954c (diff) | |
download | skiboot-b9454866da48a68305b639c142d649b9cb9cf005.zip skiboot-b9454866da48a68305b639c142d649b9cb9cf005.tar.gz skiboot-b9454866da48a68305b639c142d649b9cb9cf005.tar.bz2 |
external/pflash: Update the code pathes for "--tune"
It doesn't make sense for --tune to do anything unless --direct was
passed.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/pflash')
-rw-r--r-- | external/pflash/pflash.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index 064b5a9..c0d9686 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -592,6 +592,7 @@ static void print_help(const char *pname) printf("\t\ttake place first.\n\n"); printf("\t-t, --tune\n"); printf("\t\tJust tune the flash controller & access size\n"); + printf("\t\tMust be used in conjuction with --direct\n"); printf("\t\t(Implicit for all other operations)\n\n"); printf("\t-c --clear\n"); printf("\t\tUsed to ECC clear a partition of the flash\n"); @@ -896,7 +897,17 @@ int main(int argc, char *argv[]) write_size = stbuf.st_size; } + if (tune && !direct) { + fprintf(stderr, "It doesn't make sense to --tune without --direct\n"); + rc = 1; + goto out; + } + if (direct) { + /* If -t is passed, then print a nice message */ + if (tune) + printf("Flash and controller tuned\n"); + if (arch_flash_access(NULL, bmc_flash ? BMC_DIRECT : PNOR_DIRECT) == ACCESS_INVAL) { fprintf(stderr, "Can't access %s flash directly on this architecture\n", bmc_flash ? "BMC" : "PNOR"); @@ -926,9 +937,6 @@ int main(int argc, char *argv[]) goto out; } - /* If -t is passed, then print a nice message */ - if (tune) - printf("Flash and controller tuned\n"); /* If read specified and no read_size, use flash size */ if (do_read && !read_size && !part_name) |