summaryrefslogtreecommitdiff
path: root/sst49lfxxxc.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-05-16 21:22:56 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-05-16 21:22:56 +0000
commit676fec9b1d0df41ec69e87bc8e9f0c1605f5a577 (patch)
treea505b6f813fc4f7601f77e7195e479dfddc73571 /sst49lfxxxc.c
parent2a97d2afd35986c5c5208c4b6f58eab11cbaf3ec (diff)
downloadflashrom-676fec9b1d0df41ec69e87bc8e9f0c1605f5a577.tar.gz
Use chipaddr instead of volatile uint8_t * because when we access
chips in external flashers, they are not accessed via pointers at all. Benefits: This allows us to differentiate between volatile machine memory accesses and flash chip accesses. It also enforces usage of chip_{read,write}[bwl] to access flash chips, so nobody will unintentionally use pointers to access chips anymore. Some unneeded casts are removed as well. Grepping for chip operations and machine memory operations doesn't yield any false positives anymore. Compile tested on 32 bit and 64 bit Linux. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@519 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'sst49lfxxxc.c')
-rw-r--r--sst49lfxxxc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index 54897cc..d744cca 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -41,7 +41,7 @@
#define STATUS_ESS (1 << 6)
#define STATUS_WSMS (1 << 7)
-static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size,
+static __inline__ int write_lockbits_49lfxxxc(chipaddr bios, int size,
unsigned char bits)
{
int i, left = size;
@@ -68,7 +68,7 @@ static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size,
return 0;
}
-static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
+static __inline__ int erase_sector_49lfxxxc(chipaddr bios,
unsigned long address)
{
unsigned char status;
@@ -79,7 +79,7 @@ static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
do {
status = chip_readb(bios);
if (status & (STATUS_ESS | STATUS_BPS)) {
- printf("sector erase FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)bios + address, status);
+ printf("sector erase FAILED at address=0x%08lx status=0x%01x\n", bios + address, status);
chip_writeb(CLEAR_STATUS, bios);
return (-1);
}
@@ -88,9 +88,9 @@ static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
return 0;
}
-static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
+static __inline__ int write_sector_49lfxxxc(chipaddr bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr dst,
unsigned int page_size)
{
int i;
@@ -111,7 +111,7 @@ static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
do {
status = chip_readb(bios);
if (status & (STATUS_ESS | STATUS_BPS)) {
- printf("sector write FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)dst, status);
+ printf("sector write FAILED at address=0x%08lx status=0x%01x\n", dst, status);
chip_writeb(CLEAR_STATUS, bios);
return (-1);
}
@@ -123,7 +123,7 @@ static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
int probe_49lfxxxc(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
@@ -147,8 +147,8 @@ int probe_49lfxxxc(struct flashchip *flash)
int erase_49lfxxxc(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *registers = flash->virtual_registers;
+ chipaddr bios = flash->virtual_memory;
+ chipaddr registers = flash->virtual_registers;
int i;
unsigned int total_size = flash->total_size * 1024;
@@ -167,7 +167,7 @@ int write_49lfxxxc(struct flashchip *flash, uint8_t *buf)
int i;
int total_size = flash->total_size * 1024;
int page_size = flash->page_size;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
write_lockbits_49lfxxxc(flash->virtual_registers, total_size, 0);
printf("Programming page: ");