4
* Copyright IBM, Corp. 2007
7
* Anthony Liguori <aliguori@us.ibm.com>
9
* This work is licensed under the terms of the GNU GPL, version 2. See
10
* the COPYING file in the top-level directory.
14
#ifndef _QEMU_VIRTIO_BLK_H
15
#define _QEMU_VIRTIO_BLK_H
21
/* from Linux's linux/virtio_blk.h */
23
/* The ID for virtio_block */
24
#define VIRTIO_ID_BLOCK 2
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 */
32
struct virtio_blk_config
40
} __attribute__((packed));
42
/* These two define direction. */
43
#define VIRTIO_BLK_T_IN 0
44
#define VIRTIO_BLK_T_OUT 1
46
/* This bit says it's a scsi command, not an actual read or write. */
47
#define VIRTIO_BLK_T_SCSI_CMD 2
49
/* Barrier before this op. */
50
#define VIRTIO_BLK_T_BARRIER 0x80000000
52
/* This is the first element of the read scatter-gather list. */
53
struct virtio_blk_outhdr
59
/* Sector (ie. 512 byte offset) */
63
#define VIRTIO_BLK_S_OK 0
64
#define VIRTIO_BLK_S_IOERR 1
65
#define VIRTIO_BLK_S_UNSUPP 2
67
/* This is the first element of the write scatter-gather list */
68
struct virtio_blk_inhdr
73
void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs);