aboutsummaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-12-03 21:24:40 +0000
committerPeter Stuge <peter@stuge.se>2008-12-03 21:24:40 +0000
commit9a6d1764a2a506f26b5e09bc155a6f1649ce7bdc (patch)
tree2beae788f35f5893b5cee831bf43b1f248b99374 /flashrom.c
parent13f98cefb784f55ac38e7c90be2975c4ee4bdf92 (diff)
downloadflashrom-9a6d1764a2a506f26b5e09bc155a6f1649ce7bdc.tar.gz
flashrom-9a6d1764a2a506f26b5e09bc155a6f1649ce7bdc.tar.bz2
flashrom-9a6d1764a2a506f26b5e09bc155a6f1649ce7bdc.zip
Replace #ifdefs for sc520 systems by run time probing
Fixes #109 Corresponding to flashrom svn r355 and coreboot v2 svn r3790. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/flashrom.c b/flashrom.c
index 5e84134d..b0310601 100644
--- a/flashrom.c
+++ b/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 flash_baseaddr = 0, size;
+ unsigned long size;
for (flash = first_flash; flash && flash->name; flash++) {
if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0)
@@ -133,16 +133,11 @@ struct flashchip *probe_flash(struct flashchip *first_flash, int force)
*/
size = getpagesize();
}
-#ifdef TS5300
- // FIXME: Wrong place for this decision
- // FIXME: This should be autodetected. It is trivial.
- flash_baseaddr = 0x9400000;
-#else
- flash_baseaddr = (0xffffffff - size + 1);
-#endif
+ if (!flashbase)
+ flashbase = (0xffffffff - size + 1);
bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
- fd_mem, (off_t) flash_baseaddr);
+ fd_mem, (off_t) flashbase);
if (bios == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
exit(1);
@@ -167,7 +162,7 @@ notfound:
return NULL;
printf("Found chip \"%s %s\" (%d KB) at physical address 0x%lx.\n",
- flash->vendor, flash->name, flash->total_size, flash_baseaddr);
+ flash->vendor, flash->name, flash->total_size, flashbase);
return flash;
}