xref: /qemu/hw/nubus/nubus-bridge.c (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
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 
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 const Property nubus_bridge_properties[] = {
27     DEFINE_PROP_UINT16("slot-available-mask", NubusBridge,
28                        bus.slot_available_mask, 0xffff),
29 };
30 
31 static void nubus_bridge_class_init(ObjectClass *klass, void *data)
32 {
33     DeviceClass *dc = DEVICE_CLASS(klass);
34 
35     dc->fw_name = "nubus";
36     device_class_set_props(dc, nubus_bridge_properties);
37 }
38 
39 static const TypeInfo nubus_bridge_info = {
40     .name          = TYPE_NUBUS_BRIDGE,
41     .parent        = TYPE_SYS_BUS_DEVICE,
42     .instance_init = nubus_bridge_init,
43     .instance_size = sizeof(NubusBridge),
44     .class_init    = nubus_bridge_class_init,
45 };
46 
47 static void nubus_register_types(void)
48 {
49     type_register_static(&nubus_bridge_info);
50 }
51 
52 type_init(nubus_register_types)
53