hw/arm/bcm2836: Only provide "enabled-cpus" property to multicore SoCs
[qemu.git] / hw / s390x / virtio-ccw-input.c
1 /*
2 * virtio ccw input implementation
3 *
4 * Copyright 2012, 2015 IBM Corp.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or (at
7 * your option) any later version. See the COPYING file in the top-level
8 * directory.
9 */
10
11 #include "qemu/osdep.h"
12 #include "hw/qdev-properties.h"
13 #include "hw/virtio/virtio.h"
14 #include "qapi/error.h"
15 #include "qemu/module.h"
16 #include "virtio-ccw.h"
17
18 static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
19 {
20 VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
21 DeviceState *vdev = DEVICE(&dev->vdev);
22
23 qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
24 }
25
26 static Property virtio_ccw_input_properties[] = {
27 DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
28 VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
29 DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
30 VIRTIO_CCW_MAX_REV),
31 DEFINE_PROP_END_OF_LIST(),
32 };
33
34 static void virtio_ccw_input_class_init(ObjectClass *klass, void *data)
35 {
36 DeviceClass *dc = DEVICE_CLASS(klass);
37 VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
38
39 k->realize = virtio_ccw_input_realize;
40 device_class_set_props(dc, virtio_ccw_input_properties);
41 set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
42 }
43
44 static void virtio_ccw_keyboard_instance_init(Object *obj)
45 {
46 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
47 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
48
49 ccw_dev->force_revision_1 = true;
50 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
51 TYPE_VIRTIO_KEYBOARD);
52 }
53
54 static void virtio_ccw_mouse_instance_init(Object *obj)
55 {
56 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
57 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
58
59 ccw_dev->force_revision_1 = true;
60 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
61 TYPE_VIRTIO_MOUSE);
62 }
63
64 static void virtio_ccw_tablet_instance_init(Object *obj)
65 {
66 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
67 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
68
69 ccw_dev->force_revision_1 = true;
70 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
71 TYPE_VIRTIO_TABLET);
72 }
73
74 static const TypeInfo virtio_ccw_input = {
75 .name = TYPE_VIRTIO_INPUT_CCW,
76 .parent = TYPE_VIRTIO_CCW_DEVICE,
77 .instance_size = sizeof(VirtIOInputCcw),
78 .class_init = virtio_ccw_input_class_init,
79 .abstract = true,
80 };
81
82 static const TypeInfo virtio_ccw_input_hid = {
83 .name = TYPE_VIRTIO_INPUT_HID_CCW,
84 .parent = TYPE_VIRTIO_INPUT_CCW,
85 .instance_size = sizeof(VirtIOInputHIDCcw),
86 .abstract = true,
87 };
88
89 static const TypeInfo virtio_ccw_keyboard = {
90 .name = TYPE_VIRTIO_KEYBOARD_CCW,
91 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
92 .instance_size = sizeof(VirtIOInputHIDCcw),
93 .instance_init = virtio_ccw_keyboard_instance_init,
94 };
95
96 static const TypeInfo virtio_ccw_mouse = {
97 .name = TYPE_VIRTIO_MOUSE_CCW,
98 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
99 .instance_size = sizeof(VirtIOInputHIDCcw),
100 .instance_init = virtio_ccw_mouse_instance_init,
101 };
102
103 static const TypeInfo virtio_ccw_tablet = {
104 .name = TYPE_VIRTIO_TABLET_CCW,
105 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
106 .instance_size = sizeof(VirtIOInputHIDCcw),
107 .instance_init = virtio_ccw_tablet_instance_init,
108 };
109
110 static void virtio_ccw_input_register(void)
111 {
112 type_register_static(&virtio_ccw_input);
113 type_register_static(&virtio_ccw_input_hid);
114 type_register_static(&virtio_ccw_keyboard);
115 type_register_static(&virtio_ccw_mouse);
116 type_register_static(&virtio_ccw_tablet);
117 }
118
119 type_init(virtio_ccw_input_register)