build: add pc-bios to config-host.mak deps
[qemu.git] / hw / intc / s390_flic.c
blob6ab29efc65314f8a5f00e73e0a1cc09447d7abf8
1 /*
2 * QEMU S390x floating interrupt controller (flic)
4 * Copyright 2014 IBM Corp.
5 * Author(s): Jens Freimann <jfrei@linux.vnet.ibm.com>
6 * Cornelia Huck <cornelia.huck@de.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
13 #include "qemu/osdep.h"
14 #include "qemu/error-report.h"
15 #include "hw/sysbus.h"
16 #include "migration/qemu-file.h"
17 #include "hw/s390x/s390_flic.h"
18 #include "trace.h"
20 S390FLICState *s390_get_flic(void)
22 S390FLICState *fs;
24 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
25 if (!fs) {
26 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL));
28 return fs;
31 void s390_flic_init(void)
33 DeviceState *dev;
35 dev = s390_flic_kvm_create();
36 if (!dev) {
37 dev = qdev_create(NULL, TYPE_QEMU_S390_FLIC);
38 object_property_add_child(qdev_get_machine(), TYPE_QEMU_S390_FLIC,
39 OBJECT(dev), NULL);
41 qdev_init_nofail(dev);
44 static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
45 uint8_t isc, bool swap,
46 bool is_maskable)
48 /* nothing to do */
49 return 0;
52 static int qemu_s390_io_adapter_map(S390FLICState *fs, uint32_t id,
53 uint64_t map_addr, bool do_map)
55 /* nothing to do */
56 return 0;
59 static int qemu_s390_add_adapter_routes(S390FLICState *fs,
60 AdapterRoutes *routes)
62 return -ENOSYS;
65 static void qemu_s390_release_adapter_routes(S390FLICState *fs,
66 AdapterRoutes *routes)
70 static int qemu_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_id,
71 uint16_t subchannel_nr)
73 /* Fixme TCG */
74 return -ENOSYS;
77 static void qemu_s390_flic_class_init(ObjectClass *oc, void *data)
79 S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
81 fsc->register_io_adapter = qemu_s390_register_io_adapter;
82 fsc->io_adapter_map = qemu_s390_io_adapter_map;
83 fsc->add_adapter_routes = qemu_s390_add_adapter_routes;
84 fsc->release_adapter_routes = qemu_s390_release_adapter_routes;
85 fsc->clear_io_irq = qemu_s390_clear_io_flic;
88 static const TypeInfo qemu_s390_flic_info = {
89 .name = TYPE_QEMU_S390_FLIC,
90 .parent = TYPE_S390_FLIC_COMMON,
91 .instance_size = sizeof(QEMUS390FLICState),
92 .class_init = qemu_s390_flic_class_init,
95 static const TypeInfo s390_flic_common_info = {
96 .name = TYPE_S390_FLIC_COMMON,
97 .parent = TYPE_SYS_BUS_DEVICE,
98 .instance_size = sizeof(S390FLICState),
99 .class_size = sizeof(S390FLICStateClass),
102 static void qemu_s390_flic_register_types(void)
104 type_register_static(&s390_flic_common_info);
105 type_register_static(&qemu_s390_flic_info);
108 type_init(qemu_s390_flic_register_types)