target-i386: cleanup x86_cpu_get_phys_page_debug
[qemu.git] / hw / intc / s390_flic.c
blob03c5e89f4eae420d66fdf900f628d30b2deb7531
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/error-report.h"
14 #include "hw/sysbus.h"
15 #include "migration/qemu-file.h"
16 #include "hw/s390x/s390_flic.h"
17 #include "trace.h"
19 S390FLICState *s390_get_flic(void)
21 S390FLICState *fs;
23 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
24 if (!fs) {
25 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL));
27 return fs;
30 void s390_flic_init(void)
32 DeviceState *dev;
33 int r;
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 r = qdev_init(dev);
42 if (r) {
43 error_report("flic: couldn't create qdev");
47 static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
48 uint8_t isc, bool swap,
49 bool is_maskable)
51 /* nothing to do */
52 return 0;
55 static int qemu_s390_io_adapter_map(S390FLICState *fs, uint32_t id,
56 uint64_t map_addr, bool do_map)
58 /* nothing to do */
59 return 0;
62 static int qemu_s390_add_adapter_routes(S390FLICState *fs,
63 AdapterRoutes *routes)
65 return -ENOSYS;
68 static void qemu_s390_release_adapter_routes(S390FLICState *fs,
69 AdapterRoutes *routes)
73 static void qemu_s390_flic_class_init(ObjectClass *oc, void *data)
75 S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
77 fsc->register_io_adapter = qemu_s390_register_io_adapter;
78 fsc->io_adapter_map = qemu_s390_io_adapter_map;
79 fsc->add_adapter_routes = qemu_s390_add_adapter_routes;
80 fsc->release_adapter_routes = qemu_s390_release_adapter_routes;
83 static const TypeInfo qemu_s390_flic_info = {
84 .name = TYPE_QEMU_S390_FLIC,
85 .parent = TYPE_S390_FLIC_COMMON,
86 .instance_size = sizeof(QEMUS390FLICState),
87 .class_init = qemu_s390_flic_class_init,
90 static const TypeInfo s390_flic_common_info = {
91 .name = TYPE_S390_FLIC_COMMON,
92 .parent = TYPE_SYS_BUS_DEVICE,
93 .instance_size = sizeof(S390FLICState),
94 .class_size = sizeof(S390FLICStateClass),
97 static void qemu_s390_flic_register_types(void)
99 type_register_static(&s390_flic_common_info);
100 type_register_static(&qemu_s390_flic_info);
103 type_init(qemu_s390_flic_register_types)