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
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"
19 DeviceState parent_obj
;
21 /* <cssid>.<ssid>.<device number> */
22 /* The user-set busid of the virtual ccw device. */
24 /* The actual busid of the virtual ccw device. */
26 /* The actual busid of the virtual subchannel. */
29 typedef struct CcwDevice CcwDevice
;
31 extern const VMStateDescription vmstate_ccw_dev
;
32 #define VMSTATE_CCW_DEVICE(_field, _state) \
33 VMSTATE_STRUCT(_field, _state, 1, vmstate_ccw_dev, CcwDevice)
35 struct CCWDeviceClass
{
36 DeviceClass parent_class
;
37 void (*unplug
)(HotplugHandler
*, DeviceState
*, Error
**);
38 void (*realize
)(CcwDevice
*, Error
**);
39 void (*refill_ids
)(CcwDevice
*);
41 typedef struct CCWDeviceClass CCWDeviceClass
;
43 static inline CcwDevice
*to_ccw_dev_fast(DeviceState
*d
)
45 return container_of(d
, CcwDevice
, parent_obj
);
48 #define TYPE_CCW_DEVICE "ccw-device"
50 DECLARE_OBJ_CHECKERS(CcwDevice
, CCWDeviceClass
,
51 CCW_DEVICE
, TYPE_CCW_DEVICE
)