Print dummy programmer messages only if verbose mode is selected. Print the return value of dummy_chip_read[bwl]. Align entries in programmer_table.
This is a cosmetic patch and has no effect on code flow.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-external_cosmetics/dummyflasher.c =================================================================== --- flashrom-external_cosmetics/dummyflasher.c (Revision 493) +++ flashrom-external_cosmetics/dummyflasher.c (Arbeitskopie) @@ -30,59 +30,59 @@
int dummy_init(void) { - printf("%s\n", __func__); + printf_debug("%s\n", __func__); return 0; }
int dummy_shutdown(void) { - printf("%s\n", __func__); + printf_debug("%s\n", __func__); return 0; }
void *dummy_map(const char *descr, unsigned long phys_addr, size_t len) { - printf("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", + printf_debug("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", __func__, descr, (unsigned long)len, phys_addr); return (void *)phys_addr; }
void dummy_unmap(void *virt_addr, size_t len) { - printf("%s: Unmapping 0x%lx bytes at %p\n", + printf_debug("%s: Unmapping 0x%lx bytes at %p\n", __func__, (unsigned long)len, virt_addr); }
void dummy_chip_writeb(uint8_t val, volatile void *addr) { - printf("%s: addr=%p, val=0x%02x\n", __func__, addr, val); + printf_debug("%s: addr=%p, val=0x%02x\n", __func__, addr, val); }
void dummy_chip_writew(uint16_t val, volatile void *addr) { - printf("%s: addr=%p, val=0x%04x\n", __func__, addr, val); + printf_debug("%s: addr=%p, val=0x%04x\n", __func__, addr, val); }
void dummy_chip_writel(uint32_t val, volatile void *addr) { - printf("%s: addr=%p, val=0x%08x\n", __func__, addr, val); + printf_debug("%s: addr=%p, val=0x%08x\n", __func__, addr, val); }
uint8_t dummy_chip_readb(const volatile void *addr) { - printf("%s: addr=%p\n", __func__, addr); + printf_debug("%s: addr=%p, returning 0xff\n", __func__, addr); return 0xff; }
uint16_t dummy_chip_readw(const volatile void *addr) { - printf("%s: addr=%p\n", __func__, addr); + printf_debug("%s: addr=%p, returning 0xffff\n", __func__, addr); return 0xffff; }
uint32_t dummy_chip_readl(const volatile void *addr) { - printf("%s: addr=%p\n", __func__, addr); + printf_debug("%s: addr=%p, returning 0xffffffff\n", __func__, addr); return 0xffffffff; }
Index: flashrom-external_cosmetics/flashrom.c =================================================================== --- flashrom-external_cosmetics/flashrom.c (Revision 493) +++ flashrom-external_cosmetics/flashrom.c (Arbeitskopie) @@ -38,29 +38,29 @@
const struct programmer_entry programmer_table[] = { { - .init = internal_init, - .shutdown = internal_shutdown, + .init = internal_init, + .shutdown = internal_shutdown, .map_flash_region = physmap, .unmap_flash_region = physunmap, - .chip_readb = internal_chip_readb, - .chip_readw = internal_chip_readw, - .chip_readl = internal_chip_readl, - .chip_writeb = internal_chip_writeb, - .chip_writew = internal_chip_writew, - .chip_writel = internal_chip_writel, + .chip_readb = internal_chip_readb, + .chip_readw = internal_chip_readw, + .chip_readl = internal_chip_readl, + .chip_writeb = internal_chip_writeb, + .chip_writew = internal_chip_writew, + .chip_writel = internal_chip_writel, },
{ - .init = dummy_init, - .shutdown = dummy_shutdown, + .init = dummy_init, + .shutdown = dummy_shutdown, .map_flash_region = dummy_map, .unmap_flash_region = dummy_unmap, - .chip_readb = dummy_chip_readb, - .chip_readw = dummy_chip_readw, - .chip_readl = dummy_chip_readl, - .chip_writeb = dummy_chip_writeb, - .chip_writew = dummy_chip_writew, - .chip_writel = dummy_chip_writel, + .chip_readb = dummy_chip_readb, + .chip_readw = dummy_chip_readw, + .chip_readl = dummy_chip_readl, + .chip_writeb = dummy_chip_writeb, + .chip_writew = dummy_chip_writew, + .chip_writel = dummy_chip_writel, },
{},
Acked-by: Ronald G. Minnich rminnich@gmail.com
As long as you have tested the dummy flasher on a dummy chip, and booted the dummy laptop with a dummy os, and written the book "Flash programming for dummies"
ron
On 11.05.2009 16:56, ron minnich wrote:
Acked-by: Ronald G. Minnich rminnich@gmail.com
Thanks, committed in r495.
As long as you have tested the dummy flasher on a dummy chip, and
Done. I tested the dummy flasher with a dummy "always return 0xff" chip and the results are as expected.
booted the dummy laptop with a dummy os,
Unfortunately, flashrom does not support compilation on a dummy OS yet. I'll happily take patches, though.
and written the book "Flash programming for dummies"
That's actually a great idea. I decided to write that book and include it below.
Flash Programming for Dummies
A book by Carl-Daniel Hailfinger
Dedicated to Ron Minnich, who taught me so much.
Table of Contents
Preface .............. 1 Flashing your BIOS ... 2
Preface Flash programming on modern operating systems is still a challenge which requires quite a bit of effort, experience and luck. Besides interaction with chipsets, embedded controllers and flash translation chips, data sheet foot notes and command line confusion loom right around the corner. This book is indended for beginners and those who already know a few things about low-level utilities.
Flashing your BIOS Don't do it!
Regards, Carl-Daniel