diff options
author | KONRAD Frederic <fred.konrad@greensocs.com> | 2013-03-18 17:37:22 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-18 13:08:40 -0500 |
commit | 1c028ddfb0c5004c8ec86c96ae09068026e77a38 (patch) | |
tree | 69824e8933d836bea23a66f1fad7ac23dc2e9656 /hw/virtio-blk.h | |
parent | da3dcefa648f92bfef2f99351fb6ec6a86da4695 (diff) |
virtio-blk: add the virtio-blk device.
Create virtio-blk which extends virtio-device, so it can be connected on
virtio-bus.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-blk.h')
-rw-r--r-- | hw/virtio-blk.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h index b704d5000a..a040c016d9 100644 --- a/hw/virtio-blk.h +++ b/hw/virtio-blk.h @@ -20,6 +20,10 @@ #include "dataplane/virtio-blk.h" #endif +#define TYPE_VIRTIO_BLK "virtio-blk" +#define VIRTIO_BLK(obj) \ + OBJECT_CHECK(VirtIOBlock, (obj), TYPE_VIRTIO_BLK) + /* from Linux's linux/virtio_blk.h */ /* The ID for virtio_block */ @@ -130,4 +134,21 @@ typedef struct VirtIOBlock { #define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \ DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) +#ifdef __linux__ +#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field) \ + DEFINE_BLOCK_PROPERTIES(_state, _field.conf), \ + DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf), \ + DEFINE_PROP_STRING("serial", _state, _field.serial), \ + DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true), \ + DEFINE_PROP_BIT("scsi", _state, _field.scsi, 0, true) +#else +#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field) \ + DEFINE_BLOCK_PROPERTIES(_state, _field.conf), \ + DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf), \ + DEFINE_PROP_STRING("serial", _state, _field.serial), \ + DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true) +#endif /* __linux__ */ + +void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk); + #endif |