[flashrom] [PATCH] Fix romentry layout for programmers

Stefan Reinauer stepan at coresystems.de
Wed Aug 19 17:17:36 CEST 2009


On 8/19/09 5:11 PM, Carl-Daniel Hailfinger wrote:
> Flashrom has the ability to use layout files with romentries, but this
> feature was not adapted to the programmer infrastructure and had
> undefined behaviour for flasher!=internal.
> The romentry handling had an off-by-one error which caused all copies to
> end up one byte short.
> Fix these issues.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
>   
nice one!

Acked-by: Stefan Reinauer <stepan at coresystems.de>

> Index: flashrom-romentries_programmer/flash.h
> ===================================================================
> --- flashrom-romentries_programmer/flash.h	(Revision 692)
> +++ flashrom-romentries_programmer/flash.h	(Arbeitskopie)
> @@ -422,7 +422,7 @@
>  int show_id(uint8_t *bios, int size, int force);
>  int read_romlayout(char *name);
>  int find_romentry(char *name);
> -int handle_romentries(uint8_t *buffer, uint8_t *content);
> +int handle_romentries(uint8_t *buffer, struct flashchip *flash);
>  
>  /* cbtable.c */
>  int coreboot_init(void);
> Index: flashrom-romentries_programmer/flashrom.c
> ===================================================================
> --- flashrom-romentries_programmer/flashrom.c	(Revision 692)
> +++ flashrom-romentries_programmer/flashrom.c	(Arbeitskopie)
> @@ -930,8 +930,7 @@
>  
>  	// This should be moved into each flash part's code to do it 
>  	// cleanly. This does the job.
> -	/* FIXME: Adapt to the external flasher infrastructure. */
> -	handle_romentries(buf, (uint8_t *) flash->virtual_memory);
> +	handle_romentries(buf, flash);
>  
>  	// ////////////////////////////////////////////////////////////
>  
> Index: flashrom-romentries_programmer/layout.c
> ===================================================================
> --- flashrom-romentries_programmer/layout.c	(Revision 692)
> +++ flashrom-romentries_programmer/layout.c	(Arbeitskopie)
> @@ -196,11 +196,11 @@
>  	return -1;
>  }
>  
> -int handle_romentries(uint8_t *buffer, uint8_t *content)
> +int handle_romentries(uint8_t *buffer, struct flashchip *flash)
>  {
>  	int i;
>  
> -	// This function does not safe flash write cycles.
> +	// This function does not save flash write cycles.
>  	// 
>  	// Also it does not cope with overlapping rom layout
>  	// sections. 
> @@ -220,10 +220,9 @@
>  		if (rom_entries[i].included)
>  			continue;
>  
> -	/* FIXME: Adapt to the external flasher infrastructure. */
> -		memcpy(buffer + rom_entries[i].start,
> -		       content + rom_entries[i].start,
> -		       rom_entries[i].end - rom_entries[i].start);
> +		flash->read(flash, buffer + rom_entries[i].start,
> +			    rom_entries[i].start,
> +			    rom_entries[i].end - rom_entries[i].start + 1);
>  	}
>  
>  	return 0;
>
>
>   


-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866





More information about the flashrom mailing list