summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2006-11-07 13:48:46 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2006-11-07 13:48:46 +0000
commite60fd351825ecc4800d3626593b976e895886feb (patch)
tree48ddb64a3cb3937db78f44c7c6732c951f197890
parent987942dcbdd3f139f2fb0ddcd9593a39bba7ff5b (diff)
downloadflashrom-e60fd351825ecc4800d3626593b976e895886feb.tar.gz
flashrom-e60fd351825ecc4800d3626593b976e895886feb.tar.bz2
flashrom-e60fd351825ecc4800d3626593b976e895886feb.zip
Instead of checking the first byte only, the whole part is checked now
This Corresponding to flashrom svn r71 and coreboot v2 svn r2494. will detect any improper erase, closes #31 Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
-rw-r--r--sst_fwhub.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sst_fwhub.c b/sst_fwhub.c
index e835a1ab0..8b62e7fae 100644
--- a/sst_fwhub.c
+++ b/sst_fwhub.c
@@ -95,14 +95,17 @@ int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
flash->page_size;
volatile uint8_t *bios = flash->virt_addr;
- // Do we want block wide erase?
+ // FIXME: We want block wide erase instead of ironing the whole chip
erase_sst_fwhub(flash);
- // FIXME: This test is not sufficient!
- if (*bios != 0xff) {
- printf("ERASE FAILED\n");
- return -1;
+ // dumb check if erase was successful.
+ for (i=0; i < total_size; i++) {
+ if (bios[i] != 0xff) {
+ printf("ERASE FAILED\n");
+ return -1;
+ }
}
+
printf("Programming Page: ");
for (i = 0; i < total_size / page_size; i++) {
printf("%04d at address: 0x%08x", i, i * page_size);