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.
11 #include "qemu/osdep.h"
12 #include "hw/sysbus.h"
13 #include "hw/nubus/nubus.h"
16 static void nubus_bridge_init(Object
*obj
)
18 NubusBridge
*s
= NUBUS_BRIDGE(obj
);
19 NubusBus
*bus
= &s
->bus
;
21 qbus_init(bus
, sizeof(s
->bus
), TYPE_NUBUS_BUS
, DEVICE(s
), NULL
);
23 qdev_init_gpio_out(DEVICE(s
), bus
->irqs
, NUBUS_IRQS
);
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()
32 static void nubus_bridge_class_init(ObjectClass
*klass
, void *data
)
34 DeviceClass
*dc
= DEVICE_CLASS(klass
);
36 dc
->fw_name
= "nubus";
37 device_class_set_props(dc
, nubus_bridge_properties
);
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
,
48 static void nubus_register_types(void)
50 type_register_static(&nubus_bridge_info
);
53 type_init(nubus_register_types
)