Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / hw / nubus / mac-nubus-bridge.c
bloba0da5a8b2fafb90e65c968ce67635f1fb36aa2ae
1 /*
2 * QEMU Macintosh Nubus
4 * Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #include "qemu/osdep.h"
12 #include "hw/sysbus.h"
13 #include "hw/nubus/mac-nubus-bridge.h"
16 static void mac_nubus_bridge_init(Object *obj)
18 MacNubusBridge *s = MAC_NUBUS_BRIDGE(obj);
19 NubusBridge *nb = NUBUS_BRIDGE(obj);
20 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
21 NubusBus *bus = &nb->bus;
23 /* Macintosh only has slots 0x9 to 0xe available */
24 bus->slot_available_mask = MAKE_64BIT_MASK(MAC_NUBUS_FIRST_SLOT,
25 MAC_NUBUS_SLOT_NB);
27 /* Aliases for slots 0x9 to 0xe */
28 memory_region_init_alias(&s->super_slot_alias, obj, "super-slot-alias",
29 &bus->nubus_mr,
30 MAC_NUBUS_FIRST_SLOT * NUBUS_SUPER_SLOT_SIZE,
31 MAC_NUBUS_SLOT_NB * NUBUS_SUPER_SLOT_SIZE);
33 memory_region_init_alias(&s->slot_alias, obj, "slot-alias",
34 &bus->nubus_mr,
35 NUBUS_SLOT_BASE +
36 MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE,
37 MAC_NUBUS_SLOT_NB * NUBUS_SLOT_SIZE);
39 sysbus_init_mmio(sbd, &s->super_slot_alias);
40 sysbus_init_mmio(sbd, &s->slot_alias);
43 static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data)
45 DeviceClass *dc = DEVICE_CLASS(klass);
47 dc->desc = "Nubus bridge";
50 static const TypeInfo mac_nubus_bridge_info = {
51 .name = TYPE_MAC_NUBUS_BRIDGE,
52 .parent = TYPE_NUBUS_BRIDGE,
53 .instance_init = mac_nubus_bridge_init,
54 .instance_size = sizeof(MacNubusBridge),
55 .class_init = mac_nubus_bridge_class_init,
58 static void mac_nubus_bridge_register_types(void)
60 type_register_static(&mac_nubus_bridge_info);
63 type_init(mac_nubus_bridge_register_types)