Author: hailfinger
Date: 2009-05-16 23:22:56 +0200 (Sat, 16 May 2009)
New Revision: 519
Modified:
trunk/82802ab.c
trunk/am29f040b.c
trunk/dummyflasher.c
trunk/en29f002a.c
trunk/flash.h
trunk/flashrom.c
trunk/internal.c
trunk/jedec.c
trunk/m29f002.c
trunk/m29f400bt.c
trunk/mx29f002.c
trunk/nic3com.c
trunk/pm49fl00x.c
trunk/sharplhf00l04.c
trunk/sst28sf040.c
trunk/sst49lf040.c
trunk/sst49lfxxxc.c
trunk/sst_fwhub.c
trunk/stm50flw0x0x.c
trunk/w29ee011.c
trunk/w39v040c.c
trunk/w39v080fa.c
trunk/w49f002u.c
Log:
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(a)gmx.net>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified: trunk/82802ab.c
===================================================================
--- trunk/82802ab.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/82802ab.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -45,7 +45,7 @@
int probe_82802ab(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
#if 0
@@ -79,7 +79,7 @@
return 1;
}
-uint8_t wait_82802ab(volatile uint8_t *bios)
+uint8_t wait_82802ab(chipaddr bios)
{
uint8_t status;
uint8_t id1, id2;
@@ -109,8 +109,8 @@
int erase_82802ab_block(struct flashchip *flash, int offset)
{
- volatile uint8_t *bios = flash->virtual_memory + offset;
- volatile uint8_t *wrprotect = flash->virtual_registers + offset + 2;
+ chipaddr bios = flash->virtual_memory + offset;
+ chipaddr wrprotect = flash->virtual_registers + offset + 2;
int j;
uint8_t status;
@@ -155,8 +155,8 @@
return 0;
}
-void write_page_82802ab(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size)
+void write_page_82802ab(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size)
{
int i;
@@ -173,7 +173,7 @@
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;
printf("Programming page: \n");
for (i = 0; i < total_size / page_size; i++) {
Modified: trunk/am29f040b.c
===================================================================
--- trunk/am29f040b.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/am29f040b.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -22,7 +22,7 @@
#include <stdint.h>
#include "flash.h"
-static __inline__ int erase_sector_29f040b(volatile uint8_t *bios,
+static __inline__ int erase_sector_29f040b(chipaddr bios,
unsigned long address)
{
chip_writeb(0xAA, bios + 0x555);
@@ -40,17 +40,16 @@
return 0;
}
-static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
+static __inline__ int write_sector_29f040b(chipaddr bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr dst,
unsigned int page_size)
{
int i;
for (i = 0; i < page_size; i++) {
if ((i & 0xfff) == 0xfff)
- printf("0x%08lx", (unsigned long)dst -
- (unsigned long)bios);
+ printf("0x%08lx", dst - bios);
chip_writeb(0xAA, bios + 0x555);
chip_writeb(0x55, bios + 0x2AA);
@@ -69,7 +68,7 @@
int probe_29f040b(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x555);
@@ -92,7 +91,7 @@
int erase_29f040b(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
chip_writeb(0xAA, bios + 0x555);
chip_writeb(0x55, bios + 0x2AA);
@@ -112,7 +111,7 @@
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;
printf("Programming page ");
for (i = 0; i < total_size / page_size; i++) {
Modified: trunk/dummyflasher.c
===================================================================
--- trunk/dummyflasher.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/dummyflasher.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -54,36 +54,36 @@
__func__, (unsigned long)len, virt_addr);
}
-void dummy_chip_writeb(uint8_t val, volatile void *addr)
+void dummy_chip_writeb(uint8_t val, chipaddr addr)
{
- printf_debug("%s: addr=%p, val=0x%02x\n", __func__, addr, val);
+ printf_debug("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val);
}
-void dummy_chip_writew(uint16_t val, volatile void *addr)
+void dummy_chip_writew(uint16_t val, chipaddr addr)
{
- printf_debug("%s: addr=%p, val=0x%04x\n", __func__, addr, val);
+ printf_debug("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val);
}
-void dummy_chip_writel(uint32_t val, volatile void *addr)
+void dummy_chip_writel(uint32_t val, chipaddr addr)
{
- printf_debug("%s: addr=%p, val=0x%08x\n", __func__, addr, val);
+ printf_debug("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val);
}
-uint8_t dummy_chip_readb(const volatile void *addr)
+uint8_t dummy_chip_readb(const chipaddr addr)
{
- printf_debug("%s: addr=%p, returning 0xff\n", __func__, addr);
+ printf_debug("%s: addr=0x%lx, returning 0xff\n", __func__, addr);
return 0xff;
}
-uint16_t dummy_chip_readw(const volatile void *addr)
+uint16_t dummy_chip_readw(const chipaddr addr)
{
- printf_debug("%s: addr=%p, returning 0xffff\n", __func__, addr);
+ printf_debug("%s: addr=0x%lx, returning 0xffff\n", __func__, addr);
return 0xffff;
}
-uint32_t dummy_chip_readl(const volatile void *addr)
+uint32_t dummy_chip_readl(const chipaddr addr)
{
- printf_debug("%s: addr=%p, returning 0xffffffff\n", __func__, addr);
+ printf_debug("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr);
return 0xffffffff;
}
Modified: trunk/en29f002a.c
===================================================================
--- trunk/en29f002a.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/en29f002a.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -32,7 +32,7 @@
int probe_en29f512(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x555);
@@ -65,7 +65,7 @@
/* This does not seem to function properly for EN29F002NT. */
int probe_en29f002a(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x555);
@@ -95,10 +95,10 @@
{
int i;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *dst = bios;
+ chipaddr bios = flash->virtual_memory;
+ chipaddr dst = bios;
- // *bios = 0xF0;
+ //chip_writeb(0xF0, bios);
myusec_delay(10);
erase_chip_jedec(flash);
Modified: trunk/flash.h
===================================================================
--- trunk/flash.h 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/flash.h 2009-05-16 21:22:56 UTC (rev 519)
@@ -77,6 +77,8 @@
#endif
#endif
+typedef unsigned long chipaddr;
+
extern int programmer;
#define PROGRAMMER_INTERNAL 0x00
#define PROGRAMMER_DUMMY 0x01
@@ -92,12 +94,12 @@
void * (*map_flash_region) (const char *descr, unsigned long phys_addr, size_t len);
void (*unmap_flash_region) (void *virt_addr, size_t len);
- void (*chip_writeb) (uint8_t val, volatile void *addr);
- void (*chip_writew) (uint16_t val, volatile void *addr);
- void (*chip_writel) (uint32_t val, volatile void *addr);
- uint8_t (*chip_readb) (const volatile void *addr);
- uint16_t (*chip_readw) (const volatile void *addr);
- uint32_t (*chip_readl) (const volatile void *addr);
+ void (*chip_writeb) (uint8_t val, chipaddr addr);
+ void (*chip_writew) (uint16_t val, chipaddr addr);
+ void (*chip_writel) (uint32_t val, chipaddr addr);
+ uint8_t (*chip_readb) (const chipaddr addr);
+ uint16_t (*chip_readw) (const chipaddr addr);
+ uint32_t (*chip_readl) (const chipaddr addr);
};
extern const struct programmer_entry programmer_table[];
@@ -122,32 +124,32 @@
programmer_table[programmer].unmap_flash_region(virt_addr, len);
}
-static inline void chip_writeb(uint8_t val, volatile void *addr)
+static inline void chip_writeb(uint8_t val, chipaddr addr)
{
programmer_table[programmer].chip_writeb(val, addr);
}
-static inline void chip_writew(uint16_t val, volatile void *addr)
+static inline void chip_writew(uint16_t val, chipaddr addr)
{
programmer_table[programmer].chip_writew(val, addr);
}
-static inline void chip_writel(uint32_t val, volatile void *addr)
+static inline void chip_writel(uint32_t val, chipaddr addr)
{
programmer_table[programmer].chip_writel(val, addr);
}
-static inline uint8_t chip_readb(const volatile void *addr)
+static inline uint8_t chip_readb(const chipaddr addr)
{
return programmer_table[programmer].chip_readb(addr);
}
-static inline uint16_t chip_readw(const volatile void *addr)
+static inline uint16_t chip_readw(const chipaddr addr)
{
return programmer_table[programmer].chip_readw(addr);
}
-static inline uint32_t chip_readl(const volatile void *addr)
+static inline uint32_t chip_readl(const chipaddr addr)
{
return programmer_table[programmer].chip_readl(addr);
}
@@ -180,8 +182,8 @@
int (*read) (struct flashchip *flash, uint8_t *buf);
/* Some flash devices have an additional register space. */
- volatile uint8_t *virtual_memory;
- volatile uint8_t *virtual_registers;
+ chipaddr virtual_memory;
+ chipaddr virtual_registers;
};
#define TEST_UNTESTED 0
@@ -605,16 +607,16 @@
void get_io_perms(void);
int internal_init(void);
int internal_shutdown(void);
-void internal_chip_writeb(uint8_t val, volatile void *addr);
-void internal_chip_writew(uint16_t val, volatile void *addr);
-void internal_chip_writel(uint32_t val, volatile void *addr);
-uint8_t internal_chip_readb(const volatile void *addr);
-uint16_t internal_chip_readw(const volatile void *addr);
-uint32_t internal_chip_readl(const volatile void *addr);
-void fallback_chip_writew(uint16_t val, volatile void *addr);
-void fallback_chip_writel(uint32_t val, volatile void *addr);
-uint16_t fallback_chip_readw(const volatile void *addr);
-uint32_t fallback_chip_readl(const volatile void *addr);
+void internal_chip_writeb(uint8_t val, chipaddr addr);
+void internal_chip_writew(uint16_t val, chipaddr addr);
+void internal_chip_writel(uint32_t val, chipaddr addr);
+uint8_t internal_chip_readb(const chipaddr addr);
+uint16_t internal_chip_readw(const chipaddr addr);
+uint32_t internal_chip_readl(const chipaddr addr);
+void fallback_chip_writew(uint16_t val, chipaddr addr);
+void fallback_chip_writel(uint32_t val, chipaddr addr);
+uint16_t fallback_chip_readw(const chipaddr addr);
+uint32_t fallback_chip_readl(const chipaddr addr);
#if defined(__FreeBSD__) || defined(__DragonFly__)
extern int io_fd;
#endif
@@ -624,12 +626,12 @@
int dummy_shutdown(void);
void *dummy_map(const char *descr, unsigned long phys_addr, size_t len);
void dummy_unmap(void *virt_addr, size_t len);
-void dummy_chip_writeb(uint8_t val, volatile void *addr);
-void dummy_chip_writew(uint16_t val, volatile void *addr);
-void dummy_chip_writel(uint32_t val, volatile void *addr);
-uint8_t dummy_chip_readb(const volatile void *addr);
-uint16_t dummy_chip_readw(const volatile void *addr);
-uint32_t dummy_chip_readl(const volatile void *addr);
+void dummy_chip_writeb(uint8_t val, chipaddr addr);
+void dummy_chip_writew(uint16_t val, chipaddr addr);
+void dummy_chip_writel(uint32_t val, chipaddr addr);
+uint8_t dummy_chip_readb(const chipaddr addr);
+uint16_t dummy_chip_readw(const chipaddr addr);
+uint32_t dummy_chip_readl(const chipaddr addr);
int dummy_spi_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
@@ -638,8 +640,8 @@
int nic3com_shutdown(void);
void *nic3com_map(const char *descr, unsigned long phys_addr, size_t len);
void nic3com_unmap(void *virt_addr, size_t len);
-void nic3com_chip_writeb(uint8_t val, volatile void *addr);
-uint8_t nic3com_chip_readb(const volatile void *addr);
+void nic3com_chip_writeb(uint8_t val, chipaddr addr);
+uint8_t nic3com_chip_readb(const chipaddr addr);
extern struct pcidev_status nics_3com[];
/* flashrom.c */
@@ -725,19 +727,19 @@
/* jedec.c */
uint8_t oddparity(uint8_t val);
-void toggle_ready_jedec(volatile uint8_t *dst);
-void data_polling_jedec(volatile uint8_t *dst, uint8_t data);
-void unprotect_jedec(volatile uint8_t *bios);
-void protect_jedec(volatile uint8_t *bios);
-int write_byte_program_jedec(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst);
+void toggle_ready_jedec(chipaddr dst);
+void data_polling_jedec(chipaddr dst, uint8_t data);
+void unprotect_jedec(chipaddr bios);
+void protect_jedec(chipaddr bios);
+int write_byte_program_jedec(chipaddr bios, uint8_t *src,
+ chipaddr dst);
int probe_jedec(struct flashchip *flash);
int erase_chip_jedec(struct flashchip *flash);
int write_jedec(struct flashchip *flash, uint8_t *buf);
-int erase_sector_jedec(volatile uint8_t *bios, unsigned int page);
-int erase_block_jedec(volatile uint8_t *bios, unsigned int page);
-int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, unsigned int page_size);
+int erase_sector_jedec(chipaddr bios, unsigned int page);
+int erase_block_jedec(chipaddr bios, unsigned int page);
+int write_sector_jedec(chipaddr bios, uint8_t *src,
+ chipaddr dst, unsigned int page_size);
/* m29f002.c */
int erase_m29f002(struct flashchip *flash);
@@ -747,15 +749,15 @@
/* m29f400bt.c */
int probe_m29f400bt(struct flashchip *flash);
int erase_m29f400bt(struct flashchip *flash);
-int block_erase_m29f400bt(volatile uint8_t *bios,
- volatile uint8_t *dst);
+int block_erase_m29f400bt(chipaddr bios,
+ chipaddr dst);
int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
-void toggle_ready_m29f400bt(volatile uint8_t *dst);
-void data_polling_m29f400bt(volatile uint8_t *dst, uint8_t data);
-void protect_m29f400bt(volatile uint8_t *bios);
-void write_page_m29f400bt(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size);
+void toggle_ready_m29f400bt(chipaddr dst);
+void data_polling_m29f400bt(chipaddr dst, uint8_t data);
+void protect_m29f400bt(chipaddr bios);
+void write_page_m29f400bt(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size);
/* mx29f002.c */
int probe_29f002(struct flashchip *flash);
@@ -771,9 +773,9 @@
int probe_lhf00l04(struct flashchip *flash);
int erase_lhf00l04(struct flashchip *flash);
int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
-void toggle_ready_lhf00l04(volatile uint8_t *dst);
-void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data);
-void protect_lhf00l04(volatile uint8_t *bios);
+void toggle_ready_lhf00l04(chipaddr dst);
+void data_polling_lhf00l04(chipaddr dst, uint8_t data);
+void protect_lhf00l04(chipaddr bios);
/* sst28sf040.c */
int probe_28sf040(struct flashchip *flash);
Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/flashrom.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -83,7 +83,7 @@
{
size_t size = flash->total_size * 1024;
/* Flash registers live 4 MByte below the flash. */
- flash->virtual_registers = programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size);
+ flash->virtual_registers = (chipaddr)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size);
}
int read_memmapped(struct flashchip *flash, uint8_t *buf)
@@ -116,7 +116,7 @@
size = flash->total_size * 1024;
base = flashbase ? flashbase : (0xffffffff - size + 1);
- flash->virtual_memory = programmer_map_flash_region("flash chip", base, size);
+ flash->virtual_memory = (chipaddr)programmer_map_flash_region("flash chip", base, size);
if (force)
break;
@@ -129,8 +129,7 @@
break;
notfound:
- /* The intermediate cast to unsigned long works around a gcc warning bug. */
- programmer_unmap_flash_region((void *)(unsigned long)flash->virtual_memory, size);
+ programmer_unmap_flash_region((void *)flash->virtual_memory, size);
}
if (!flash || !flash->name)
Modified: trunk/internal.c
===================================================================
--- trunk/internal.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/internal.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -138,45 +138,45 @@
return 0;
}
-void internal_chip_writeb(uint8_t val, volatile void *addr)
+void internal_chip_writeb(uint8_t val, chipaddr addr)
{
*(volatile uint8_t *) addr = val;
}
-void internal_chip_writew(uint16_t val, volatile void *addr)
+void internal_chip_writew(uint16_t val, chipaddr addr)
{
*(volatile uint16_t *) addr = val;
}
-void internal_chip_writel(uint32_t val, volatile void *addr)
+void internal_chip_writel(uint32_t val, chipaddr addr)
{
*(volatile uint32_t *) addr = val;
}
-uint8_t internal_chip_readb(const volatile void *addr)
+uint8_t internal_chip_readb(const chipaddr addr)
{
return *(volatile uint8_t *) addr;
}
-uint16_t internal_chip_readw(const volatile void *addr)
+uint16_t internal_chip_readw(const chipaddr addr)
{
return *(volatile uint16_t *) addr;
}
-uint32_t internal_chip_readl(const volatile void *addr)
+uint32_t internal_chip_readl(const chipaddr addr)
{
return *(volatile uint32_t *) addr;
}
/* Little-endian fallback for drivers not supporting 16 bit accesses */
-void fallback_chip_writew(uint16_t val, volatile void *addr)
+void fallback_chip_writew(uint16_t val, chipaddr addr)
{
chip_writeb(val & 0xff, addr);
chip_writeb((val >> 8) & 0xff, addr + 1);
}
/* Little-endian fallback for drivers not supporting 16 bit accesses */
-uint16_t fallback_chip_readw(const volatile void *addr)
+uint16_t fallback_chip_readw(const chipaddr addr)
{
uint16_t val;
val = chip_readb(addr);
@@ -185,14 +185,14 @@
}
/* Little-endian fallback for drivers not supporting 32 bit accesses */
-void fallback_chip_writel(uint32_t val, volatile void *addr)
+void fallback_chip_writel(uint32_t val, chipaddr addr)
{
chip_writew(val & 0xffff, addr);
chip_writew((val >> 16) & 0xffff, addr + 2);
}
/* Little-endian fallback for drivers not supporting 32 bit accesses */
-uint32_t fallback_chip_readl(const volatile void *addr)
+uint32_t fallback_chip_readl(const chipaddr addr)
{
uint32_t val;
val = chip_readw(addr);
Modified: trunk/jedec.c
===================================================================
--- trunk/jedec.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/jedec.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -35,7 +35,7 @@
return (val ^ (val >> 1)) & 0x1;
}
-void toggle_ready_jedec(volatile uint8_t *dst)
+void toggle_ready_jedec(chipaddr dst)
{
unsigned int i = 0;
uint8_t tmp1, tmp2;
@@ -51,7 +51,7 @@
}
}
-void data_polling_jedec(volatile uint8_t *dst, uint8_t data)
+void data_polling_jedec(chipaddr dst, uint8_t data)
{
unsigned int i = 0;
uint8_t tmp;
@@ -66,7 +66,7 @@
}
}
-void unprotect_jedec(volatile uint8_t *bios)
+void unprotect_jedec(chipaddr bios)
{
chip_writeb(0xAA, bios + 0x5555);
chip_writeb(0x55, bios + 0x2AAA);
@@ -78,7 +78,7 @@
usleep(200);
}
-void protect_jedec(volatile uint8_t *bios)
+void protect_jedec(chipaddr bios)
{
chip_writeb(0xAA, bios + 0x5555);
chip_writeb(0x55, bios + 0x2AAA);
@@ -89,7 +89,7 @@
int probe_jedec(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
uint32_t largeid1, largeid2;
uint32_t flashcontent1, flashcontent2;
@@ -161,7 +161,7 @@
return 0;
}
-int erase_sector_jedec(volatile uint8_t *bios, unsigned int page)
+int erase_sector_jedec(chipaddr bios, unsigned int page)
{
/* Issue the Sector Erase command */
chip_writeb(0xAA, bios + 0x5555);
@@ -184,7 +184,7 @@
return 0;
}
-int erase_block_jedec(volatile uint8_t *bios, unsigned int block)
+int erase_block_jedec(chipaddr bios, unsigned int block)
{
/* Issue the Sector Erase command */
chip_writeb(0xAA, bios + 0x5555);
@@ -209,7 +209,7 @@
int erase_chip_jedec(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
/* Issue the JEDEC Chip Erase command */
chip_writeb(0xAA, bios + 0x5555);
@@ -231,11 +231,11 @@
return 0;
}
-int write_page_write_jedec(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size)
+int write_page_write_jedec(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size)
{
int i, tried = 0, start_index = 0, ok;
- volatile uint8_t *d = dst;
+ chipaddr d = dst;
uint8_t *s = src;
retry:
@@ -272,14 +272,14 @@
goto retry;
}
if (!ok) {
- fprintf(stderr, " page %d failed!\n",
- (unsigned int)(d - bios) / page_size);
+ fprintf(stderr, " page 0x%lx failed!\n",
+ (d - bios) / page_size);
}
return !ok;
}
-int write_byte_program_jedec(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst)
+int write_byte_program_jedec(chipaddr bios, uint8_t *src,
+ chipaddr dst)
{
int tried = 0, ok = 1;
@@ -308,8 +308,8 @@
return !ok;
}
-int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, unsigned int page_size)
+int write_sector_jedec(chipaddr bios, uint8_t *src,
+ chipaddr dst, unsigned int page_size)
{
int i;
@@ -326,12 +326,12 @@
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;
erase_chip_jedec(flash);
// dumb check if erase was successful.
for (i = 0; i < total_size; i++) {
- if (chip_readb(bios + i) != (uint8_t) 0xff) {
+ if (chip_readb(bios + i) != 0xff) {
printf("ERASE FAILED @%d, val %02x!\n", i, chip_readb(bios + i));
return -1;
}
Modified: trunk/m29f002.c
===================================================================
--- trunk/m29f002.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/m29f002.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -22,7 +22,7 @@
int erase_m29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
chip_writeb(0xaa, bios + 0x555);
chip_writeb(0x55, bios + 0xaaa);
chip_writeb(0x80, bios + 0x555);
@@ -34,8 +34,8 @@
return 0;
}
-static void rewrite_block(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int size)
+static void rewrite_block(chipaddr bios, uint8_t *src,
+ chipaddr dst, int size)
{
/* erase */
chip_writeb(0xaa, bios + 0x555);
@@ -59,7 +59,7 @@
}
}
-static void do_block(volatile uint8_t *bios, uint8_t *src, int i,
+static void do_block(chipaddr bios, uint8_t *src, int i,
unsigned long start, int size)
{
printf("%d at address: 0x%08lx", i, start);
@@ -70,7 +70,7 @@
int write_m29f002t(struct flashchip *flash, uint8_t *buf)
{
int i, page_size = flash->page_size;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
/* M29F002(N)T has 7 blocks. From bottom to top their sizes are:
* 64k 64k 64k 32k 8k 8k 16k
@@ -92,7 +92,7 @@
int write_m29f002b(struct flashchip *flash, uint8_t *buf)
{
int i = 0, page_size = flash->page_size;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
/* M29F002B has 7 blocks. From bottom to top their sizes are:
* 16k 8k 8k 32k 64k 64k 64k
Modified: trunk/m29f400bt.c
===================================================================
--- trunk/m29f400bt.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/m29f400bt.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -20,7 +20,7 @@
#include "flash.h"
-void protect_m29f400bt(volatile uint8_t *bios)
+void protect_m29f400bt(chipaddr bios)
{
chip_writeb(0xAA, bios + 0xAAA);
chip_writeb(0x55, bios + 0x555);
@@ -29,8 +29,8 @@
usleep(200);
}
-void write_page_m29f400bt(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size)
+void write_page_m29f400bt(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size)
{
int i;
@@ -41,12 +41,12 @@
/* transfer data from source to destination */
chip_writeb(*src, dst);
- //*(volatile char *) (bios) = 0xF0;
+ //chip_writeb(0xF0, bios);
//usleep(5);
toggle_ready_jedec(dst);
printf
- ("Value in the flash at address %p = %#x, want %#x\n",
- (uint8_t *) (dst - bios), chip_readb(dst), *src);
+ ("Value in the flash at address 0x%lx = %#x, want %#x\n",
+ (dst - bios), chip_readb(dst), *src);
dst++;
src++;
}
@@ -54,7 +54,7 @@
int probe_m29f400bt(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0xAAA);
@@ -85,7 +85,7 @@
int erase_m29f400bt(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
chip_writeb(0xAA, bios + 0xAAA);
chip_writeb(0x55, bios + 0x555);
@@ -101,7 +101,7 @@
return 0;
}
-int block_erase_m29f400bt(volatile uint8_t *bios, volatile uint8_t *dst)
+int block_erase_m29f400bt(chipaddr bios, chipaddr dst)
{
chip_writeb(0xAA, bios + 0xAAA);
@@ -110,7 +110,7 @@
chip_writeb(0xAA, bios + 0xAAA);
chip_writeb(0x55, bios + 0x555);
- //*(volatile uint8_t *) (bios + 0xAAA) = 0x10;
+ //chip_writeb(0x10, bios + 0xAAA);
chip_writeb(0x30, dst);
myusec_delay(10);
@@ -124,7 +124,7 @@
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;
//erase_m29f400bt (flash);
printf("Programming page:\n ");
@@ -176,7 +176,7 @@
int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
printf("Programming page:\n ");
/*********************************
Modified: trunk/mx29f002.c
===================================================================
--- trunk/mx29f002.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/mx29f002.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -24,7 +24,7 @@
int probe_29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x5555);
@@ -47,7 +47,7 @@
int erase_29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
chip_writeb(0xF0, bios + 0x555);
chip_writeb(0xAA, bios + 0x555);
@@ -80,8 +80,8 @@
{
int i;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *dst = bios;
+ chipaddr bios = flash->virtual_memory;
+ chipaddr dst = bios;
chip_writeb(0xF0, bios);
myusec_delay(10);
Modified: trunk/nic3com.c
===================================================================
--- trunk/nic3com.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/nic3com.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -87,17 +87,17 @@
{
}
-void nic3com_chip_writeb(uint8_t val, volatile void *addr)
+void nic3com_chip_writeb(uint8_t val, chipaddr addr)
{
- OUTL((uint32_t)(intptr_t)addr, io_base_addr + BIOS_ROM_ADDR);
+ OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
OUTB(val, io_base_addr + BIOS_ROM_DATA);
}
-uint8_t nic3com_chip_readb(const volatile void *addr)
+uint8_t nic3com_chip_readb(const chipaddr addr)
{
uint8_t val;
- OUTL((uint32_t)(intptr_t)addr, io_base_addr + BIOS_ROM_ADDR);
+ OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
val = INB(io_base_addr + BIOS_ROM_DATA);
return val;
Modified: trunk/pm49fl00x.c
===================================================================
--- trunk/pm49fl00x.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/pm49fl00x.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -25,7 +25,7 @@
extern int exclude_start_page, exclude_end_page;
-void write_lockbits_49fl00x(volatile uint8_t *bios, int size,
+void write_lockbits_49fl00x(chipaddr bios, int size,
unsigned char bits, int block_size)
{
int i, left = size;
@@ -54,7 +54,7 @@
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;
/* unprotected */
write_lockbits_49fl00x(flash->virtual_registers,
@@ -89,7 +89,7 @@
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;
/* unprotected */
write_lockbits_49fl00x(flash->virtual_registers, total_size, 0,
Modified: trunk/sharplhf00l04.c
===================================================================
--- trunk/sharplhf00l04.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/sharplhf00l04.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -36,7 +36,7 @@
int probe_lhf00l04(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
#if 0
@@ -71,7 +71,7 @@
return 1;
}
-uint8_t wait_lhf00l04(volatile uint8_t *bios)
+uint8_t wait_lhf00l04(chipaddr bios)
{
uint8_t status;
uint8_t id1, id2;
@@ -101,17 +101,17 @@
int erase_lhf00l04_block(struct flashchip *flash, int offset)
{
- volatile uint8_t *bios = flash->virtual_memory + offset;
- volatile uint8_t *wrprotect = flash->virtual_registers + offset + 2;
+ chipaddr bios = flash->virtual_memory + offset;
+ chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t status;
// clear status register
chip_writeb(0x50, bios);
- printf("Erase at %p\n", bios);
+ printf("Erase at 0x%lx\n", bios);
status = wait_lhf00l04(flash->virtual_memory);
print_lhf00l04_status(status);
// clear write protect
- printf("write protect is at %p\n", (wrprotect));
+ printf("write protect is at 0x%lx\n", (wrprotect));
printf("write protect is 0x%x\n", chip_readb(wrprotect));
chip_writeb(0, wrprotect);
printf("write protect is 0x%x\n", chip_readb(wrprotect));
@@ -142,8 +142,8 @@
return 0;
}
-void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size)
+void write_page_lhf00l04(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size)
{
int i;
@@ -160,7 +160,7 @@
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;
erase_lhf00l04(flash);
if (chip_readb(bios) != 0xff) {
Modified: trunk/sst28sf040.c
===================================================================
--- trunk/sst28sf040.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/sst28sf040.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -30,7 +30,7 @@
#define RESET 0xFF
#define READ_ID 0x90
-static __inline__ void protect_28sf040(volatile uint8_t *bios)
+static __inline__ void protect_28sf040(chipaddr bios)
{
uint8_t tmp;
@@ -43,7 +43,7 @@
tmp = chip_readb(bios + 0x040A);
}
-static __inline__ void unprotect_28sf040(volatile uint8_t *bios)
+static __inline__ void unprotect_28sf040(chipaddr bios)
{
uint8_t tmp;
@@ -56,7 +56,7 @@
tmp = chip_readb(bios + 0x041A);
}
-static __inline__ int erase_sector_28sf040(volatile uint8_t *bios,
+static __inline__ int erase_sector_28sf040(chipaddr bios,
unsigned long address)
{
chip_writeb(AUTO_PG_ERASE1, bios);
@@ -68,9 +68,9 @@
return 0;
}
-static __inline__ int write_sector_28sf040(volatile uint8_t *bios,
+static __inline__ int write_sector_28sf040(chipaddr bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr dst,
unsigned int page_size)
{
int i;
@@ -95,7 +95,7 @@
int probe_28sf040(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(RESET, bios);
@@ -119,7 +119,7 @@
int erase_28sf040(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
unprotect_28sf040(bios);
chip_writeb(CHIP_ERASE, bios);
@@ -137,7 +137,7 @@
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;
unprotect_28sf040(bios);
Modified: trunk/sst49lf040.c
===================================================================
--- trunk/sst49lf040.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/sst49lf040.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -26,7 +26,7 @@
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;
for (i = 0; i < total_size / page_size; i++) {
/* Chip erase only works in parallel programming mode
@@ -42,7 +42,7 @@
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;
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
Modified: trunk/sst49lfxxxc.c
===================================================================
--- trunk/sst49lfxxxc.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/sst49lfxxxc.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 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 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: ");
Modified: trunk/sst_fwhub.c
===================================================================
--- trunk/sst_fwhub.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/sst_fwhub.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -37,7 +37,7 @@
int check_sst_fwhub_block_lock(struct flashchip *flash, int offset)
{
- volatile uint8_t *registers = flash->virtual_registers;
+ chipaddr registers = flash->virtual_registers;
uint8_t blockstatus;
blockstatus = chip_readb(registers + offset + 2);
@@ -63,7 +63,7 @@
int clear_sst_fwhub_block_lock(struct flashchip *flash, int offset)
{
- volatile uint8_t *registers = flash->virtual_registers;
+ chipaddr registers = flash->virtual_registers;
uint8_t blockstatus;
blockstatus = check_sst_fwhub_block_lock(flash, offset);
@@ -115,7 +115,7 @@
{
int i;
unsigned int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
for (i = 0; i < total_size; i += flash->page_size)
erase_sst_fwhub_block(flash, i);
@@ -136,7 +136,7 @@
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;
uint8_t blockstatus;
// FIXME: We want block wide erase instead of ironing the whole chip
Modified: trunk/stm50flw0x0x.c
===================================================================
--- trunk/stm50flw0x0x.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/stm50flw0x0x.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -31,7 +31,7 @@
#include <stdint.h>
#include "flash.h"
-void protect_stm50flw0x0x(volatile uint8_t *bios)
+void protect_stm50flw0x0x(chipaddr bios)
{
chip_writeb(0xAA, bios + 0x5555);
chip_writeb(0x55, bios + 0x2AAA);
@@ -42,7 +42,7 @@
int probe_stm50flw0x0x(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
uint32_t largeid1, largeid2;
@@ -91,7 +91,7 @@
return 1;
}
-static void wait_stm50flw0x0x(volatile uint8_t *bios)
+static void wait_stm50flw0x0x(chipaddr bios)
{
uint8_t id1;
// id2;
@@ -120,7 +120,7 @@
*/
int unlock_block_stm50flw0x0x(struct flashchip *flash, int offset)
{
- volatile uint8_t *wrprotect = flash->virtual_registers + 2;
+ chipaddr wrprotect = flash->virtual_registers + 2;
const uint8_t unlock_sector = 0x00;
int j;
@@ -163,12 +163,12 @@
int erase_block_stm50flw0x0x(struct flashchip *flash, int offset)
{
- volatile uint8_t *bios = flash->virtual_memory + offset;
+ chipaddr bios = flash->virtual_memory + offset;
int j;
// clear status register
chip_writeb(0x50, bios);
- printf_debug("Erase at %p\n", bios);
+ printf_debug("Erase at 0x%lx\n", bios);
// now start it
chip_writeb(0x20, bios);
chip_writeb(0xd0, bios);
@@ -188,11 +188,11 @@
return 0;
}
-int write_page_stm50flw0x0x(volatile uint8_t *bios, uint8_t *src,
- volatile uint8_t *dst, int page_size)
+int write_page_stm50flw0x0x(chipaddr bios, uint8_t *src,
+ chipaddr dst, int page_size)
{
int i, rc = 0;
- volatile uint8_t *d = dst;
+ chipaddr d = dst;
uint8_t *s = src;
/* transfer data from source to destination */
@@ -219,8 +219,8 @@
}
if (rc) {
- fprintf(stderr, " page %d failed!\n",
- (unsigned int)(d - bios) / page_size);
+ fprintf(stderr, " page 0x%lx failed!\n",
+ (d - bios) / page_size);
}
return rc;
@@ -234,7 +234,7 @@
int i, rc = 0;
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;
printf("Erasing page:\n");
for (i = 0; (i < total_size / page_size) && (rc == 0); i++) {
@@ -256,7 +256,7 @@
int i, rc = 0;
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;
printf("Programming page: \n");
for (i = 0; (i < total_size / page_size) && (rc == 0); i++) {
Modified: trunk/w29ee011.c
===================================================================
--- trunk/w29ee011.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/w29ee011.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -23,7 +23,7 @@
int probe_w29ee011(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
extern char *chip_to_probe;
Modified: trunk/w39v040c.c
===================================================================
--- trunk/w39v040c.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/w39v040c.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -23,7 +23,7 @@
int probe_w39v040c(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t id1, id2, lock;
chip_writeb(0xAA, bios + 0x5555);
@@ -61,7 +61,7 @@
{
int i;
unsigned int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
for (i = 0; i < total_size; i += flash->page_size)
erase_sector_jedec(flash->virtual_memory, i);
@@ -80,7 +80,7 @@
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;
if (flash->erase(flash))
return -1;
Modified: trunk/w39v080fa.c
===================================================================
--- trunk/w39v080fa.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/w39v080fa.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -23,7 +23,7 @@
int probe_winbond_fwhub(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t vid, did;
/* Product Identification Entry */
@@ -54,7 +54,7 @@
static int unlock_block_winbond_fwhub(struct flashchip *flash, int offset)
{
- volatile uint8_t *wrprotect = flash->virtual_registers + offset + 2;
+ chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
printf_debug("Trying to unlock block @0x%08x = 0x%02x\n", offset,
@@ -98,7 +98,7 @@
int unlock_winbond_fwhub(struct flashchip *flash)
{
int i, total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
uint8_t locking;
/* Are there any hardware restrictions that we can't overcome?
@@ -143,7 +143,7 @@
return 0;
}
-static int erase_sector_winbond_fwhub(volatile uint8_t *bios,
+static int erase_sector_winbond_fwhub(chipaddr bios,
unsigned int sector)
{
/* Remember: too much sleep can waste your day. */
@@ -168,7 +168,7 @@
int erase_winbond_fwhub(struct flashchip *flash)
{
int i, total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
unlock_winbond_fwhub(flash);
@@ -193,7 +193,7 @@
{
int i;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr bios = flash->virtual_memory;
if (erase_winbond_fwhub(flash))
return -1;
Modified: trunk/w49f002u.c
===================================================================
--- trunk/w49f002u.c 2009-05-16 01:30:48 UTC (rev 518)
+++ trunk/w49f002u.c 2009-05-16 21:22:56 UTC (rev 519)
@@ -26,7 +26,7 @@
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;
erase_chip_jedec(flash);