virtio-ccw: Wire up virtio-rng.
[qemu/ar7.git] / hw / s390x / virtio-ccw.h
blob88c46c081bab00a2ce5dd256280981f422b06648
1 /*
2 * virtio ccw target definitions
4 * Copyright 2012 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.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.
12 #ifndef HW_S390X_VIRTIO_CCW_H
13 #define HW_S390X_VIRTIO_CCW_H
15 #include <hw/virtio-blk.h>
16 #include <hw/virtio-net.h>
17 #include <hw/virtio-serial.h>
18 #include <hw/virtio-scsi.h>
19 #include <hw/virtio-rng.h>
20 #include <hw/virtio-bus.h>
22 #define VIRTUAL_CSSID 0xfe
24 #define VIRTIO_CCW_CU_TYPE 0x3832
25 #define VIRTIO_CCW_CHPID_TYPE 0x32
27 #define CCW_CMD_SET_VQ 0x13
28 #define CCW_CMD_VDEV_RESET 0x33
29 #define CCW_CMD_READ_FEAT 0x12
30 #define CCW_CMD_WRITE_FEAT 0x11
31 #define CCW_CMD_READ_CONF 0x22
32 #define CCW_CMD_WRITE_CONF 0x21
33 #define CCW_CMD_WRITE_STATUS 0x31
34 #define CCW_CMD_SET_IND 0x43
35 #define CCW_CMD_SET_CONF_IND 0x53
36 #define CCW_CMD_READ_VQ_CONF 0x32
38 #define TYPE_VIRTIO_CCW_DEVICE "virtio-ccw-device"
39 #define VIRTIO_CCW_DEVICE(obj) \
40 OBJECT_CHECK(VirtioCcwDevice, (obj), TYPE_VIRTIO_CCW_DEVICE)
41 #define VIRTIO_CCW_DEVICE_CLASS(klass) \
42 OBJECT_CLASS_CHECK(VirtIOCCWDeviceClass, (klass), TYPE_VIRTIO_CCW_DEVICE)
43 #define VIRTIO_CCW_DEVICE_GET_CLASS(obj) \
44 OBJECT_GET_CLASS(VirtIOCCWDeviceClass, (obj), TYPE_VIRTIO_CCW_DEVICE)
46 typedef struct VirtioBusState VirtioCcwBusState;
47 typedef struct VirtioBusClass VirtioCcwBusClass;
49 #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus"
50 #define VIRTIO_CCW_BUS(obj) \
51 OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS)
52 #define VIRTIO_CCW_BUS_GET_CLASS(obj) \
53 OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
54 #define VIRTIO_CCW_BUS_CLASS(klass) \
55 OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS)
57 typedef struct VirtioCcwDevice VirtioCcwDevice;
59 void virtio_ccw_bus_new(VirtioBusState *bus, VirtioCcwDevice *dev);
61 typedef struct VirtIOCCWDeviceClass {
62 DeviceClass parent_class;
63 int (*init)(VirtioCcwDevice *dev);
64 int (*exit)(VirtioCcwDevice *dev);
65 } VirtIOCCWDeviceClass;
67 /* Change here if we want to support more feature bits. */
68 #define VIRTIO_CCW_FEATURE_SIZE 1
70 struct VirtioCcwDevice {
71 DeviceState parent_obj;
72 SubchDev *sch;
73 VirtIODevice *vdev;
74 char *bus_id;
75 VirtIOBlkConf blk;
76 NICConf nic;
77 uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE];
78 virtio_serial_conf serial;
79 virtio_net_conf net;
80 VirtIOSCSIConf scsi;
81 VirtIORNGConf rng;
82 VirtioBusState bus;
83 /* Guest provided values: */
84 hwaddr indicators;
85 hwaddr indicators2;
88 /* virtual css bus type */
89 typedef struct VirtualCssBus {
90 BusState parent_obj;
91 } VirtualCssBus;
93 #define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus"
94 #define VIRTUAL_CSS_BUS(obj) \
95 OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS)
97 VirtualCssBus *virtual_css_bus_init(void);
98 void virtio_ccw_device_update_status(SubchDev *sch);
99 VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
100 #endif