From 63fd9026f1e82b67a65072fda862ba7af35839e1 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 14 Dec 2011 22:25:15 +0000 Subject: 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 Acked-by: Michael Karcher --- 82802ab.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '82802ab.c') diff --git a/82802ab.c b/82802ab.c index 8f671c9..228d071 100644 --- a/82802ab.c +++ b/82802ab.c @@ -40,7 +40,7 @@ void print_status_82802ab(uint8_t status) msg_cdbg("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:"); } -int probe_82802ab(struct flashchip *flash) +int probe_82802ab(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t id1, id2, flashcontent1, flashcontent2; @@ -89,7 +89,7 @@ int probe_82802ab(struct flashchip *flash) return 1; } -uint8_t wait_82802ab(struct flashchip *flash) +uint8_t wait_82802ab(struct flashctx *flash) { uint8_t status; chipaddr bios = flash->virtual_memory; @@ -107,7 +107,7 @@ uint8_t wait_82802ab(struct flashchip *flash) return status; } -int unlock_82802ab(struct flashchip *flash) +int unlock_82802ab(struct flashctx *flash) { int i; //chipaddr wrprotect = flash->virtual_registers + page + 2; @@ -118,7 +118,7 @@ int unlock_82802ab(struct flashchip *flash) return 0; } -int erase_block_82802ab(struct flashchip *flash, unsigned int page, +int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize) { chipaddr bios = flash->virtual_memory; @@ -141,7 +141,7 @@ int erase_block_82802ab(struct flashchip *flash, unsigned int page, } /* chunksize is 1 */ -int write_82802ab(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_82802ab(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len) { int i; chipaddr dst = flash->virtual_memory + start; @@ -157,7 +157,7 @@ int write_82802ab(struct flashchip *flash, uint8_t *src, unsigned int start, uns return 0; } -int unlock_28f004s5(struct flashchip *flash) +int unlock_28f004s5(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t mcfg, bcfg, need_unlock = 0, can_unlock = 0; @@ -209,7 +209,7 @@ int unlock_28f004s5(struct flashchip *flash) return 0; } -int unlock_lh28f008bjt(struct flashchip *flash) +int unlock_lh28f008bjt(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t mcfg, bcfg; -- cgit v1.1