armv7m: Classify faults as MemManage or BusFault
[qemu/ar7.git] / hw / s390x / ccw-device.c
blobfb8d640a7e89f1e3eee43862b586e3909a6d0bf5
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 static const TypeInfo ccw_device_info = {
54 .name = TYPE_CCW_DEVICE,
55 .parent = TYPE_DEVICE,
56 .instance_size = sizeof(CcwDevice),
57 .class_size = sizeof(CCWDeviceClass),
58 .class_init = ccw_device_class_init,
59 .abstract = true,
62 static void ccw_device_register(void)
64 type_register_static(&ccw_device_info);
67 type_init(ccw_device_register)