diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-06-05 18:32:07 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-06-05 18:32:07 +0000 |
commit | 0bd2a2bdc10720776fe50b96d24d30323ec24c09 (patch) | |
tree | 1348763e5fa6f4ea9d13a5b84d63999dcf132749 /internal.c | |
parent | ca8bfc6c22196e5d16c6d2625c65d6b50c04daaf (diff) | |
download | ast2050-flashrom-0bd2a2bdc10720776fe50b96d24d30323ec24c09.zip ast2050-flashrom-0bd2a2bdc10720776fe50b96d24d30323ec24c09.tar.gz |
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.
Corresponding to flashrom svn r579.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'internal.c')
-rw-r--r-- | internal.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -165,6 +165,12 @@ uint32_t internal_chip_readl(const chipaddr addr) return mmio_readl((void *) addr); } +void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len) +{ + memcpy(buf, (void *)addr, len); + return; +} + void mmio_writeb(uint8_t val, void *addr) { *(volatile uint8_t *) addr = val; @@ -249,3 +255,19 @@ uint32_t fallback_chip_readl(const chipaddr addr) val |= chip_readw(addr + 2) << 16; return val; } + +void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len) +{ + size_t i; + for (i = 0; i < len; i++) + chip_writeb(buf[i], addr + i); + return; +} + +void fallback_chip_readn(uint8_t *buf, chipaddr addr, size_t len) +{ + size_t i; + for (i = 0; i < len; i++) + buf[i] = chip_readb(addr + i); + return; +} |