According to "Designing Cards and Drivers for the Macintosh Family" the
Nubus
has its own 32-bit address space based upon physical slot addressing.
Move Nubus to its own 32-bit address space and then use memory region
aliases
to map available slot and super slot ranges into the q800 system address
space via the Macintosh Nubus bridge.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/m68k/q800.c | 8 +++-----
hw/nubus/mac-nubus-bridge.c | 15 +++++++++++++--
hw/nubus/nubus-bus.c | 18 ++++++++++++++++++
hw/nubus/nubus-device.c | 2 +-
include/hw/nubus/mac-nubus-bridge.h | 2 ++
include/hw/nubus/nubus.h | 10 +++++++---
6 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 5ba87f789c..0a0051a296 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -67,9 +67,6 @@
#define ASC_BASE (IO_BASE + 0x14000)
#define SWIM_BASE (IO_BASE + 0x1E000)
-#define NUBUS_SUPER_SLOT_BASE 0x60000000
-#define NUBUS_SLOT_BASE 0xf0000000
-
#define SONIC_PROM_SIZE 0x1000
/*
@@ -396,8 +393,9 @@ static void q800_init(MachineState *machine)
dev = qdev_new(TYPE_MAC_NUBUS_BRIDGE);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, NUBUS_SUPER_SLOT_BASE);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +
+ 9 * NUBUS_SLOT_SIZE);
nubus = MAC_NUBUS_BRIDGE(dev)->bus;
diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c
index c1d77e2bc7..574bc7831e 100644
--- a/hw/nubus/mac-nubus-bridge.c
+++ b/hw/nubus/mac-nubus-bridge.c
@@ -21,8 +21,19 @@ static void mac_nubus_bridge_init(Object *obj)
/* Macintosh only has slots 0x9 to 0xe available */
s->bus->slot_available_mask = MAKE_64BIT_MASK(9, 6);
- sysbus_init_mmio(sbd, &s->bus->super_slot_io);
- sysbus_init_mmio(sbd, &s->bus->slot_io);
+ /* Aliases for slots 0x9 to 0xe */
+ memory_region_init_alias(&s->super_slot_alias, obj,
"super-slot-alias",
+ &s->bus->nubus_mr,
+ 9 * NUBUS_SUPER_SLOT_SIZE,
+ 6 * NUBUS_SUPER_SLOT_SIZE);