1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

Kill obsolete exclude range feature

It is ignored by almost every chip and does not work for external
flashers. Plus, it gives the user a false sense of security in some
corner cases.

Corresponding to flashrom svn r608.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
This commit is contained in:
Carl-Daniel Hailfinger 2009-06-19 11:23:57 +00:00
parent 20a293fc68
commit 49eb4dd704
3 changed files with 7 additions and 60 deletions

View File

@ -3,7 +3,7 @@
flashrom \- detect, read, write, verify and erase flash chips
.SH SYNOPSIS
.B flashrom \fR[\fB\-VfLzhR\fR] [\fB\-E\fR|\fB\-r\fR file|\fB\-w\fR file|\fB\-v\fR file]
[\fB\-c\fR chipname] [\fB\-s\fR addr] [\fB\-e\fR addr] [\fB\-m\fR [vendor:]part]
[\fB\-c\fR chipname] [\fB\-m\fR [vendor:]part]
[\fB\-l\fR file] [\fB\-i\fR image] [\fB\-p\fR programmer] [file]
.SH DESCRIPTION
.B flashrom
@ -50,9 +50,6 @@ More verbose output.
.TP
.B "\-c, \-\-chip" <chipname>
Probe only for specified flash ROM chip.
.TP
.B "\-s, \-\-estart" <addr>
Exclude start position (obsolete).
.sp
flashrom supports ROM layouts. This allows you to flash certain parts of
the flash chip only. A ROM layout file looks like follows:
@ -81,9 +78,6 @@ ROM layouts should replace the \-s and \-e option since they are more
flexible and they should lead to a ROM update file format with the
ROM layout and the ROM image in one file (cpio, zip or something?).
.TP
.B "\-e, \-\-eend" <addr>
Exclude end postion (obsolete).
.TP
.B "\-m, \-\-mainboard" <[vendor:]part>
Override mainboard settings.
.sp

View File

