From a75816168d7324124fc5c585623fca71dd8b3fba Mon Sep 17 00:00:00 2001 From: hailfinger Date: Fri, 5 Jun 2009 18:32:07 +0000 Subject: Sometimes we want to read/write more than 4 bytes of chip content at once. Add chip_{read,write}n to the external flasher infrastructure which read/write n bytes at once. Fix a few places where the code used memcpy/memcmp although that is strictly impossible with external flashers. Place a FIXME in the layout.c code because usage is not totally clear and needs to be fixed to support external flashers. As a nice side benefit, we get a noticeable speedup for builtin flash reading which is now a memcpy() of the full flash area instead of a series of single-byte reads. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Urja Rannikko Acked-by: Uwe Hermann git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@579 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- dummyflasher.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'dummyflasher.c') diff --git a/dummyflasher.c b/dummyflasher.c index 784cc55..64b083e 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -103,6 +103,18 @@ void dummy_chip_writel(uint32_t val, chipaddr addr) printf_debug("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val); } +void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len) +{ + size_t i; + printf_debug("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", + __func__, addr, (unsigned long)len); + for (i = 0; i < len; i++) { + if ((i % 16) == 0) + printf_debug("\n"); + printf_debug("%02x ", buf[i]) + } +} + uint8_t dummy_chip_readb(const chipaddr addr) { printf_debug("%s: addr=0x%lx, returning 0xff\n", __func__, addr); @@ -121,6 +133,14 @@ uint32_t dummy_chip_readl(const chipaddr addr) return 0xffffffff; } +void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len) +{ + printf_debug("%s: addr=0x%lx, len=0x%lx, returning array of 0xff\n", + __func__, addr, (unsigned long)len); + memset(buf, 0xff, len); + return; +} + int dummy_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr) { -- cgit v1.2.1