summaryrefslogtreecommitdiffstats
path: root/w39.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-14 22:25:15 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-14 22:25:15 +0000
commit63fd9026f1e82b67a65072fda862ba7af35839e1 (patch)
tree7d9ffba077715cf9e75c9f4a36d0d7f11a3181f6 /w39.c
parent83c92e983aaf11fb6f5bafb6744275c50add193c (diff)
downloadast2050-flashrom-63fd9026f1e82b67a65072fda862ba7af35839e1.zip
ast2050-flashrom-63fd9026f1e82b67a65072fda862ba7af35839e1.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 'w39.c')
-rw-r--r--w39.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/w39.c b/w39.c
index a2c1014..6af50b8 100644
--- a/w39.c
+++ b/w39.c
@@ -21,7 +21,7 @@
#include "flash.h"
-static int printlock_w39_fwh_block(struct flashchip *flash, unsigned int offset)
+static int printlock_w39_fwh_block(struct flashctx *flash, unsigned int offset)
{
chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
@@ -59,7 +59,7 @@ static int printlock_w39_fwh_block(struct flashchip *flash, unsigned int offset)
return (locking & ((1 << 2) | (1 << 0))) ? -1 : 0;
}
-static int unlock_w39_fwh_block(struct flashchip *flash, unsigned int offset)
+static int unlock_w39_fwh_block(struct flashctx *flash, unsigned int offset)
{
chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
@@ -80,7 +80,7 @@ static int unlock_w39_fwh_block(struct flashchip *flash, unsigned int offset)
return 0;
}
-static uint8_t w39_idmode_readb(struct flashchip *flash, unsigned int offset)
+static uint8_t w39_idmode_readb(struct flashctx *flash, unsigned int offset)
{
chipaddr bios = flash->virtual_memory;
uint8_t val;
@@ -127,7 +127,7 @@ static int printlock_w39_bootblock_64k16k(uint8_t lock)
return 0;
}
-static int printlock_w39_common(struct flashchip *flash, unsigned int offset)
+static int printlock_w39_common(struct flashctx *flash, unsigned int offset)
{
uint8_t lock;
@@ -136,7 +136,7 @@ static int printlock_w39_common(struct flashchip *flash, unsigned int offset)
return printlock_w39_tblwp(lock);
}
-static int printlock_w39_fwh(struct flashchip *flash)
+static int printlock_w39_fwh(struct flashctx *flash)
{
unsigned int i, total_size = flash->total_size * 1024;
int ret = 0;
@@ -148,7 +148,7 @@ static int printlock_w39_fwh(struct flashchip *flash)
return ret;
}
-static int unlock_w39_fwh(struct flashchip *flash)
+static int unlock_w39_fwh(struct flashctx *flash)
{
unsigned int i, total_size = flash->total_size * 1024;
@@ -160,7 +160,7 @@ static int unlock_w39_fwh(struct flashchip *flash)
return 0;
}
-int printlock_w39l040(struct flashchip * flash)
+int printlock_w39l040(struct flashctx * flash)
{
uint8_t lock;
int ret;
@@ -176,7 +176,7 @@ int printlock_w39l040(struct flashchip * flash)
return ret;
}
-int printlock_w39v040a(struct flashchip *flash)
+int printlock_w39v040a(struct flashctx *flash)
{
uint8_t lock;
int ret = 0;
@@ -194,18 +194,18 @@ int printlock_w39v040a(struct flashchip *flash)
return ret;
}
-int printlock_w39v040b(struct flashchip *flash)
+int printlock_w39v040b(struct flashctx *flash)
{
return printlock_w39_common(flash, 0x7fff2);
}
-int printlock_w39v040c(struct flashchip *flash)
+int printlock_w39v040c(struct flashctx *flash)
{
/* Typo in the datasheet? The other chips use 0x7fff2. */
return printlock_w39_common(flash, 0xfff2);
}
-int printlock_w39v040fa(struct flashchip *flash)
+int printlock_w39v040fa(struct flashctx *flash)
{
int ret = 0;
@@ -215,7 +215,7 @@ int printlock_w39v040fa(struct flashchip *flash)
return ret;
}
-int printlock_w39v040fb(struct flashchip *flash)
+int printlock_w39v040fb(struct flashctx *flash)
{
int ret = 0;
@@ -225,7 +225,7 @@ int printlock_w39v040fb(struct flashchip *flash)
return ret;
}
-int printlock_w39v040fc(struct flashchip *flash)
+int printlock_w39v040fc(struct flashctx *flash)
{
int ret = 0;
@@ -236,12 +236,12 @@ int printlock_w39v040fc(struct flashchip *flash)
return ret;
}
-int printlock_w39v080a(struct flashchip *flash)
+int printlock_w39v080a(struct flashctx *flash)
{
return printlock_w39_common(flash, 0xffff2);
}
-int printlock_w39v080fa(struct flashchip *flash)
+int printlock_w39v080fa(struct flashctx *flash)
{
int ret = 0;
@@ -251,7 +251,7 @@ int printlock_w39v080fa(struct flashchip *flash)
return ret;
}
-int printlock_w39v080fa_dual(struct flashchip *flash)
+int printlock_w39v080fa_dual(struct flashctx *flash)
{
msg_cinfo("Block locking for W39V080FA in dual mode is "
"undocumented.\n");
@@ -259,7 +259,7 @@ int printlock_w39v080fa_dual(struct flashchip *flash)
return -1;
}
-int unlock_w39v040fb(struct flashchip *flash)
+int unlock_w39v040fb(struct flashctx *flash)
{
if (unlock_w39_fwh(flash))
return -1;
@@ -269,7 +269,7 @@ int unlock_w39v040fb(struct flashchip *flash)
return 0;
}
-int unlock_w39v080fa(struct flashchip *flash)
+int unlock_w39v080fa(struct flashctx *flash)
{
if (unlock_w39_fwh(flash))
return -1;
OpenPOWER on IntegriCloud