Fixed 'Got invalid option' bug. Adds conditional debug messages
[qemu/ovp.git] / qemu-vio-blk.h
blob495a215440e318aa818e3b6f8f3493eecae7383c
1 #ifndef QUEMU_VIO_BLK_H
2 #define QUEMU_VIO_BLK_H
4 #include <stdint.h>
6 #include "targphys.h"
7 #include "block.h"
8 #include "qemu-vio-virtio.h"
10 /* Flush the volatile write cache */
11 #define VIRTIO_BLK_T_FLUSH 4
13 /* This bit says it's a scsi command, not an actual read or write. */
14 #define VIRTIO_BLK_T_SCSI_CMD 2
16 #define QEMU_VIO_BLK_ID_LEN 256 /* length of identify u16 array */
18 /* These two define direction. */
19 #define VIRTIO_BLK_T_IN 0
20 #define VIRTIO_BLK_T_OUT 1
22 #define VIRTIO_BLK_S_OK 0
23 #define VIRTIO_BLK_S_IOERR 1
24 #define VIRTIO_BLK_S_UNSUPP 2
26 /* Feature bits */
27 #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
28 #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
29 #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
30 #define VIRTIO_BLK_F_GEOMETRY 4 /* Indicates support of legacy geometry */
31 #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
32 #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
33 #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
34 #define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
35 #define VIRTIO_BLK_F_WCACHE 9 /* write cache enabled */
37 #define VIRTIO_BLK_ID_LEN 256 /* length of identify u16 array */
38 #define VIRTIO_BLK_ID_SN 10 /* start of char * serial# */
39 #define VIRTIO_BLK_ID_SN_BYTES 20 /* length in bytes of serial# */
42 struct qemu_vio_blk_config
44 uint64_t capacity;
45 uint32_t size_max;
46 uint32_t seg_max;
47 uint16_t cylinders;
48 uint8_t heads;
49 uint8_t sectors;
50 uint32_t _blk_size; /* structure pad, currently unused */
51 uint16_t identify[QEMU_VIO_BLK_ID_LEN];
52 } __attribute__((packed));
54 VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s);
55 void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb);
56 void do_multiwrite(BlockDriverState *bs, BlockRequest *blkreq,int num_writes);
57 void qemu_vio_exit(BlockDriverState *bs);
58 void qemu_vio_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs);
59 int64_t qemu_vio_getlength(BlockDriverState *bs);
60 BlockErrorAction drive_get_on_error(BlockDriverState *bdrv, int is_read);
62 #endif /* QUEMU_VIO_H */