Use uintptr_t for chipaddr instead of unsigned long
Corresponding to flashrom svn r1698.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/dummyflasher.c b/dummyflasher.c
index 383ca58..e2ec036 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -428,26 +428,26 @@
static void dummy_chip_writeb(const struct flashctx *flash, uint8_t val,
chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%02x\n", __func__, addr, val);
}
static void dummy_chip_writew(const struct flashctx *flash, uint16_t val,
chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%04x\n", __func__, addr, val);
}
static void dummy_chip_writel(const struct flashctx *flash, uint32_t val,
chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%08x\n", __func__, addr, val);
}
static void dummy_chip_writen(const struct flashctx *flash, uint8_t *buf,
chipaddr addr, size_t len)
{
size_t i;
- msg_pspew("%s: addr=0x%lx, len=0x%08lx, writing data (hex):",
+ msg_pspew("%s: addr=0x%" PRIxPTR ", len=0x%08lx, writing data (hex):",
__func__, addr, (unsigned long)len);
for (i = 0; i < len; i++) {
if ((i % 16) == 0)
@@ -459,28 +459,28 @@
static uint8_t dummy_chip_readb(const struct flashctx *flash,
const chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, returning 0xff\n", __func__, addr);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xff\n", __func__, addr);
return 0xff;
}
static uint16_t dummy_chip_readw(const struct flashctx *flash,
const chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, returning 0xffff\n", __func__, addr);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xffff\n", __func__, addr);
return 0xffff;
}
static uint32_t dummy_chip_readl(const struct flashctx *flash,
const chipaddr addr)
{
- msg_pspew("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr);
+ msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xffffffff\n", __func__, addr);
return 0xffffffff;
}
static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf,
const chipaddr addr, size_t len)
{
- msg_pspew("%s: addr=0x%lx, len=0x%lx, returning array of 0xff\n",
+ msg_pspew("%s: addr=0x%" PRIxPTR ", len=0x%lx, returning array of 0xff\n",
__func__, addr, (unsigned long)len);
memset(buf, 0xff, len);
return;
diff --git a/flash.h b/flash.h
index ba93245..9e787c0 100644
--- a/flash.h
+++ b/flash.h
@@ -41,7 +41,8 @@
#define ERROR_OOM -100
#define TIMEOUT_ERROR -101
-typedef unsigned long chipaddr;
+/* TODO: check using code for correct usage of types */
+typedef uintptr_t chipaddr;
int register_shutdown(int (*function) (void *data), void *data);
void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
diff --git a/jedec.c b/jedec.c
index 7bc9133..0894c2b 100644
--- a/jedec.c
+++ b/jedec.c
@@ -376,7 +376,7 @@
dst++, src++;
}
if (failed)
- msg_cerr(" writing sector at 0x%lx failed!\n", olddst);
+ msg_cerr(" writing sector at 0x%" PRIxPTR " failed!\n", olddst);
return failed;
}
@@ -417,8 +417,7 @@
goto retry;
}
if (failed) {
- msg_cerr(" page 0x%lx failed!\n",
- (d - bios) / page_size);
+ msg_cerr(" page 0x%" PRIxPTR " failed!\n", (d - bios) / page_size);
}
return failed;
}
diff --git a/serprog.c b/serprog.c
index 24f5726..26b580c 100644
--- a/serprog.c
+++ b/serprog.c
@@ -789,7 +789,7 @@
sp_flush_stream();
if (serialport_read(&c, 1) != 0)
sp_die("readb byteread");
- msg_pspew("%s addr=0x%lx returning 0x%02X\n", __func__, addr, c);
+ msg_pspew("%s addr=0x%" PRIxPTR " returning 0x%02X\n", __func__, addr, c);
return c;
}
@@ -797,7 +797,7 @@
static void sp_do_read_n(uint8_t * buf, const chipaddr addr, size_t len)
{
unsigned char sbuf[6];
- msg_pspew("%s: addr=0x%lx len=%lu\n", __func__, addr, (unsigned long)len);
+ msg_pspew("%s: addr=0x%" PRIxPTR " len=%lu\n", __func__, addr, (unsigned long)len);
/* Stream the read-n -- as above. */
if ((sp_opbuf_usage) || (sp_max_write_n && sp_write_n_bytes))
sp_execute_opbuf_noflush();
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index bb21559..3d17b5b 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -41,7 +41,7 @@
unsigned int i, left = flash->chip->total_size * 1024;
unsigned long address;
- msg_cdbg("\nbios=0x%08lx\n", registers);
+ msg_cdbg("\nbios=0x%08" PRIxPTR "\n", registers);
for (i = 0; left > 65536; i++, left -= 65536) {
write_lockbits_block_49lfxxxc(flash, i * 65536, bits);
}