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
diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c
index 2d5ac5a..9327952 100644
--- a/hw/mst_fpga.c
+++ b/hw/mst_fpga.c
@@ -14,7 +14,6 @@
/* Mainstone FPGA for extern irqs */
#define FPGA_GPIO_PIN 0
#define MST_NUM_IRQS 16
-#define MST_BASE MST_FPGA_PHYS
#define MST_LEDDAT1 0x10
#define MST_LEDDAT2 0x14
#define MST_LEDCTRL 0x40
@@ -29,7 +28,6 @@
#define MST_PCMCIA1 0xe4
typedef struct mst_irq_state{
- target_phys_addr_t target_base;
qemu_irq *parent;
qemu_irq *pins;
@@ -83,7 +81,6 @@
mst_fpga_readb(void *opaque, target_phys_addr_t addr)
{
mst_irq_state *s = (mst_irq_state *) opaque;
- addr -= s->target_base;
switch (addr) {
case MST_LEDDAT1:
@@ -121,7 +118,6 @@
mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
{
mst_irq_state *s = (mst_irq_state *) opaque;
- addr -= s->target_base;
value &= 0xffffffff;
switch (addr) {
@@ -231,7 +227,6 @@
if (!s)
return NULL;
- s->target_base = base;
s->parent = &cpu->pic[irq];
/* alloc the external 16 irqs */
@@ -240,7 +235,7 @@
iomemtype = cpu_register_io_memory(0, mst_fpga_readfn,
mst_fpga_writefn, s);
- cpu_register_physical_memory(MST_BASE, 0x00100000, iomemtype);
+ cpu_register_physical_memory(base, 0x00100000, iomemtype);
register_savevm("mainstone_fpga", 0, 0, mst_fpga_save, mst_fpga_load, s);
return qi;
}