nubus-bridge.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "qemu/osdep.h"
  11. #include "hw/sysbus.h"
  12. #include "hw/nubus/nubus.h"
  13. static void nubus_bridge_init(Object *obj)
  14. {
  15. NubusBridge *s = NUBUS_BRIDGE(obj);
  16. NubusBus *bus = &s->bus;
  17. qbus_init(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NULL);
  18. qdev_init_gpio_out(DEVICE(s), bus->irqs, NUBUS_IRQS);
  19. }
  20. static const Property nubus_bridge_properties[] = {
  21. DEFINE_PROP_UINT16("slot-available-mask", NubusBridge,
  22. bus.slot_available_mask, 0xffff),
  23. };
  24. static void nubus_bridge_class_init(ObjectClass *klass, void *data)
  25. {
  26. DeviceClass *dc = DEVICE_CLASS(klass);
  27. dc->fw_name = "nubus";
  28. device_class_set_props(dc, nubus_bridge_properties);
  29. }
  30. static const TypeInfo nubus_bridge_info = {
  31. .name = TYPE_NUBUS_BRIDGE,
  32. .parent = TYPE_SYS_BUS_DEVICE,
  33. .instance_init = nubus_bridge_init,
  34. .instance_size = sizeof(NubusBridge),
  35. .class_init = nubus_bridge_class_init,
  36. };
  37. static void nubus_register_types(void)
  38. {
  39. type_register_static(&nubus_bridge_info);
  40. }
  41. type_init(nubus_register_types)