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