nubus-bridge: embed the NubusBus object directly within nubus-bridge

Since nubus-bridge is a container for NubusBus then it should be embedded
directly within the bridge device using qbus_create_inplace().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210924073808.1041-17-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Mark Cave-Ayland 2021-09-24 08:38:04 +01:00 committed by Laurent Vivier
parent 1fa04232db
commit d585d89de1
4 changed files with 9 additions and 7 deletions

View File

@ -398,7 +398,7 @@ static void q800_init(MachineState *machine)
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +
MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE);
nubus = NUBUS_BRIDGE(dev)->bus;
nubus = &NUBUS_BRIDGE(dev)->bus;
/* framebuffer in nubus slot #9 */

View File

@ -18,19 +18,20 @@ static void mac_nubus_bridge_init(Object *obj)
MacNubusBridge *s = MAC_NUBUS_BRIDGE(obj);
NubusBridge *nb = NUBUS_BRIDGE(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
NubusBus *bus = &nb->bus;
/* Macintosh only has slots 0x9 to 0xe available */
nb->bus->slot_available_mask = MAKE_64BIT_MASK(MAC_NUBUS_FIRST_SLOT,
MAC_NUBUS_SLOT_NB);
bus->slot_available_mask = MAKE_64BIT_MASK(MAC_NUBUS_FIRST_SLOT,
MAC_NUBUS_SLOT_NB);
/* Aliases for slots 0x9 to 0xe */
memory_region_init_alias(&s->super_slot_alias, obj, "super-slot-alias",
&nb->bus->nubus_mr,
&bus->nubus_mr,
MAC_NUBUS_FIRST_SLOT * NUBUS_SUPER_SLOT_SIZE,
MAC_NUBUS_SLOT_NB * NUBUS_SUPER_SLOT_SIZE);
memory_region_init_alias(&s->slot_alias, obj, "slot-alias",
&nb->bus->nubus_mr,
&bus->nubus_mr,
NUBUS_SLOT_BASE +
MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE,
MAC_NUBUS_SLOT_NB * NUBUS_SLOT_SIZE);

View File

@ -16,8 +16,9 @@
static void nubus_bridge_init(Object *obj)
{
NubusBridge *s = NUBUS_BRIDGE(obj);
NubusBus *bus = &s->bus;
s->bus = NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL));
qbus_create_inplace(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NULL);
}
static void nubus_bridge_class_init(ObjectClass *klass, void *data)

View File

@ -63,7 +63,7 @@ struct NubusDevice {
struct NubusBridge {
SysBusDevice parent_obj;
NubusBus *bus;
NubusBus bus;
};
#endif