Author: stefanct Date: Sun Jul 14 01:31:37 2013 New Revision: 1698 URL: http://flashrom.org/trac/flashrom/changeset/1698
Log: Use uintptr_t for chipaddr instead of unsigned long.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/dummyflasher.c trunk/flash.h trunk/jedec.c trunk/serprog.c trunk/sst49lfxxxc.c
Modified: trunk/dummyflasher.c ============================================================================== --- trunk/dummyflasher.c Sun Jul 14 01:21:05 2013 (r1697) +++ trunk/dummyflasher.c Sun Jul 14 01:31:37 2013 (r1698) @@ -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;
Modified: trunk/flash.h ============================================================================== --- trunk/flash.h Sun Jul 14 01:21:05 2013 (r1697) +++ trunk/flash.h Sun Jul 14 01:31:37 2013 (r1698) @@ -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,
Modified: trunk/jedec.c ============================================================================== --- trunk/jedec.c Sun Jul 14 01:21:05 2013 (r1697) +++ trunk/jedec.c Sun Jul 14 01:31:37 2013 (r1698) @@ -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; }
Modified: trunk/serprog.c ============================================================================== --- trunk/serprog.c Sun Jul 14 01:21:05 2013 (r1697) +++ trunk/serprog.c Sun Jul 14 01:31:37 2013 (r1698) @@ -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();
Modified: trunk/sst49lfxxxc.c ============================================================================== --- trunk/sst49lfxxxc.c Sun Jul 14 01:21:05 2013 (r1697) +++ trunk/sst49lfxxxc.c Sun Jul 14 01:31:37 2013 (r1698) @@ -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); }