|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2011 IBM Corporation
3: * All rights reserved.
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
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13: /*
14: * Virtio block device definitions.
15: * See Virtio Spec, Appendix D, for details
16: */
17:
18: #ifndef _VIRTIO_BLK_H
19: #define _VIRTIO_BLK_H
20:
21: #include <stdint.h>
22:
23:
24: /* Device configuration layout */
25: /*
26: struct virtio_blk_config {
27: uint64_t capacity;
28: uint32_t size_max;
29: uint32_t seg_max;
30: struct virtio_blk_geometry {
31: uint16_t cylinders;
32: uint8_t heads;
33: uint8_t sectors;
34: } geometry;
35: uint32_t blk_size;
36: uint32_t sectors_max;
37: };
38: */
39:
40: /* Block request */
41: struct virtio_blk_req {
42: uint32_t type ;
43: uint32_t ioprio ;
44: uint64_t sector ;
45: };
46:
47: /* Block request types */
48: #define VIRTIO_BLK_T_IN 0
49: #define VIRTIO_BLK_T_OUT 1
50: #define VIRTIO_BLK_T_SCSI_CMD 2
51: #define VIRTIO_BLK_T_SCSI_CMD_OUT 3
52: #define VIRTIO_BLK_T_FLUSH 4
53: #define VIRTIO_BLK_T_FLUSH_OUT 5
54: #define VIRTIO_BLK_T_BARRIER 0x80000000
55:
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);
59:
60: #endif /* _VIRTIO_BLK_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.