Use struct flashctx instead of struct flashchip for flash chip access
Struct flashchip is used only for the flashchips array and for
operations which do not access hardware, e.g. printing a list of
supported flash chips.
struct flashctx (flash context) contains all data available in
struct flashchip, but it also contains runtime information like
mapping addresses. struct flashctx is expected to grow additional
members over time, a prime candidate being programmer info.
struct flashctx contains all of struct flashchip with identical
member layout, but struct flashctx has additional members at the end.
The separation between struct flashchip/flashctx shrinks the memory
requirement of the big flashchips array and allows future extension
of flashctx without having to worry about bloat.
Corresponding to flashrom svn r1473.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
diff --git a/m29f400bt.c b/m29f400bt.c
index 61bfa2e..f664b47 100644
--- a/m29f400bt.c
+++ b/m29f400bt.c
@@ -28,7 +28,7 @@
functions. */
/* chunksize is 1 */
-int write_m29f400bt(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len)
+int write_m29f400bt(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len)
{
int i;
chipaddr bios = flash->virtual_memory;
@@ -55,7 +55,7 @@
return 0;
}
-int probe_m29f400bt(struct flashchip *flash)
+int probe_m29f400bt(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
@@ -86,7 +86,7 @@
return 0;
}
-int erase_m29f400bt(struct flashchip *flash)
+int erase_m29f400bt(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
@@ -105,7 +105,7 @@
return 0;
}
-int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len)
+int block_erase_m29f400bt(struct flashctx *flash, unsigned int start, unsigned int len)
{
chipaddr bios = flash->virtual_memory;
chipaddr dst = bios + start;
@@ -125,7 +125,7 @@
return 0;
}
-int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int address, unsigned int blocklen)
+int block_erase_chip_m29f400bt(struct flashctx *flash, unsigned int address, unsigned int blocklen)
{
if ((address != 0) || (blocklen != flash->total_size * 1024)) {
msg_cerr("%s called with incorrect arguments\n",