aboutsummaryrefslogtreecommitdiff
path: root/hw/serial.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/serial.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/serial.c')
-rw-r--r--hw/serial.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/hw/serial.c b/hw/serial.c
index 2167b79831..513ad27c90 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -125,7 +125,6 @@ struct SerialState {
qemu_irq irq;
CharDriverState *chr;
int last_break_enable;
- target_phys_addr_t base;
int it_shift;
int baudbase;
int tsr_retry;
@@ -750,7 +749,7 @@ uint32_t serial_mm_readb (void *opaque, target_phys_addr_t addr)
{
SerialState *s = opaque;
- return serial_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFF;
+ return serial_ioport_read(s, addr >> s->it_shift) & 0xFF;
}
void serial_mm_writeb (void *opaque,
@@ -758,7 +757,7 @@ void serial_mm_writeb (void *opaque,
{
SerialState *s = opaque;
- serial_ioport_write(s, (addr - s->base) >> s->it_shift, value & 0xFF);
+ serial_ioport_write(s, addr >> s->it_shift, value & 0xFF);
}
uint32_t serial_mm_readw (void *opaque, target_phys_addr_t addr)
@@ -766,7 +765,7 @@ uint32_t serial_mm_readw (void *opaque, target_phys_addr_t addr)
SerialState *s = opaque;
uint32_t val;
- val = serial_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFFFF;
+ val = serial_ioport_read(s, addr >> s->it_shift) & 0xFFFF;
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap16(val);
#endif
@@ -780,7 +779,7 @@ void serial_mm_writew (void *opaque,
#ifdef TARGET_WORDS_BIGENDIAN
value = bswap16(value);
#endif
- serial_ioport_write(s, (addr - s->base) >> s->it_shift, value & 0xFFFF);
+ serial_ioport_write(s, addr >> s->it_shift, value & 0xFFFF);
}
uint32_t serial_mm_readl (void *opaque, target_phys_addr_t addr)
@@ -788,7 +787,7 @@ uint32_t serial_mm_readl (void *opaque, target_phys_addr_t addr)
SerialState *s = opaque;
uint32_t val;
- val = serial_ioport_read(s, (addr - s->base) >> s->it_shift);
+ val = serial_ioport_read(s, addr >> s->it_shift);
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endif
@@ -802,7 +801,7 @@ void serial_mm_writel (void *opaque,
#ifdef TARGET_WORDS_BIGENDIAN
value = bswap32(value);
#endif
- serial_ioport_write(s, (addr - s->base) >> s->it_shift, value);
+ serial_ioport_write(s, addr >> s->it_shift, value);
}
static CPUReadMemoryFunc *serial_mm_read[] = {
@@ -828,7 +827,6 @@ SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
if (!s)
return NULL;
- s->base = base;
s->it_shift = it_shift;
serial_init_core(s, irq, baudbase, chr);