blob: 0825f0970aef6094d849941673b40327f401dafb [file] [log] [blame]
Gleb Natapov89acfa32010-05-10 11:36:37 +03001#ifndef _VIRTIO_BLK_H
2#define _VIRTIO_BLK_H
3
4struct virtio_blk_config
5{
6 u64 capacity;
7 u32 size_max;
8 u32 seg_max;
9 u16 cylinders;
10 u8 heads;
11 u8 sectors;
12 u32 blk_size;
13 u8 physical_block_exp;
14 u8 alignment_offset;
15 u16 min_io_size;
16 u32 opt_io_size;
17} __attribute__((packed));
18
Gleb Natapov4030db02010-05-17 16:27:27 +030019#define VIRTIO_BLK_F_BLK_SIZE 6
20
Gleb Natapov89acfa32010-05-10 11:36:37 +030021/* These two define direction. */
22#define VIRTIO_BLK_T_IN 0
23#define VIRTIO_BLK_T_OUT 1
24
25/* This is the first element of the read scatter-gather list. */
26struct virtio_blk_outhdr {
27 /* VIRTIO_BLK_T* */
28 u32 type;
29 /* io priority. */
30 u32 ioprio;
31 /* Sector (ie. 512 byte offset) */
32 u64 sector;
33};
34
35#define VIRTIO_BLK_S_OK 0
36#define VIRTIO_BLK_S_IOERR 1
37#define VIRTIO_BLK_S_UNSUPP 2
38
Kevin O'Connor7d09d0e2010-05-10 21:51:38 -040039struct disk_op_s;
Paolo Bonzini0e7fb5f2011-11-16 13:02:55 +010040int process_virtio_blk_op(struct disk_op_s *op);
Gleb Natapov89acfa32010-05-10 11:36:37 +030041void virtio_blk_setup(void);
42
43#endif /* _VIRTIO_BLK_H */