[coreboot] flashrom: Can't mmap memory

Peter Stuge peter at stuge.se
Mon Feb 9 01:05:12 CET 2009

ron minnich wrote:
> I am not sure why we have that test for flashbase anyway. What's it
> matter? Why do we use the old value for the next value?

The reason it is used like that is that SC520 code runs before all
probes and can set flashbase, which should then be used by the

ron minnich wrote:
> relative to the start of the chip yes. But the chip itself could be
> physically addressed at, e.g., 0x8000000, and all the programming
> would be fine.

If the chip is at top of 4GB and the base does is not the start of
the chip some if not all commands to the chip will fail.

> The only issue I've had with physical chip address was on the
> sc520, where the put a bunch of registers in the middle of the
> flash address space.

Many flash chips also have registers, and even if they don't at the
very least block erase operations absolutely need the mmap to start
where the flash chip starts.

Attaching my suggested patch. Myles, could you give it a go please?

-------------- next part --------------
flashrom: Fix broken flash chip base address logic

Elan SC520 requries us to deal with flash chip base addresses at locations
other than top of 4GB. The logic for that was incorrectly triggered also when
a board had more than one flash chip. This patch will honor flashbase only when
probing for the first flash chip on the board, and look at top of 4GB for later

Signed-off-by: Peter Stuge <peter at stuge.se>

Index: flashrom.c
--- flashrom.c	(revision 3930)
+++ flashrom.c	(working copy)
@@ -121,7 +121,7 @@
 			size = getpagesize();
-		base = flashbase ? flashbase : (0xffffffff - size + 1);
+		base = flashbase && flashchips == first_flash ? flashbase : (0xffffffff - size + 1);
 		flash->virtual_memory = bios = physmap("flash chip", base, size);
 		if (force)

More information about the coreboot mailing list