blob: 96c3701d24cfa75cc1434c44d9461ae69c107681 [file] [log] [blame]
Paolo Bonzinic5c488f2012-02-27 17:22:23 +01001#ifndef _VIRTIO_SCSI_H
2#define _VIRTIO_SCSI_H
3
4#define VIRTIO_SCSI_CDB_SIZE 32
5#define VIRTIO_SCSI_SENSE_SIZE 96
6
7struct virtio_scsi_config
8{
9 u32 num_queues;
10 u32 seg_max;
11 u32 max_sectors;
12 u32 cmd_per_lun;
13 u32 event_info_size;
14 u32 sense_size;
15 u32 cdb_size;
16 u16 max_channel;
17 u16 max_target;
18 u32 max_lun;
19} __attribute__((packed));
20
21/* This is the first element of the "out" scatter-gather list. */
22struct virtio_scsi_req_cmd {
23 u8 lun[8];
24 u64 id;
25 u8 task_attr;
26 u8 prio;
27 u8 crn;
28 char cdb[VIRTIO_SCSI_CDB_SIZE];
Asias Heb44a7be2013-03-15 09:45:16 +080029} __attribute__((packed));
Paolo Bonzinic5c488f2012-02-27 17:22:23 +010030
31/* This is the first element of the "in" scatter-gather list. */
32struct virtio_scsi_resp_cmd {
33 u32 sense_len;
34 u32 residual;
35 u16 status_qualifier;
36 u8 status;
37 u8 response;
38 u8 sense[VIRTIO_SCSI_SENSE_SIZE];
Asias Heb44a7be2013-03-15 09:45:16 +080039} __attribute__((packed));
Paolo Bonzinic5c488f2012-02-27 17:22:23 +010040
41#define VIRTIO_SCSI_S_OK 0
42
43struct disk_op_s;
44int virtio_scsi_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize);
45void virtio_scsi_setup(void);
46
47#endif /* _VIRTIO_SCSI_H */