1 /******************************************************************************
2 * Copyright (c) 2011 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
14 * Virtio block device definitions.
15 * See Virtio Spec, Appendix D, for details
24 struct virtio_blk_cfg {
28 struct virtio_blk_geometry {
35 } __attribute__ ((packed)) ;
38 struct virtio_blk_req {
44 /* Block request types */
45 #define VIRTIO_BLK_T_IN 0
46 #define VIRTIO_BLK_T_OUT 1
47 #define VIRTIO_BLK_T_SCSI_CMD 2
48 #define VIRTIO_BLK_T_SCSI_CMD_OUT 3
49 #define VIRTIO_BLK_T_FLUSH 4
50 #define VIRTIO_BLK_T_FLUSH_OUT 5
51 #define VIRTIO_BLK_T_BARRIER 0x80000000
53 /* VIRTIO_BLK Feature bits */
54 #define VIRTIO_BLK_F_BLK_SIZE (1 << 6)
56 extern int virtioblk_init(struct virtio_device *dev);
57 extern void virtioblk_shutdown(struct virtio_device *dev);
58 extern int virtioblk_read(struct virtio_device *dev, char *buf, long blocknum, long cnt);
60 #endif /* _VIRTIO_BLK_H */