1 /******************************************************************************
2 * Copyright (c) 2012 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 SCSI Host device definitions.
15 * See Virtio Spec, Appendix I, for details
18 #ifndef _VIRTIO_SCSI_H
19 #define _VIRTIO_SCSI_H
21 #define VIRTIO_SCSI_CDB_SIZE 32
22 #define VIRTIO_SCSI_SENSE_SIZE 96
24 #define VIRTIO_SCSI_CONTROL_VQ 0
25 #define VIRTIO_SCSI_EVENT_VQ 1
26 #define VIRTIO_SCSI_REQUEST_VQ 2
28 struct virtio_scsi_config
34 uint32_t event_info_size;
40 } __attribute__((packed));
42 /* This is the first element of the "out" scatter-gather list. */
43 struct virtio_scsi_req_cmd {
49 char cdb[VIRTIO_SCSI_CDB_SIZE];
52 /* This is the first element of the "in" scatter-gather list. */
53 struct virtio_scsi_resp_cmd {
56 uint16_t status_qualifier;
59 uint8_t sense[VIRTIO_SCSI_SENSE_SIZE];
62 extern int virtioscsi_init(struct virtio_device *dev);
63 extern void virtioscsi_shutdown(struct virtio_device *dev);
64 extern int virtioscsi_send(struct virtio_device *dev,
65 struct virtio_scsi_req_cmd *req,
66 struct virtio_scsi_resp_cmd *resp,
67 int is_read, void *buf, uint64_t buf_len);
69 #endif /* _VIRTIO_SCSI_H */