diff options
| -rw-r--r-- | cli_classic.c | 9 | ||||
| -rw-r--r-- | dummyflasher.c | 2 | ||||
| -rw-r--r-- | flashrom.c | 35 | ||||
| -rw-r--r-- | include/flash.h | 1 | 
4 files changed, 3 insertions, 44 deletions
| diff --git a/cli_classic.c b/cli_classic.c index a0c18d4e..95430098 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -916,14 +916,9 @@ int main(int argc, char *argv[])  				ret = 1;  				goto out_shutdown;  			} -			if (map_flash(&flashes[0]) != 0) { -				free(flashes[0].chip); -				ret = 1; -				goto out_shutdown; -			}  			msg_cinfo("Please note that forced reads most likely contain garbage.\n"); -			ret = read_flash_to_file(&flashes[0], filename); -			unmap_flash(&flashes[0]); +			flashrom_flag_set(&flashes[0], FLASHROM_FLAG_FORCE, !!force); +			ret = do_read(&flashes[0], filename);  			free(flashes[0].chip);  			goto out_shutdown;  		} diff --git a/dummyflasher.c b/dummyflasher.c index 1ee9d3ea..50a84d46 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -1265,7 +1265,7 @@ int probe_variable_size(struct flashctx *flash)  	 * Once that happens, we need to have special hacks in functions:  	 *  	 *     erase_and_write_flash() in flashrom.c -	 *     read_flash_to_file() +	 *     do_read()  	 *     handle_romentries()  	 *     ...  	 * @@ -1070,41 +1070,6 @@ static int read_by_layout(struct flashctx *const flashctx, uint8_t *const buffer  	return 0;  } -int read_flash_to_file(struct flashctx *flash, const char *filename) -{ -	unsigned long size = flash->chip->total_size * 1024; -	unsigned char *buf = calloc(size, sizeof(unsigned char)); -	int ret = 0; - -	msg_cinfo("Reading flash... "); -	if (!buf) { -		msg_gerr("Memory allocation failed!\n"); -		msg_cinfo("FAILED.\n"); -		return 1; -	} -	if (!flash->chip->read) { -		msg_cerr("No read function available for this flash chip.\n"); -		ret = 1; -		goto out_free; -	} -	if (read_by_layout(flash, buf)) { -		msg_cerr("Read operation failed!\n"); -		ret = 1; -		goto out_free; -	} -	if (write_buf_to_include_args(flash, buf)) { -		ret = 1; -		goto out_free; -	} - -	if (filename) -		ret = write_buf_to_file(buf, size, filename); -out_free: -	free(buf); -	msg_cinfo("%s.\n", ret ? "FAILED" : "done"); -	return ret; -} -  /* Even if an error is found, the function will keep going and check the rest. */  static int selfcheck_eraseblocks(const struct flashchip *chip)  { diff --git a/include/flash.h b/include/flash.h index 805387fe..5170ba72 100644 --- a/include/flash.h +++ b/include/flash.h @@ -410,7 +410,6 @@ void unmap_flash(struct flashctx *flash);  int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);  int erase_flash(struct flashctx *flash);  int probe_flash(struct registered_master *mst, int startchip, struct flashctx *fill_flash, int force); -int read_flash_to_file(struct flashctx *flash, const char *filename);  int verify_range(struct flashctx *flash, const uint8_t *cmpbuf, unsigned int start, unsigned int len);  int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran, const uint8_t erased_value);  void emergency_help_message(void); | 
