target/xtensa: gdbstub: drop dead return statement
[qemu/ar7.git] / hw / intc / s390_flic.c
blob837158bdafbf2918f9330e94aa75be4194739731
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 "hw/s390x/s390_flic.h"
17 #include "trace.h"
18 #include "hw/qdev.h"
19 #include "qapi/error.h"
20 #include "hw/s390x/s390-virtio-ccw.h"
22 S390FLICState *s390_get_flic(void)
24 static S390FLICState *fs;
26 if (!fs) {
27 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
28 if (!fs) {
29 fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC,
30 NULL));
33 return fs;
36 void s390_flic_init(void)
38 DeviceState *dev;
40 dev = s390_flic_kvm_create();
41 if (!dev) {
42 dev = qdev_create(NULL, TYPE_QEMU_S390_FLIC);
43 object_property_add_child(qdev_get_machine(), TYPE_QEMU_S390_FLIC,
44 OBJECT(dev), NULL);
46 qdev_init_nofail(dev);
49 static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
50 uint8_t isc, bool swap,
51 bool is_maskable)
53 /* nothing to do */
54 return 0;
57 static int qemu_s390_io_adapter_map(S390FLICState *fs, uint32_t id,
58 uint64_t map_addr, bool do_map)
60 /* nothing to do */
61 return 0;
64 static int qemu_s390_add_adapter_routes(S390FLICState *fs,
65 AdapterRoutes *routes)
67 return -ENOSYS;
70 static void qemu_s390_release_adapter_routes(S390FLICState *fs,
71 AdapterRoutes *routes)
75 static int qemu_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_id,
76 uint16_t subchannel_nr)
78 /* Fixme TCG */
79 return -ENOSYS;
82 static void qemu_s390_flic_class_init(ObjectClass *oc, void *data)
84 S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
86 fsc->register_io_adapter = qemu_s390_register_io_adapter;
87 fsc->io_adapter_map = qemu_s390_io_adapter_map;
88 fsc->add_adapter_routes = qemu_s390_add_adapter_routes;
89 fsc->release_adapter_routes = qemu_s390_release_adapter_routes;
90 fsc->clear_io_irq = qemu_s390_clear_io_flic;
93 static Property s390_flic_common_properties[] = {
94 DEFINE_PROP_UINT32("adapter_routes_max_batch", S390FLICState,
95 adapter_routes_max_batch, ADAPTER_ROUTES_MAX_GSI),
96 DEFINE_PROP_END_OF_LIST(),
99 static void s390_flic_common_realize(DeviceState *dev, Error **errp)
101 uint32_t max_batch = S390_FLIC_COMMON(dev)->adapter_routes_max_batch;
103 if (max_batch > ADAPTER_ROUTES_MAX_GSI) {
104 error_setg(errp, "flic property adapter_routes_max_batch too big"
105 " (%d > %d)", max_batch, ADAPTER_ROUTES_MAX_GSI);
109 static void s390_flic_class_init(ObjectClass *oc, void *data)
111 DeviceClass *dc = DEVICE_CLASS(oc);
113 dc->props = s390_flic_common_properties;
114 dc->realize = s390_flic_common_realize;
117 static const TypeInfo qemu_s390_flic_info = {
118 .name = TYPE_QEMU_S390_FLIC,
119 .parent = TYPE_S390_FLIC_COMMON,
120 .instance_size = sizeof(QEMUS390FLICState),
121 .class_init = qemu_s390_flic_class_init,
125 static const TypeInfo s390_flic_common_info = {
126 .name = TYPE_S390_FLIC_COMMON,
127 .parent = TYPE_SYS_BUS_DEVICE,
128 .instance_size = sizeof(S390FLICState),
129 .class_init = s390_flic_class_init,
130 .class_size = sizeof(S390FLICStateClass),
133 static void qemu_s390_flic_register_types(void)
135 type_register_static(&s390_flic_common_info);
136 type_register_static(&qemu_s390_flic_info);
139 type_init(qemu_s390_flic_register_types)
141 const VMStateDescription vmstate_adapter_info = {
142 .name = "s390_adapter_info",
143 .version_id = 1,
144 .minimum_version_id = 1,
145 .fields = (VMStateField[]) {
146 VMSTATE_UINT64(ind_offset, AdapterInfo),
148 * We do not have to migrate neither the id nor the addresses.
149 * The id is set by css_register_io_adapter and the addresses
150 * are set based on the IndAddr objects after those get mapped.
152 VMSTATE_END_OF_LIST()
156 const VMStateDescription vmstate_adapter_routes = {
158 .name = "s390_adapter_routes",
159 .version_id = 1,
160 .minimum_version_id = 1,
161 .fields = (VMStateField[]) {
162 VMSTATE_STRUCT(adapter, AdapterRoutes, 1, vmstate_adapter_info,
163 AdapterInfo),
164 VMSTATE_END_OF_LIST()