Introduce a type "chipaddr" to abstract the offsets within flash regions

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.

Corresponding to flashrom svn r519.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index 54897cc..d744cca 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -41,7 +41,7 @@
 #define	STATUS_ESS		(1 << 6)
 #define	STATUS_WSMS		(1 << 7)
 
-static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size,
+static __inline__ int write_lockbits_49lfxxxc(chipaddr bios, int size,
 					      unsigned char bits)
 {
 	int i, left = size;
@@ -68,7 +68,7 @@
 	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: ");