Paolo Bonzini | c5c488f | 2012-02-27 17:22:23 +0100 | [diff] [blame] | 1 | #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 | |
| 7 | struct 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. */ |
| 22 | struct 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 He | b44a7be | 2013-03-15 09:45:16 +0800 | [diff] [blame] | 29 | } __attribute__((packed)); |
Paolo Bonzini | c5c488f | 2012-02-27 17:22:23 +0100 | [diff] [blame] | 30 | |
| 31 | /* This is the first element of the "in" scatter-gather list. */ |
| 32 | struct 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 He | b44a7be | 2013-03-15 09:45:16 +0800 | [diff] [blame] | 39 | } __attribute__((packed)); |
Paolo Bonzini | c5c488f | 2012-02-27 17:22:23 +0100 | [diff] [blame] | 40 | |
| 41 | #define VIRTIO_SCSI_S_OK 0 |
| 42 | |
| 43 | struct disk_op_s; |
Kevin O'Connor | e0eb5a0 | 2015-07-07 12:19:53 -0400 | [diff] [blame] | 44 | int virtio_scsi_process_op(struct disk_op_s *op); |
Paolo Bonzini | c5c488f | 2012-02-27 17:22:23 +0100 | [diff] [blame] | 45 | void virtio_scsi_setup(void); |
| 46 | |
| 47 | #endif /* _VIRTIO_SCSI_H */ |