From 42e2cda9c676f064c8a99f61dff614dfd52d1cc3 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Fri, 29 Jul 2022 00:23:37 +0300 Subject: [PATCH] Add --skip-wp-area CLI parameter Change-Id: I73c9a1a1e348820cc438f347a5e09f348e397fe6 Signed-off-by: Sergii Dmytruk --- cli_classic.c | 8 ++++++++ flashrom.8.tmpl | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/cli_classic.c b/cli_classic.c index 44e6fb5e..75926b60 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -66,6 +66,7 @@ static void cli_classic_usage(const char *name) " --wp-range=, set write protection range (use --wp-range=0,0\n" " to unprotect the entire flash)\n" " --wp-region set write protection region\n" + " --skip-wp-area skip over write-protected area\n" " --flash-name read out the detected flash name\n" " --flash-size read out the detected flash size\n" " --fmap read ROM layout from fmap embedded in ROM\n" @@ -472,6 +473,7 @@ int main(int argc, char *argv[]) int flash_name = 0, flash_size = 0; int enable_wp = 0, disable_wp = 0, print_wp_status = 0; int set_wp_range = 0, set_wp_region = 0, print_wp_ranges = 0; + int skip_wp_area = 0; uint32_t wp_start = 0, wp_len = 0; int read_it = 0, extract_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; @@ -491,6 +493,7 @@ int main(int argc, char *argv[]) OPTION_WP_ENABLE, OPTION_WP_DISABLE, OPTION_WP_LIST, + OPTION_SKIP_WP_AREA, OPTION_PROGRESS, }; int ret = 0; @@ -522,6 +525,7 @@ int main(int argc, char *argv[]) {"wp-region", 1, NULL, OPTION_WP_SET_REGION}, {"wp-enable", 0, NULL, OPTION_WP_ENABLE}, {"wp-disable", 0, NULL, OPTION_WP_DISABLE}, + {"skip-wp-area", 0, NULL, OPTION_SKIP_WP_AREA}, {"list-supported", 0, NULL, 'L'}, {"list-supported-wiki", 0, NULL, 'z'}, {"programmer", 1, NULL, 'p'}, @@ -691,6 +695,9 @@ int main(int argc, char *argv[]) case OPTION_WP_DISABLE: disable_wp = 1; break; + case OPTION_SKIP_WP_AREA: + skip_wp_area = 1; + break; case 'L': cli_classic_validate_singleop(&operation_specified); list_supported = 1; @@ -1073,6 +1080,7 @@ int main(int argc, char *argv[]) #endif flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_AFTER_WRITE, !dont_verify_it); flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, !dont_verify_all); + flashrom_flag_set(fill_flash, FLASHROM_FLAG_SKIP_WP_AREA, skip_wp_area); /* FIXME: We should issue an unconditional chip reset here. This can be * done once we have a .reset function in struct flashchip. diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl index 2cf3a38c..e52dbdea 100644 --- a/flashrom.8.tmpl +++ b/flashrom.8.tmpl @@ -52,6 +52,7 @@ flashrom \- detect, read, write, verify and erase flash chips [\fB\-i\fR [:]]] [\fB\-\-wp\-status\fR] [\fB\-\-wp\-list\fR] [\fB\-\-wp\-enable\fR|\fB\-\-wp\-disable\fR] [\fB\-\-wp\-range\fR ,|\fB\-\-wp\-region\fR ] + [\fB\-\-skip\-wp\-area\fR] [\fB\-n\fR] [\fB\-N\fR] [\fB\-f\fR])] [\fB\-V\fR[\fBV\fR[\fBV\fR]]] [\fB-o\fR ] [\fB\-\-progress\fR] @@ -315,6 +316,9 @@ This option requires a image layout to be specified, see \fB\-\-layout\fR. The region must be supported by the flash, see \fB\-\-wp\-list\fR. .TP +.B "\-\-skip\-wp-area" +Make flashrom automatically skip over write-protected area. +.TP .B "\-\-flash\-name" Prints out the detected flash chip's name. .TP