David Hendricks has uploaded this change for review. ( https://review.coreboot.org/23346
Change subject: cli_classic: Add --chip-size command ......................................................................
cli_classic: Add --chip-size command
This adds a command to print the size of the detected flash chip (in bytes).
Change-Id: Ia6f334654bea73478f369207e6f4345bcb72e8d4 Signed-off-by: David Hendricks david.hendricks@gmail.com --- M cli_classic.c 1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/46/23346/1
diff --git a/cli_classic.c b/cli_classic.c index a1f1cad..024779a 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -107,6 +107,7 @@ #endif int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0; int dont_verify_it = 0, dont_verify_all = 0, list_supported = 0, operation_specified = 0; + int chip_size = 0; struct flashrom_layout *layout = NULL; enum programmer prog = PROGRAMMER_INVALID; int ret = 0; @@ -124,6 +125,7 @@ {"force", 0, NULL, 'f'}, {"layout", 1, NULL, 'l'}, {"ifd", 0, NULL, 0x0100}, + {"chip-size", 0, NULL, 0x0101}, {"image", 1, NULL, 'i'}, {"list-supported", 0, NULL, 'L'}, {"list-supported-wiki", 0, NULL, 'z'}, @@ -234,6 +236,9 @@ } ifd = 1; break; + case 0x0101: + chip_size = 1; + break; case 'i': tempstr = strdup(optarg); if (register_include_arg(tempstr)) { @@ -547,11 +552,16 @@ goto out_shutdown; }
- if (!(read_it | write_it | verify_it | erase_it)) { + if (!(read_it | write_it | verify_it | erase_it | chip_size)) { msg_ginfo("No operations were specified.\n"); goto out_shutdown; }
+ if (chip_size) { + msg_ginfo("%d\n", fill_flash->chip->total_size * 1024); + goto out_shutdown; + } + if (layoutfile) { layout = get_global_layout(); } else if (ifd && (flashrom_layout_read_from_ifd(&layout, fill_flash, NULL, 0) ||