xref: /openbmc/qemu/hw/nubus/mac-nubus-bridge.c (revision a68694cd)
1 /*
2  *  Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
3  *
4  * This work is licensed under the terms of the GNU GPL, version 2 or later.
5  * See the COPYING file in the top-level directory.
6  *
7  */
8 
9 #include "qemu/osdep.h"
10 #include "hw/sysbus.h"
11 #include "hw/nubus/mac-nubus-bridge.h"
12 
13 
14 static void mac_nubus_bridge_init(Object *obj)
15 {
16     MacNubusState *s = MAC_NUBUS_BRIDGE(obj);
17     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
18 
19     s->bus = NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL));
20 
21     sysbus_init_mmio(sbd, &s->bus->super_slot_io);
22     sysbus_init_mmio(sbd, &s->bus->slot_io);
23 }
24 
25 static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data)
26 {
27     DeviceClass *dc = DEVICE_CLASS(klass);
28 
29     dc->desc = "Nubus bridge";
30 }
31 
32 static const TypeInfo mac_nubus_bridge_info = {
33     .name          = TYPE_MAC_NUBUS_BRIDGE,
34     .parent        = TYPE_NUBUS_BRIDGE,
35     .instance_init = mac_nubus_bridge_init,
36     .instance_size = sizeof(MacNubusState),
37     .class_init    = mac_nubus_bridge_class_init,
38 };
39 
40 static void mac_nubus_bridge_register_types(void)
41 {
42     type_register_static(&mac_nubus_bridge_info);
43 }
44 
45 type_init(mac_nubus_bridge_register_types)
46