1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

Use helper functions chip_{read,write}[bwl] to access flash chips

The semantic patch I used in r418 to make the original conversion to
accessor functions was missing one isomorphism:
a[b] <=> *(a+b)

The semantic patcher Coccinelle was used to create this patch. Semantic
patch follows:
@@
typedef uint8_t;
expression a;
volatile uint8_t *b;
@@
- b[a]
+ *(b + a)
@@
expression a;
volatile uint8_t *b;
@@
- *(b) = (a);
+ chip_writeb(a, b);
@@
volatile uint8_t *b;
@@
- *(b)
+ chip_readb(b)
@@
type T;
T b;
@@
(
 chip_readb
|
 chip_writeb
)
 (...,
- (T)
- (b)
+ b
 )

Corresponding to flashrom svn r498.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
This commit is contained in:
Carl-Daniel Hailfinger
2009-05-12 15:38:55 +00:00
parent 24f9fbe075
commit 01624f40ee
4 changed files with 7 additions and 7 deletions

View File

@ -67,8 +67,8 @@ int erase_w39v040c(struct flashchip *flash)
erase_sector_jedec(flash->virtual_memory, i);
for (i = 0; i < total_size; i++)
if (0xff != bios[i]) {
printf("ERASE FAILED at 0x%08x! Expected=0xff, Read=0x%02x\n", i, bios[i]);
if (0xff != chip_readb(bios + i)) {
printf("ERASE FAILED at 0x%08x! Expected=0xff, Read=0x%02x\n", i, chip_readb(bios + i));
return -1;
}