summaryrefslogtreecommitdiff
path: root/util/flashrom
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2008-12-03 21:39:56 +0000
committerPeter Stuge <peter@stuge.se>2008-12-03 21:39:56 +0000
commit9602d1e8286ec17d42452b0a5ca5dc2d20c24d6e (patch)
treef224cb27c7d9c933bf7baecd9bbb01c8bee488fc /util/flashrom
parentd53f3e75468239435ec7595bb93abca3083e7299 (diff)
downloadcoreboot-9602d1e8286ec17d42452b0a5ca5dc2d20c24d6e.tar.xz
flashrom: Fix bug in r3790
If flashbase was set before probe_flash() it would only ever be used once, for the very first flash chip probe. Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3791 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom')
-rw-r--r--util/flashrom/flashrom.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c
index b03106015d..b1586fa30f 100644
--- a/util/flashrom/flashrom.c
+++ b/util/flashrom/flashrom.c
@@ -105,7 +105,7 @@ struct flashchip *probe_flash(struct flashchip *first_flash, int force)
{
volatile uint8_t *bios;
struct flashchip *flash;
- unsigned long size;
+ unsigned long base, size;
for (flash = first_flash; flash && flash->name; flash++) {
if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0)
@@ -133,11 +133,10 @@ struct flashchip *probe_flash(struct flashchip *first_flash, int force)
*/
size = getpagesize();
}
- if (!flashbase)
- flashbase = (0xffffffff - size + 1);
+ base = flashbase ? flashbase : (0xffffffff - size + 1);
bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
- fd_mem, (off_t) flashbase);
+ fd_mem, (off_t) base);
if (bios == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
exit(1);
@@ -162,7 +161,8 @@ notfound:
return NULL;
printf("Found chip \"%s %s\" (%d KB) at physical address 0x%lx.\n",
- flash->vendor, flash->name, flash->total_size, flashbase);
+ flash->vendor, flash->name, flash->total_size, base);
+ flashbase = base;
return flash;
}