[coreboot] flashrom: Fix error -EINVAL on mmap()
Stefan Reinauer
stepan at coresystems.de
Tue Aug 12 12:05:53 CEST 2008
Segher Boessenkool wrote:
> Don't calculate "flash_baseaddr" until the final value of "size"
> is known, otherwise we end up trying to map a page right after
> end of memory.
>
> Fixes #112.
>
> Signed-off-by: Segher Boessenkool <segher at kernel.crashing.org>
>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
> ---
> flashrom.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> Index: flashrom/flashrom.c
> ===================================================================
> --- flashrom.orig/flashrom.c
> +++ flashrom/flashrom.c
> @@ -116,14 +116,6 @@
>
> size = flash->total_size * 1024;
>
> -#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 getpagesize() > size ->
> * "Can't mmap memory using /dev/mem: Invalid argument"
> * This should never happen as we don't support any flash chips
> @@ -139,6 +131,14 @@
> 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
> +
> bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
> fd_mem, (off_t) flash_baseaddr);
> if (bios == MAP_FAILED) {
>
> --
> coreboot mailing list
> coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
>
>
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
More information about the coreboot
mailing list