1 /*
2 * QEMU Nubus
3 *
4 * Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
5 *
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.
8 *
9 */
10
11 #include "qemu/osdep.h"
12 #include "hw/sysbus.h"
13 #include "hw/nubus/nubus.h"
14
15
nubus_bridge_init(Object * obj)16 static void nubus_bridge_init(Object *obj)
17 {
18 NubusBridge *s = NUBUS_BRIDGE(obj);
19 NubusBus *bus = &s->bus;
20
21 qbus_init(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NULL);
22
23 qdev_init_gpio_out(DEVICE(s), bus->irqs, NUBUS_IRQS);
24 }
25
26 static Property nubus_bridge_properties[] = {
27 DEFINE_PROP_UINT16("slot-available-mask", NubusBridge,
28 bus.slot_available_mask, 0xffff),
29 DEFINE_PROP_END_OF_LIST()
30 };
31
nubus_bridge_class_init(ObjectClass * klass,void * data)32 static void nubus_bridge_class_init(ObjectClass *klass, void *data)
33 {
34 DeviceClass *dc = DEVICE_CLASS(klass);
35
36 dc->fw_name = "nubus";
37 device_class_set_props(dc, nubus_bridge_properties);
38 }
39
40 static const TypeInfo nubus_bridge_info = {
41 .name = TYPE_NUBUS_BRIDGE,
42 .parent = TYPE_SYS_BUS_DEVICE,
43 .instance_init = nubus_bridge_init,
44 .instance_size = sizeof(NubusBridge),
45 .class_init = nubus_bridge_class_init,
46 };
47
nubus_register_types(void)48 static void nubus_register_types(void)
49 {
50 type_register_static(&nubus_bridge_info);
51 }
52
53 type_init(nubus_register_types)
54