diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2011-12-14 22:25:15 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2011-12-14 22:25:15 +0000 |
commit | 4303a77daaed729c507182667d0704a114c4b157 (patch) | |
tree | 7d9ffba077715cf9e75c9f4a36d0d7f11a3181f6 /82802ab.c | |
parent | e9874d155239573b9b0e95d2f96153d28063fb34 (diff) | |
download | flashrom-4303a77daaed729c507182667d0704a114c4b157.zip flashrom-4303a77daaed729c507182667d0704a114c4b157.tar.gz |
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>
Diffstat (limited to '82802ab.c')
-rw-r--r-- | 82802ab.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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; |