target/arm: Tidy scr_write
[qemu/ar7.git] / hw / s390x / virtio-ccw-input.c
blob79c87cb3f2f4de036e6fbe55a78008dc4955bcbe
1 /*
2 * virtio ccw scsi implementation
4 * Copyright 2012, 2015 IBM Corp.
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 */
11 #include "qemu/osdep.h"
12 #include "hw/virtio/virtio.h"
13 #include "qapi/error.h"
14 #include "virtio-ccw.h"
16 static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
18 VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
19 DeviceState *vdev = DEVICE(&dev->vdev);
21 qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
22 object_property_set_bool(OBJECT(vdev), true, "realized", errp);
25 static Property virtio_ccw_input_properties[] = {
26 DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
27 VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
28 DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
29 VIRTIO_CCW_MAX_REV),
30 DEFINE_PROP_END_OF_LIST(),
33 static void virtio_ccw_input_class_init(ObjectClass *klass, void *data)
35 DeviceClass *dc = DEVICE_CLASS(klass);
36 VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
38 k->realize = virtio_ccw_input_realize;
39 dc->props = virtio_ccw_input_properties;
40 set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
43 static void virtio_ccw_keyboard_instance_init(Object *obj)
45 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
46 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
48 ccw_dev->force_revision_1 = true;
49 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
50 TYPE_VIRTIO_KEYBOARD);
53 static void virtio_ccw_mouse_instance_init(Object *obj)
55 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
56 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
58 ccw_dev->force_revision_1 = true;
59 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
60 TYPE_VIRTIO_MOUSE);
63 static void virtio_ccw_tablet_instance_init(Object *obj)
65 VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
66 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
68 ccw_dev->force_revision_1 = true;
69 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
70 TYPE_VIRTIO_TABLET);
73 static const TypeInfo virtio_ccw_input = {
74 .name = TYPE_VIRTIO_INPUT_CCW,
75 .parent = TYPE_VIRTIO_CCW_DEVICE,
76 .instance_size = sizeof(VirtIOInputCcw),
77 .class_init = virtio_ccw_input_class_init,
78 .abstract = true,
81 static const TypeInfo virtio_ccw_input_hid = {
82 .name = TYPE_VIRTIO_INPUT_HID_CCW,
83 .parent = TYPE_VIRTIO_INPUT_CCW,
84 .instance_size = sizeof(VirtIOInputHIDCcw),
85 .abstract = true,
88 static const TypeInfo virtio_ccw_keyboard = {
89 .name = TYPE_VIRTIO_KEYBOARD_CCW,
90 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
91 .instance_size = sizeof(VirtIOInputHIDCcw),
92 .instance_init = virtio_ccw_keyboard_instance_init,
95 static const TypeInfo virtio_ccw_mouse = {
96 .name = TYPE_VIRTIO_MOUSE_CCW,
97 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
98 .instance_size = sizeof(VirtIOInputHIDCcw),
99 .instance_init = virtio_ccw_mouse_instance_init,
102 static const TypeInfo virtio_ccw_tablet = {
103 .name = TYPE_VIRTIO_TABLET_CCW,
104 .parent = TYPE_VIRTIO_INPUT_HID_CCW,
105 .instance_size = sizeof(VirtIOInputHIDCcw),
106 .instance_init = virtio_ccw_tablet_instance_init,
109 static void virtio_ccw_input_register(void)
111 type_register_static(&virtio_ccw_input);
112 type_register_static(&virtio_ccw_input_hid);
113 type_register_static(&virtio_ccw_keyboard);
114 type_register_static(&virtio_ccw_mouse);
115 type_register_static(&virtio_ccw_tablet);
118 type_init(virtio_ccw_input_register)