[coreboot] [PATCH] flashrom: External flasher support

Uwe Hermann uwe at hermann-uwe.de
Fri May 8 13:41:32 CEST 2009

On Fri, May 08, 2009 at 02:57:27AM +0200, Carl-Daniel Hailfinger wrote:
> To prepare flashrom for Paraflasher (or other external flasher) support,
> each chip read/write access is either handled as memory mapped access or
> external flasher cycle.

This part is ok. These functions certainly don't belong in flash.h.

> External flashers can set the flasher variable to their own ID/number
> during startup and handle accesses in the switch statement inside
> chip_{read,write}[bwl].

I'd like to solve this part differently, however. A switch statement
becomes very big and ugly very soon if we suport more than one flasher.
In addition all flasher code for all of them must be in one single file.

The attached draft (non-compiling patch) uses a struct and functions to
solve the issue, then each programmer can have it's own file where it
provides the required API functions (read, write, init, shutdown, etc).
E.g. we then have paraflasher.c, usbprog.c, etc.

> Index: flashrom-external_infrastructure/flash.h
> ===================================================================
> --- flashrom-external_infrastructure/flash.h	(Revision 471)
> +++ flashrom-external_infrastructure/flash.h	(Arbeitskopie)
> +/* external.c */

I'd name this rather "internal.c" (for internal flasher) or "board.c"
(for flashing in the mainboard, vs. using an external flasher).

> Index: flashrom-external_infrastructure/external.c
> ===================================================================
> --- flashrom-external_infrastructure/external.c	(Revision 0)
> +++ flashrom-external_infrastructure/external.c	(Revision 0)
> @@ -0,0 +1,111 @@
> +void chip_writew(uint16_t b, volatile void *addr)
> +void chip_writel(uint32_t b, volatile void *addr)

Will we ever need u16 and u32 accessor functions btw? I think they're
unused right now, not sure if future plans require them(?)

http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org

More information about the coreboot mailing list