[coreboot] [PATCH] flashrom: Add dummy external flasher

Uwe Hermann uwe at hermann-uwe.de
Sat May 9 02:43:59 CEST 2009


On Sat, May 09, 2009 at 12:38:56AM +0200, Carl-Daniel Hailfinger wrote:
> Add a dummy external flasher which just prints each operation.
> 
> Usage:
> flashrom --programmer dummy
> 
> This is a great way to test flashrom without root access. If you get
> permission errors, you found a problem in the code. (There are quite a few.)

Yep, indeed. Not all external flashers will need root access so we
should definately fix this.

 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

...with the changes below.

 
> Index: flashrom-external_dummyflasher/flash.h
> ===================================================================
> --- flashrom-external_dummyflasher/flash.h	(Revision 477)
> +++ flashrom-external_dummyflasher/flash.h	(Arbeitskopie)
> @@ -78,6 +78,7 @@
>  
>  extern int programmer;
>  #define PROGRAMMER_INTERNAL 0x00
> +#define PROGRAMMER_DUMMY 0x01
                           ^
Please align the 0x00 and 0x01 with spaces or tabs.


> Index: flashrom-external_dummyflasher/dummyflasher.c
> ===================================================================
> --- flashrom-external_dummyflasher/dummyflasher.c	(Revision 0)
> +++ flashrom-external_dummyflasher/dummyflasher.c	(Revision 0)
> +void dummy_chip_writeb(uint8_t val, volatile void *addr)
> +{
> +	printf("%s: addr=%p, val=%02x\n", __func__, addr, val);
                                 ^

Make this 0x%02x please (i.e. prepend "0x" to the value).


> +}
> +
> +void dummy_chip_writew(uint16_t val, volatile void *addr)
> +{
> +	printf("%s: addr=%p, val=%04x\n", __func__, addr, val);

Ditto.


> +void dummy_chip_writel(uint32_t val, volatile void *addr)
> +{
> +	printf("%s: addr=%p, val=%08x\n", __func__, addr, val);

Ditto.


> +uint8_t dummy_chip_readb(const volatile void *addr)
> +{
> +	printf("%s: addr=%p\n", __func__, addr);

Please add a space after the ":". As 'read' is one character
shorter than 'write' that will align the output nicely.


Also: Please document the 'dummy' flasher in the manpage.


Uwe.
-- 
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