Use chipaddr_t 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
Index: flash.h
===================================================================
--- flash.h (Revision 514)
+++ flash.h (Arbeitskopie)
@@ -77,6 +77,9 @@
#endif
#endif
+typedef unsigned long chipaddr_t;
+//typedef volatile uint8_t * chipaddr_t;
+
extern int programmer;
#define PROGRAMMER_INTERNAL 0x00
#define PROGRAMMER_DUMMY 0x01
@@ -92,12 +95,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_t addr);
+ void (*chip_writew) (uint16_t val, chipaddr_t addr);
+ void (*chip_writel) (uint32_t val, chipaddr_t addr);
+ uint8_t (*chip_readb) (const chipaddr_t addr);
+ uint16_t (*chip_readw) (const chipaddr_t addr);
+ uint32_t (*chip_readl) (const chipaddr_t addr);
};
extern const struct programmer_entry programmer_table[];
@@ -122,32 +125,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_t 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_t 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_t 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_t 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_t 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_t addr)
{
return programmer_table[programmer].chip_readl(addr);
}
@@ -180,8 +183,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_t virtual_memory;
+ chipaddr_t virtual_registers;
};
#define TEST_UNTESTED 0
@@ -588,12 +591,12 @@
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 internal_chip_writeb(uint8_t val, chipaddr_t addr);
+void internal_chip_writew(uint16_t val, chipaddr_t addr);
+void internal_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t internal_chip_readb(const chipaddr_t addr);
+uint16_t internal_chip_readw(const chipaddr_t addr);
+uint32_t internal_chip_readl(const chipaddr_t addr);
#if defined(__FreeBSD__) || defined(__DragonFly__)
extern int io_fd;
#endif
@@ -603,12 +606,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_t addr);
+void dummy_chip_writew(uint16_t val, chipaddr_t addr);
+void dummy_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t dummy_chip_readb(const chipaddr_t addr);
+uint16_t dummy_chip_readw(const chipaddr_t addr);
+uint32_t dummy_chip_readl(const chipaddr_t addr);
int dummy_spi_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
@@ -617,12 +620,12 @@
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);
-void nic3com_chip_writew(uint16_t val, volatile void *addr);
-void nic3com_chip_writel(uint32_t val, volatile void *addr);
-uint8_t nic3com_chip_readb(const volatile void *addr);
-uint16_t nic3com_chip_readw(const volatile void *addr);
-uint32_t nic3com_chip_readl(const volatile void *addr);
+void nic3com_chip_writeb(uint8_t val, chipaddr_t addr);
+void nic3com_chip_writew(uint16_t val, chipaddr_t addr);
+void nic3com_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t nic3com_chip_readb(const chipaddr_t addr);
+uint16_t nic3com_chip_readw(const chipaddr_t addr);
+uint32_t nic3com_chip_readl(const chipaddr_t addr);
/* flashrom.c */
extern int verbose;
@@ -707,19 +710,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_t dst);
+void data_polling_jedec(chipaddr_t dst, uint8_t data);
+void unprotect_jedec(chipaddr_t bios);
+void protect_jedec(chipaddr_t bios);
+int write_byte_program_jedec(chipaddr_t bios, uint8_t *src,
+ chipaddr_t 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_t bios, unsigned int page);
+int erase_block_jedec(chipaddr_t bios, unsigned int page);
+int write_sector_jedec(chipaddr_t bios, uint8_t *src,
+ chipaddr_t dst, unsigned int page_size);
/* m29f002.c */
int erase_m29f002(struct flashchip *flash);
@@ -729,15 +732,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_t bios,
+ chipaddr_t 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_t dst);
+void data_polling_m29f400bt(chipaddr_t dst, uint8_t data);
+void protect_m29f400bt(chipaddr_t bios);
+void write_page_m29f400bt(chipaddr_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size);
/* mx29f002.c */
int probe_29f002(struct flashchip *flash);
@@ -753,9 +756,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_t dst);
+void data_polling_lhf00l04(chipaddr_t dst, uint8_t data);
+void protect_lhf00l04(chipaddr_t bios);
/* sst28sf040.c */
int probe_28sf040(struct flashchip *flash);
Index: pm49fl00x.c
===================================================================
--- pm49fl00x.c (Revision 514)
+++ pm49fl00x.c (Arbeitskopie)
@@ -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_t 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_t 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_t bios = flash->virtual_memory;
/* unprotected */
write_lockbits_49fl00x(flash->virtual_registers, total_size, 0,
Index: en29f002a.c
===================================================================
--- en29f002a.c (Revision 514)
+++ en29f002a.c (Arbeitskopie)
@@ -32,7 +32,7 @@
int probe_en29f512(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x555);
@@ -95,8 +95,8 @@
{
int i;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *dst = bios;
+ chipaddr_t bios = flash->virtual_memory;
+ chipaddr_t dst = bios;
// *bios = 0xF0;
myusec_delay(10);
Index: jedec.c
===================================================================
--- jedec.c (Revision 514)
+++ jedec.c (Arbeitskopie)
@@ -35,7 +35,7 @@
return (val ^ (val >> 1)) & 0x1;
}
-void toggle_ready_jedec(volatile uint8_t *dst)
+void toggle_ready_jedec(chipaddr_t 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_t 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_t 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_t 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_t 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_t 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_t 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_t 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_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size)
{
int i, tried = 0, start_index = 0, ok;
- volatile uint8_t *d = dst;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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;
}
Index: w29ee011.c
===================================================================
--- w29ee011.c (Revision 514)
+++ w29ee011.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_w29ee011(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t bios = flash->virtual_memory;
uint8_t id1, id2;
extern char *chip_to_probe;
Index: sst49lfxxxc.c
===================================================================
--- sst49lfxxxc.c (Revision 514)
+++ sst49lfxxxc.c (Arbeitskopie)
@@ -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_t 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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
+ chipaddr_t 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_t bios = flash->virtual_memory;
write_lockbits_49lfxxxc(flash->virtual_registers, total_size, 0);
printf("Programming page: ");
Index: sharplhf00l04.c
===================================================================
--- sharplhf00l04.c (Revision 514)
+++ sharplhf00l04.c (Arbeitskopie)
@@ -36,7 +36,7 @@
int probe_lhf00l04(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory + offset;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios = flash->virtual_memory;
erase_lhf00l04(flash);
if (chip_readb(bios) != 0xff) {
Index: nic3com.c
===================================================================
--- nic3com.c (Revision 514)
+++ nic3com.c (Arbeitskopie)
@@ -163,36 +163,36 @@
{
}
-void nic3com_chip_writeb(uint8_t val, volatile void *addr)
+void nic3com_chip_writeb(uint8_t val, chipaddr_t 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);
}
-void nic3com_chip_writew(uint16_t val, volatile void *addr)
+void nic3com_chip_writew(uint16_t val, chipaddr_t addr)
{
}
-void nic3com_chip_writel(uint32_t val, volatile void *addr)
+void nic3com_chip_writel(uint32_t val, chipaddr_t addr)
{
}
-uint8_t nic3com_chip_readb(const volatile void *addr)
+uint8_t nic3com_chip_readb(const chipaddr_t 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;
}
-uint16_t nic3com_chip_readw(const volatile void *addr)
+uint16_t nic3com_chip_readw(const chipaddr_t addr)
{
return 0xffff;
}
-uint32_t nic3com_chip_readl(const volatile void *addr)
+uint32_t nic3com_chip_readl(const chipaddr_t addr)
{
return 0xffffffff;
}
Index: w39v040c.c
===================================================================
--- w39v040c.c (Revision 514)
+++ w39v040c.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_w39v040c(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
if (flash->erase(flash))
return -1;
Index: m29f002.c
===================================================================
--- m29f002.c (Revision 514)
+++ m29f002.c (Arbeitskopie)
@@ -22,7 +22,7 @@
int erase_m29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
/* M29F002B has 7 blocks. From bottom to top their sizes are:
* 16k 8k 8k 32k 64k 64k 64k
Index: dummyflasher.c
===================================================================
--- dummyflasher.c (Revision 514)
+++ dummyflasher.c (Arbeitskopie)
@@ -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_t 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_t 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_t 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_t 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_t 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_t addr)
{
- printf_debug("%s: addr=%p, returning 0xffffffff\n", __func__, addr);
+ printf_debug("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr);
return 0xffffffff;
}
Index: w49f002u.c
===================================================================
--- w49f002u.c (Revision 514)
+++ w49f002u.c (Arbeitskopie)
@@ -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_t bios = flash->virtual_memory;
erase_chip_jedec(flash);
Index: sst28sf040.c
===================================================================
--- sst28sf040.c (Revision 514)
+++ sst28sf040.c (Arbeitskopie)
@@ -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_t 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_t 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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
unprotect_28sf040(bios);
Index: stm50flw0x0x.c
===================================================================
--- stm50flw0x0x.c (Revision 514)
+++ stm50flw0x0x.c (Arbeitskopie)
@@ -31,7 +31,7 @@
#include <stdint.h>
#include "flash.h"
-void protect_stm50flw0x0x(volatile uint8_t *bios)
+void protect_stm50flw0x0x(chipaddr_t 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_t 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_t 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_t 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_t 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_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size)
{
int i, rc = 0;
- volatile uint8_t *d = dst;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
printf("Programming page: \n");
for (i = 0; (i < total_size / page_size) && (rc == 0); i++) {
Index: am29f040b.c
===================================================================
--- am29f040b.c (Revision 514)
+++ am29f040b.c (Arbeitskopie)
@@ -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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
printf("Programming page ");
for (i = 0; i < total_size / page_size; i++) {
Index: sst_fwhub.c
===================================================================
--- sst_fwhub.c (Revision 514)
+++ sst_fwhub.c (Arbeitskopie)
@@ -37,7 +37,7 @@
int check_sst_fwhub_block_lock(struct flashchip *flash, int offset)
{
- volatile uint8_t *registers = flash->virtual_registers;
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
uint8_t blockstatus;
// FIXME: We want block wide erase instead of ironing the whole chip
Index: w39v080fa.c
===================================================================
--- w39v080fa.c (Revision 514)
+++ w39v080fa.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_winbond_fwhub(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t 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_t 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_t 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_t bios = flash->virtual_memory;
if (erase_winbond_fwhub(flash))
return -1;
Index: flashrom.c
===================================================================
--- flashrom.c (Revision 514)
+++ flashrom.c (Arbeitskopie)
@@ -84,7 +84,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_t)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size);
}
int read_memmapped(struct flashchip *flash, uint8_t *buf)
@@ -117,7 +117,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_t)programmer_map_flash_region("flash chip", base, size);
if (force)
break;
@@ -130,8 +130,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)
Index: internal.c
===================================================================
--- internal.c (Revision 514)
+++ internal.c (Arbeitskopie)
@@ -138,32 +138,32 @@
return 0;
}
-void internal_chip_writeb(uint8_t val, volatile void *addr)
+void internal_chip_writeb(uint8_t val, chipaddr_t addr)
{
*(volatile uint8_t *) addr = val;
}
-void internal_chip_writew(uint16_t val, volatile void *addr)
+void internal_chip_writew(uint16_t val, chipaddr_t addr)
{
*(volatile uint16_t *) addr = val;
}
-void internal_chip_writel(uint32_t val, volatile void *addr)
+void internal_chip_writel(uint32_t val, chipaddr_t addr)
{
*(volatile uint32_t *) addr = val;
}
-uint8_t internal_chip_readb(const volatile void *addr)
+uint8_t internal_chip_readb(const chipaddr_t addr)
{
return *(volatile uint8_t *) addr;
}
-uint16_t internal_chip_readw(const volatile void *addr)
+uint16_t internal_chip_readw(const chipaddr_t addr)
{
return *(volatile uint16_t *) addr;
}
-uint32_t internal_chip_readl(const volatile void *addr)
+uint32_t internal_chip_readl(const chipaddr_t addr)
{
return *(volatile uint32_t *) addr;
}
Index: 82802ab.c
===================================================================
--- 82802ab.c (Revision 514)
+++ 82802ab.c (Arbeitskopie)
@@ -45,7 +45,7 @@
int probe_82802ab(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory + offset;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios = flash->virtual_memory;
printf("Programming page: \n");
for (i = 0; i < total_size / page_size; i++) {
Index: mx29f002.c
===================================================================
--- mx29f002.c (Revision 514)
+++ mx29f002.c (Arbeitskopie)
@@ -24,7 +24,7 @@
int probe_29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
+ chipaddr_t dst = bios;
chip_writeb(0xF0, bios);
myusec_delay(10);
Index: m29f400bt.c
===================================================================
--- m29f400bt.c (Revision 514)
+++ m29f400bt.c (Arbeitskopie)
@@ -20,7 +20,7 @@
#include "flash.h"
-void protect_m29f400bt(volatile uint8_t *bios)
+void protect_m29f400bt(chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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_t 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_t bios, chipaddr_t 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;
+ //*(chipaddr_t ) (bios + 0xAAA) = 0x10;
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_t 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_t bios = flash->virtual_memory;
printf("Programming page:\n ");
/*********************************
Index: sst49lf040.c
===================================================================
--- sst49lf040.c (Revision 514)
+++ sst49lf040.c (Arbeitskopie)
@@ -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_t 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_t bios = flash->virtual_memory;
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
--
http://www.hailfinger.org/
Index: flashrom-chipaddr_t/flash.h
===================================================================
--- flashrom-chipaddr_t/flash.h (Revision 514)
+++ flashrom-chipaddr_t/flash.h (Arbeitskopie)
@@ -77,6 +77,9 @@
#endif
#endif
+typedef unsigned long chipaddr_t;
+//typedef volatile uint8_t * chipaddr_t;
+
extern int programmer;
#define PROGRAMMER_INTERNAL 0x00
#define PROGRAMMER_DUMMY 0x01
@@ -92,12 +95,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_t addr);
+ void (*chip_writew) (uint16_t val, chipaddr_t addr);
+ void (*chip_writel) (uint32_t val, chipaddr_t addr);
+ uint8_t (*chip_readb) (const chipaddr_t addr);
+ uint16_t (*chip_readw) (const chipaddr_t addr);
+ uint32_t (*chip_readl) (const chipaddr_t addr);
};
extern const struct programmer_entry programmer_table[];
@@ -122,32 +125,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_t 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_t 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_t 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_t 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_t 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_t addr)
{
return programmer_table[programmer].chip_readl(addr);
}
@@ -180,8 +183,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_t virtual_memory;
+ chipaddr_t virtual_registers;
};
#define TEST_UNTESTED 0
@@ -588,12 +591,12 @@
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 internal_chip_writeb(uint8_t val, chipaddr_t addr);
+void internal_chip_writew(uint16_t val, chipaddr_t addr);
+void internal_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t internal_chip_readb(const chipaddr_t addr);
+uint16_t internal_chip_readw(const chipaddr_t addr);
+uint32_t internal_chip_readl(const chipaddr_t addr);
#if defined(__FreeBSD__) || defined(__DragonFly__)
extern int io_fd;
#endif
@@ -603,12 +606,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_t addr);
+void dummy_chip_writew(uint16_t val, chipaddr_t addr);
+void dummy_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t dummy_chip_readb(const chipaddr_t addr);
+uint16_t dummy_chip_readw(const chipaddr_t addr);
+uint32_t dummy_chip_readl(const chipaddr_t addr);
int dummy_spi_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
@@ -617,12 +620,12 @@
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);
-void nic3com_chip_writew(uint16_t val, volatile void *addr);
-void nic3com_chip_writel(uint32_t val, volatile void *addr);
-uint8_t nic3com_chip_readb(const volatile void *addr);
-uint16_t nic3com_chip_readw(const volatile void *addr);
-uint32_t nic3com_chip_readl(const volatile void *addr);
+void nic3com_chip_writeb(uint8_t val, chipaddr_t addr);
+void nic3com_chip_writew(uint16_t val, chipaddr_t addr);
+void nic3com_chip_writel(uint32_t val, chipaddr_t addr);
+uint8_t nic3com_chip_readb(const chipaddr_t addr);
+uint16_t nic3com_chip_readw(const chipaddr_t addr);
+uint32_t nic3com_chip_readl(const chipaddr_t addr);
/* flashrom.c */
extern int verbose;
@@ -707,19 +710,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_t dst);
+void data_polling_jedec(chipaddr_t dst, uint8_t data);
+void unprotect_jedec(chipaddr_t bios);
+void protect_jedec(chipaddr_t bios);
+int write_byte_program_jedec(chipaddr_t bios, uint8_t *src,
+ chipaddr_t 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_t bios, unsigned int page);
+int erase_block_jedec(chipaddr_t bios, unsigned int page);
+int write_sector_jedec(chipaddr_t bios, uint8_t *src,
+ chipaddr_t dst, unsigned int page_size);
/* m29f002.c */
int erase_m29f002(struct flashchip *flash);
@@ -729,15 +732,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_t bios,
+ chipaddr_t 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_t dst);
+void data_polling_m29f400bt(chipaddr_t dst, uint8_t data);
+void protect_m29f400bt(chipaddr_t bios);
+void write_page_m29f400bt(chipaddr_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size);
/* mx29f002.c */
int probe_29f002(struct flashchip *flash);
@@ -753,9 +756,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_t dst);
+void data_polling_lhf00l04(chipaddr_t dst, uint8_t data);
+void protect_lhf00l04(chipaddr_t bios);
/* sst28sf040.c */
int probe_28sf040(struct flashchip *flash);
Index: flashrom-chipaddr_t/pm49fl00x.c
===================================================================
--- flashrom-chipaddr_t/pm49fl00x.c (Revision 514)
+++ flashrom-chipaddr_t/pm49fl00x.c (Arbeitskopie)
@@ -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_t 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_t 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_t bios = flash->virtual_memory;
/* unprotected */
write_lockbits_49fl00x(flash->virtual_registers, total_size, 0,
Index: flashrom-chipaddr_t/en29f002a.c
===================================================================
--- flashrom-chipaddr_t/en29f002a.c (Revision 514)
+++ flashrom-chipaddr_t/en29f002a.c (Arbeitskopie)
@@ -32,7 +32,7 @@
int probe_en29f512(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t bios = flash->virtual_memory;
uint8_t id1, id2;
chip_writeb(0xAA, bios + 0x555);
@@ -95,8 +95,8 @@
{
int i;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *dst = bios;
+ chipaddr_t bios = flash->virtual_memory;
+ chipaddr_t dst = bios;
// *bios = 0xF0;
myusec_delay(10);
Index: flashrom-chipaddr_t/jedec.c
===================================================================
--- flashrom-chipaddr_t/jedec.c (Revision 514)
+++ flashrom-chipaddr_t/jedec.c (Arbeitskopie)
@@ -35,7 +35,7 @@
return (val ^ (val >> 1)) & 0x1;
}
-void toggle_ready_jedec(volatile uint8_t *dst)
+void toggle_ready_jedec(chipaddr_t 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_t 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_t 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_t 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_t 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_t 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_t 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_t 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_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size)
{
int i, tried = 0, start_index = 0, ok;
- volatile uint8_t *d = dst;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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;
}
Index: flashrom-chipaddr_t/w29ee011.c
===================================================================
--- flashrom-chipaddr_t/w29ee011.c (Revision 514)
+++ flashrom-chipaddr_t/w29ee011.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_w29ee011(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t bios = flash->virtual_memory;
uint8_t id1, id2;
extern char *chip_to_probe;
Index: flashrom-chipaddr_t/sst49lfxxxc.c
===================================================================
--- flashrom-chipaddr_t/sst49lfxxxc.c (Revision 514)
+++ flashrom-chipaddr_t/sst49lfxxxc.c (Arbeitskopie)
@@ -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_t 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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
+ chipaddr_t 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_t bios = flash->virtual_memory;
write_lockbits_49lfxxxc(flash->virtual_registers, total_size, 0);
printf("Programming page: ");
Index: flashrom-chipaddr_t/sharplhf00l04.c
===================================================================
--- flashrom-chipaddr_t/sharplhf00l04.c (Revision 514)
+++ flashrom-chipaddr_t/sharplhf00l04.c (Arbeitskopie)
@@ -36,7 +36,7 @@
int probe_lhf00l04(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory + offset;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios = flash->virtual_memory;
erase_lhf00l04(flash);
if (chip_readb(bios) != 0xff) {
Index: flashrom-chipaddr_t/nic3com.c
===================================================================
--- flashrom-chipaddr_t/nic3com.c (Revision 514)
+++ flashrom-chipaddr_t/nic3com.c (Arbeitskopie)
@@ -163,36 +163,36 @@
{
}
-void nic3com_chip_writeb(uint8_t val, volatile void *addr)
+void nic3com_chip_writeb(uint8_t val, chipaddr_t 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);
}
-void nic3com_chip_writew(uint16_t val, volatile void *addr)
+void nic3com_chip_writew(uint16_t val, chipaddr_t addr)
{
}
-void nic3com_chip_writel(uint32_t val, volatile void *addr)
+void nic3com_chip_writel(uint32_t val, chipaddr_t addr)
{
}
-uint8_t nic3com_chip_readb(const volatile void *addr)
+uint8_t nic3com_chip_readb(const chipaddr_t 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;
}
-uint16_t nic3com_chip_readw(const volatile void *addr)
+uint16_t nic3com_chip_readw(const chipaddr_t addr)
{
return 0xffff;
}
-uint32_t nic3com_chip_readl(const volatile void *addr)
+uint32_t nic3com_chip_readl(const chipaddr_t addr)
{
return 0xffffffff;
}
Index: flashrom-chipaddr_t/w39v040c.c
===================================================================
--- flashrom-chipaddr_t/w39v040c.c (Revision 514)
+++ flashrom-chipaddr_t/w39v040c.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_w39v040c(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
if (flash->erase(flash))
return -1;
Index: flashrom-chipaddr_t/m29f002.c
===================================================================
--- flashrom-chipaddr_t/m29f002.c (Revision 514)
+++ flashrom-chipaddr_t/m29f002.c (Arbeitskopie)
@@ -22,7 +22,7 @@
int erase_m29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
/* M29F002B has 7 blocks. From bottom to top their sizes are:
* 16k 8k 8k 32k 64k 64k 64k
Index: flashrom-chipaddr_t/dummyflasher.c
===================================================================
--- flashrom-chipaddr_t/dummyflasher.c (Revision 514)
+++ flashrom-chipaddr_t/dummyflasher.c (Arbeitskopie)
@@ -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_t 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_t 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_t 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_t 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_t 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_t addr)
{
- printf_debug("%s: addr=%p, returning 0xffffffff\n", __func__, addr);
+ printf_debug("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr);
return 0xffffffff;
}
Index: flashrom-chipaddr_t/w49f002u.c
===================================================================
--- flashrom-chipaddr_t/w49f002u.c (Revision 514)
+++ flashrom-chipaddr_t/w49f002u.c (Arbeitskopie)
@@ -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_t bios = flash->virtual_memory;
erase_chip_jedec(flash);
Index: flashrom-chipaddr_t/sst28sf040.c
===================================================================
--- flashrom-chipaddr_t/sst28sf040.c (Revision 514)
+++ flashrom-chipaddr_t/sst28sf040.c (Arbeitskopie)
@@ -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_t 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_t 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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
unprotect_28sf040(bios);
Index: flashrom-chipaddr_t/stm50flw0x0x.c
===================================================================
--- flashrom-chipaddr_t/stm50flw0x0x.c (Revision 514)
+++ flashrom-chipaddr_t/stm50flw0x0x.c (Arbeitskopie)
@@ -31,7 +31,7 @@
#include <stdint.h>
#include "flash.h"
-void protect_stm50flw0x0x(volatile uint8_t *bios)
+void protect_stm50flw0x0x(chipaddr_t 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_t 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_t 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_t 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_t 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_t bios, uint8_t *src,
+ chipaddr_t dst, int page_size)
{
int i, rc = 0;
- volatile uint8_t *d = dst;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
printf("Programming page: \n");
for (i = 0; (i < total_size / page_size) && (rc == 0); i++) {
Index: flashrom-chipaddr_t/am29f040b.c
===================================================================
--- flashrom-chipaddr_t/am29f040b.c (Revision 514)
+++ flashrom-chipaddr_t/am29f040b.c (Arbeitskopie)
@@ -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_t 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_t bios,
uint8_t *src,
- volatile uint8_t *dst,
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
printf("Programming page ");
for (i = 0; i < total_size / page_size; i++) {
Index: flashrom-chipaddr_t/sst_fwhub.c
===================================================================
--- flashrom-chipaddr_t/sst_fwhub.c (Revision 514)
+++ flashrom-chipaddr_t/sst_fwhub.c (Arbeitskopie)
@@ -37,7 +37,7 @@
int check_sst_fwhub_block_lock(struct flashchip *flash, int offset)
{
- volatile uint8_t *registers = flash->virtual_registers;
+ chipaddr_t 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_t 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_t 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_t bios = flash->virtual_memory;
uint8_t blockstatus;
// FIXME: We want block wide erase instead of ironing the whole chip
Index: flashrom-chipaddr_t/w39v080fa.c
===================================================================
--- flashrom-chipaddr_t/w39v080fa.c (Revision 514)
+++ flashrom-chipaddr_t/w39v080fa.c (Arbeitskopie)
@@ -23,7 +23,7 @@
int probe_winbond_fwhub(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t 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_t 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_t 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_t bios = flash->virtual_memory;
if (erase_winbond_fwhub(flash))
return -1;
Index: flashrom-chipaddr_t/flashrom.c
===================================================================
--- flashrom-chipaddr_t/flashrom.c (Revision 514)
+++ flashrom-chipaddr_t/flashrom.c (Arbeitskopie)
@@ -84,7 +84,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_t)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size);
}
int read_memmapped(struct flashchip *flash, uint8_t *buf)
@@ -117,7 +117,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_t)programmer_map_flash_region("flash chip", base, size);
if (force)
break;
@@ -130,8 +130,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)
Index: flashrom-chipaddr_t/internal.c
===================================================================
--- flashrom-chipaddr_t/internal.c (Revision 514)
+++ flashrom-chipaddr_t/internal.c (Arbeitskopie)
@@ -138,32 +138,32 @@
return 0;
}
-void internal_chip_writeb(uint8_t val, volatile void *addr)
+void internal_chip_writeb(uint8_t val, chipaddr_t addr)
{
*(volatile uint8_t *) addr = val;
}
-void internal_chip_writew(uint16_t val, volatile void *addr)
+void internal_chip_writew(uint16_t val, chipaddr_t addr)
{
*(volatile uint16_t *) addr = val;
}
-void internal_chip_writel(uint32_t val, volatile void *addr)
+void internal_chip_writel(uint32_t val, chipaddr_t addr)
{
*(volatile uint32_t *) addr = val;
}
-uint8_t internal_chip_readb(const volatile void *addr)
+uint8_t internal_chip_readb(const chipaddr_t addr)
{
return *(volatile uint8_t *) addr;
}
-uint16_t internal_chip_readw(const volatile void *addr)
+uint16_t internal_chip_readw(const chipaddr_t addr)
{
return *(volatile uint16_t *) addr;
}
-uint32_t internal_chip_readl(const volatile void *addr)
+uint32_t internal_chip_readl(const chipaddr_t addr)
{
return *(volatile uint32_t *) addr;
}
Index: flashrom-chipaddr_t/82802ab.c
===================================================================
--- flashrom-chipaddr_t/82802ab.c (Revision 514)
+++ flashrom-chipaddr_t/82802ab.c (Arbeitskopie)
@@ -45,7 +45,7 @@
int probe_82802ab(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory + offset;
+ chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t bios = flash->virtual_memory;
printf("Programming page: \n");
for (i = 0; i < total_size / page_size; i++) {
Index: flashrom-chipaddr_t/mx29f002.c
===================================================================
--- flashrom-chipaddr_t/mx29f002.c (Revision 514)
+++ flashrom-chipaddr_t/mx29f002.c (Arbeitskopie)
@@ -24,7 +24,7 @@
int probe_29f002(struct flashchip *flash)
{
- volatile uint8_t *bios = flash->virtual_memory;
+ chipaddr_t 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_t 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_t bios = flash->virtual_memory;
+ chipaddr_t dst = bios;
chip_writeb(0xF0, bios);
myusec_delay(10);
Index: flashrom-chipaddr_t/m29f400bt.c
===================================================================
--- flashrom-chipaddr_t/m29f400bt.c (Revision 514)
+++ flashrom-chipaddr_t/m29f400bt.c (Arbeitskopie)
@@ -20,7 +20,7 @@
#include "flash.h"
-void protect_m29f400bt(volatile uint8_t *bios)
+void protect_m29f400bt(chipaddr_t 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_t bios, uint8_t *src,
+ chipaddr_t 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_t 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_t 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_t bios, chipaddr_t 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;
+ //*(chipaddr_t ) (bios + 0xAAA) = 0x10;
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_t 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_t bios = flash->virtual_memory;
printf("Programming page:\n ");
/*********************************
Index: flashrom-chipaddr_t/sst49lf040.c
===================================================================
--- flashrom-chipaddr_t/sst49lf040.c (Revision 514)
+++ flashrom-chipaddr_t/sst49lf040.c (Arbeitskopie)
@@ -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_t 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_t bios = flash->virtual_memory;
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {