]> git.proxmox.com Git - mirror_qemu.git/blame - hw/s390x/ccw-device.h
s390x/pv: Implement a CGS check helper
[mirror_qemu.git] / hw / s390x / ccw-device.h
CommitLineData
b804e8a6
JL
1/*
2 * Common device infrastructure for devices in the virtual css
3 *
4 * Copyright 2016 IBM Corp.
5 * Author(s): Jing Liu <liujbjl@linux.vnet.ibm.com>
6 *
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.
10 */
11
12#ifndef HW_S390X_CCW_DEVICE_H
13#define HW_S390X_CCW_DEVICE_H
14#include "qom/object.h"
15#include "hw/qdev-core.h"
16#include "hw/s390x/css.h"
a6d8b731 17#include "hw/s390x/css-bridge.h"
b804e8a6 18
db1015e9 19struct CcwDevice {
b804e8a6
JL
20 DeviceState parent_obj;
21 SubchDev *sch;
22 /* <cssid>.<ssid>.<device number> */
d8d98db5 23 /* The user-set busid of the virtual ccw device. */
2a78ac66 24 CssDevId devno;
d8d98db5
DJS
25 /* The actual busid of the virtual ccw device. */
26 CssDevId dev_id;
27 /* The actual busid of the virtual subchannel. */
28 CssDevId subch_id;
db1015e9
EH
29};
30typedef struct CcwDevice CcwDevice;
b804e8a6 31
517ff12c
HP
32extern const VMStateDescription vmstate_ccw_dev;
33#define VMSTATE_CCW_DEVICE(_field, _state) \
34 VMSTATE_STRUCT(_field, _state, 1, vmstate_ccw_dev, CcwDevice)
35
db1015e9 36struct CCWDeviceClass {
b804e8a6
JL
37 DeviceClass parent_class;
38 void (*unplug)(HotplugHandler *, DeviceState *, Error **);
d8d98db5
DJS
39 void (*realize)(CcwDevice *, Error **);
40 void (*refill_ids)(CcwDevice *);
db1015e9 41};
b804e8a6
JL
42
43static inline CcwDevice *to_ccw_dev_fast(DeviceState *d)
44{
45 return container_of(d, CcwDevice, parent_obj);
46}
47
48#define TYPE_CCW_DEVICE "ccw-device"
49
a489d195 50OBJECT_DECLARE_TYPE(CcwDevice, CCWDeviceClass, CCW_DEVICE)
b804e8a6
JL
51
52#endif