@ -31,7 +31,6 @@
#include "flashchips.h"
char *chip_to_probe = NULL;
int exclude_start_page, exclude_end_page;
int verbose = 0;
int programmer = PROGRAMMER_INTERNAL;
@ -410,7 +409,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
return 0;
}
int read_flash(struct flashchip *flash, char *filename, unsigned int exclude_start_position, unsigned int exclude_end_position)
int read_flash(struct flashchip *flash, char *filename)
{
unsigned long numbytes;
FILE *image;
@ -433,10 +432,6 @@ int read_flash(struct flashchip *flash, char *filename, unsigned int exclude_sta
} else
flash->read(flash, buf, 0, size);
if (exclude_end_position - exclude_start_position > 0)
memset(buf + exclude_start_position, 0,
exclude_end_position - exclude_start_position);
numbytes = fwrite(buf, 1, size, image);
fclose(image);
free(buf);
@ -482,8 +477,8 @@ int erase_flash(struct flashchip *flash)
void usage(const char *name)
{
printf("usage: %s [-VfLzhR] [-E|-r file|-w file|-v file] [-c chipname] [-s addr]\n"
" [-e addr] [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]\n\n", name);
printf("usage: %s [-VfLzhR] [-E|-r file|-w file|-v file] [-c chipname]\n"
" [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]\n\n", name);
printf("Please note that the command line interface for flashrom will "
"change before\nflashrom 1.0. Do not use flashrom in scripts "
@ -497,8 +492,6 @@ void usage(const char *name)
" -E | --erase: erase flash device\n"
" -V | --verbose: more verbose output\n"
" -c | --chip <chipname>: probe only for specified flash chip\n"
" -s | --estart <addr>: exclude start position\n"
" -e | --eend <addr>: exclude end postion\n"
" -m | --mainboard <[vendor:]part>: override mainboard settings\n"
" -f | --force: force write without checking image\n"
" -l | --layout <file.layout>: read ROM layout from file\n"
@ -542,8 +535,6 @@ int main(int argc, char *argv[])
{"erase", 0, 0, 'E'},
{"verify", 0, 0, 'v'},
{"chip", 1, 0, 'c'},
{"estart", 1, 0, 's'},
{"eend", 1, 0, 'e'},
{"mainboard", 1, 0, 'm'},
{"verbose", 0, 0, 'V'},
{"force", 0, 0, 'f'},
@ -559,7 +550,6 @@ int main(int argc, char *argv[])
char *filename = NULL;
unsigned int exclude_start_position = 0, exclude_end_position = 0; // [x,y)
char *tempstr = NULL, *tempstr2 = NULL;
print_version();
@ -573,7 +563,7 @@ int main(int argc, char *argv[])
}
setbuf(stdout, NULL);
while ((opt = getopt_long(argc, argv, "rRwvVEfc:s:e:m:l:i:p:Lzh",
while ((opt = getopt_long(argc, argv, "rRwvVEfc:m:l:i:p:Lzh",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'r':
@ -614,14 +604,6 @@ int main(int argc, char *argv[])
}
erase_it = 1;
break;
case 's':
tempstr = strdup(optarg);
sscanf(tempstr, "%x", &exclude_start_position);
break;
case 'e':
tempstr = strdup(optarg);
sscanf(tempstr, "%x", &exclude_end_position);
break;
case 'm':
tempstr = strdup(optarg);
strtok(tempstr, ":");
@ -753,7 +735,7 @@ int main(int argc, char *argv[])
printf("Run flashrom -L to view the hardware supported in this flashrom version.\n");
exit(1);
}
return read_flash(flashes[0], filename, exclude_start_position, exclude_end_position);
return read_flash(flashes[0], filename);
}
// FIXME: flash writes stay enabled!
exit(1);
@ -817,7 +799,7 @@ int main(int argc, char *argv[])
if (erase_flash(flash))
return 1;
} else if (read_it) {
if (read_flash(flash, filename, exclude_start_position, exclude_end_position))
if (read_flash(flash, filename))
return 1;
} else {
struct stat image_stat;
@ -844,27 +826,6 @@ int main(int argc, char *argv[])
}
}
/* exclude range stuff. Nice idea, but at the moment it is only
* supported in hardware by the pm49fl004 chips.
* Instead of implementing this for all chips I suggest advancing
* it to the rom layout feature below and drop exclude range
* completely once all flash chips can do rom layouts. stepan
*/
/* FIXME: This code is totally broken. It treats exclude ranges as include ranges. */
// ////////////////////////////////////////////////////////////
if (exclude_end_position - exclude_start_position > 0)
chip_readn(buf + exclude_start_position,
flash->virtual_memory + exclude_start_position,
exclude_end_position - exclude_start_position);
exclude_start_page = exclude_start_position / flash->page_size;
if ((exclude_start_position % flash->page_size) != 0) {
exclude_start_page++;
}
exclude_end_page = exclude_end_position / flash->page_size;
// ////////////////////////////////////////////////////////////
// This should be moved into each flash part's code to do it
// cleanly. This does the job.
/* FIXME: Adapt to the external flasher infrastructure. */

View File

@ -22,8 +22,6 @@
#include "flash.h"
extern int exclude_start_page, exclude_end_page;
void write_lockbits_49fl00x(chipaddr bios, int size,
unsigned char bits, int block_size)
{
@ -64,9 +62,6 @@ int erase_49fl00x(struct flashchip *flash)
*/
printf("Erasing page: ");
for (i = 0; i < total_size / page_size; i++) {
if ((i >= exclude_start_page) && (i < exclude_end_page))
continue;
/* erase the page */
if (erase_block_jedec(flash, i * page_size, page_size)) {
fprintf(stderr, "ERASE FAILED!\n");
@ -98,9 +93,6 @@ int write_49fl00x(struct flashchip *flash, uint8_t *buf)
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
if ((i >= exclude_start_page) && (i < exclude_end_page))
continue;
/* erase the page before programming */
if (erase_block_jedec(flash, i * page_size, page_size)) {
fprintf(stderr, "ERASE FAILED!\n");