aboutsummaryrefslogtreecommitdiffstats
path: root/hw/ds1225y.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-01 18:59:50 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-01 18:59:50 +0000
commit8da3ff180974732fc4272cb4433fef85c1822961 (patch)
treef23cfaffa61efb36aa46dfeb771ad33cbfd4f3aa /hw/ds1225y.c
parent6ad1d22b15c0a091edb1d8efc983c1d75f74ef45 (diff)
Change MMIO callbacks to use offsets, not absolute addresses.
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5849 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ds1225y.c')
-rw-r--r--hw/ds1225y.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/hw/ds1225y.c b/hw/ds1225y.c
index 3b91b4fa7..64c21b722 100644
--- a/hw/ds1225y.c
+++ b/hw/ds1225y.c
@@ -30,7 +30,6 @@
typedef struct ds1225y_t
{
- target_phys_addr_t mem_base;
uint32_t chip_size;
QEMUFile *file;
uint8_t *contents;
@@ -41,14 +40,9 @@ typedef struct ds1225y_t
static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
{
ds1225y_t *s = opaque;
- int64_t pos;
uint32_t val;
- pos = addr - s->mem_base;
- if (pos >= s->chip_size)
- pos -= s->chip_size;
-
- val = s->contents[pos];
+ val = s->contents[addr];
#ifdef DEBUG_NVRAM
printf("nvram: read 0x%x at " TARGET_FMT_lx "\n", val, addr);
@@ -77,16 +71,14 @@ static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t val)
{
ds1225y_t *s = opaque;
- int64_t pos;
#ifdef DEBUG_NVRAM
printf("nvram: write 0x%x at " TARGET_FMT_lx "\n", val, addr);
#endif
- pos = addr - s->mem_base;
- s->contents[pos] = val & 0xff;
+ s->contents[addr] = val & 0xff;
if (s->file) {
- qemu_fseek(s->file, pos, SEEK_SET);
+ qemu_fseek(s->file, addr, SEEK_SET);
qemu_put_byte(s->file, (int)val);
qemu_fflush(s->file);
}
@@ -117,7 +109,7 @@ static void nvram_writeb_protected (void *opaque, target_phys_addr_t addr, uint3
return;
}
- nvram_writeb(opaque, addr - s->chip_size, val);
+ nvram_writeb(opaque, addr, val);
}
static void nvram_writew_protected (void *opaque, target_phys_addr_t addr, uint32_t val)
@@ -167,7 +159,6 @@ void *ds1225y_init(target_phys_addr_t mem_base, const char *filename)
if (!s->contents) {
return NULL;
}
- s->mem_base = mem_base;
s->protection = 7;
/* Read current file */