block: Typo fix in copy_on_readv()
[qemu/kevin.git] / hw / s390x / ccw-device.c
blobf9bfa154d6c95ec89f54158e0276bb47bae03471
1 /*
2 * Common device infrastructure for devices in the virtual css
4 * Copyright 2016 IBM Corp.
5 * Author(s): Jing Liu <liujbjl@linux.vnet.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2 or (at
8 * your option) any later version. See the COPYING file in the top-level
9 * directory.
11 #include "qemu/osdep.h"
12 #include "ccw-device.h"
14 static void ccw_device_refill_ids(CcwDevice *dev)
16 SubchDev *sch = dev->sch;
18 assert(sch);
20 dev->dev_id.cssid = sch->cssid;
21 dev->dev_id.ssid = sch->ssid;
22 dev->dev_id.devid = sch->devno;
23 dev->dev_id.valid = true;
25 dev->subch_id.cssid = sch->cssid;
26 dev->subch_id.ssid = sch->ssid;
27 dev->subch_id.devid = sch->schid;
28 dev->subch_id.valid = true;
31 static void ccw_device_realize(CcwDevice *dev, Error **errp)
33 ccw_device_refill_ids(dev);
36 static Property ccw_device_properties[] = {
37 DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno),
38 DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id),
39 DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id),
40 DEFINE_PROP_END_OF_LIST(),
43 static void ccw_device_class_init(ObjectClass *klass, void *data)
45 DeviceClass *dc = DEVICE_CLASS(klass);
46 CCWDeviceClass *k = CCW_DEVICE_CLASS(klass);
48 k->realize = ccw_device_realize;
49 k->refill_ids = ccw_device_refill_ids;
50 dc->props = ccw_device_properties;
53 const VMStateDescription vmstate_ccw_dev = {
54 .name = "s390_ccw_dev",
55 .version_id = 1,
56 .minimum_version_id = 1,
57 .fields = (VMStateField[]) {
58 VMSTATE_STRUCT_POINTER(sch, CcwDevice, vmstate_subch_dev, SubchDev),
59 VMSTATE_END_OF_LIST()
63 static const TypeInfo ccw_device_info = {
64 .name = TYPE_CCW_DEVICE,
65 .parent = TYPE_DEVICE,
66 .instance_size = sizeof(CcwDevice),
67 .class_size = sizeof(CCWDeviceClass),
68 .class_init = ccw_device_class_init,
69 .abstract = true,
72 static void ccw_device_register(void)
74 type_register_static(&ccw_device_info);
77 type_init(ccw_device_register)