linux/include/linux/virtio_scsi.h
<<
>>
Prefs
   1#ifndef _LINUX_VIRTIO_SCSI_H
   2#define _LINUX_VIRTIO_SCSI_H
   3/* This header is BSD licensed so anyone can use the definitions to implement
   4 * compatible drivers/servers. */
   5
   6#define VIRTIO_SCSI_CDB_SIZE   32
   7#define VIRTIO_SCSI_SENSE_SIZE 96
   8
   9/* SCSI command request, followed by data-out */
  10struct virtio_scsi_cmd_req {
  11        u8 lun[8];              /* Logical Unit Number */
  12        u64 tag;                /* Command identifier */
  13        u8 task_attr;           /* Task attribute */
  14        u8 prio;
  15        u8 crn;
  16        u8 cdb[VIRTIO_SCSI_CDB_SIZE];
  17} __packed;
  18
  19/* Response, followed by sense data and data-in */
  20struct virtio_scsi_cmd_resp {
  21        u32 sense_len;          /* Sense data length */
  22        u32 resid;              /* Residual bytes in data buffer */
  23        u16 status_qualifier;   /* Status qualifier */
  24        u8 status;              /* Command completion status */
  25        u8 response;            /* Response values */
  26        u8 sense[VIRTIO_SCSI_SENSE_SIZE];
  27} __packed;
  28
  29/* Task Management Request */
  30struct virtio_scsi_ctrl_tmf_req {
  31        u32 type;
  32        u32 subtype;
  33        u8 lun[8];
  34        u64 tag;
  35} __packed;
  36
  37struct virtio_scsi_ctrl_tmf_resp {
  38        u8 response;
  39} __packed;
  40
  41/* Asynchronous notification query/subscription */
  42struct virtio_scsi_ctrl_an_req {
  43        u32 type;
  44        u8 lun[8];
  45        u32 event_requested;
  46} __packed;
  47
  48struct virtio_scsi_ctrl_an_resp {
  49        u32 event_actual;
  50        u8 response;
  51} __packed;
  52
  53struct virtio_scsi_event {
  54        u32 event;
  55        u8 lun[8];
  56        u32 reason;
  57} __packed;
  58
  59struct virtio_scsi_config {
  60        u32 num_queues;
  61        u32 seg_max;
  62        u32 max_sectors;
  63        u32 cmd_per_lun;
  64        u32 event_info_size;
  65        u32 sense_size;
  66        u32 cdb_size;
  67        u16 max_channel;
  68        u16 max_target;
  69        u32 max_lun;
  70} __packed;
  71
  72/* Feature Bits */
  73#define VIRTIO_SCSI_F_INOUT                    0
  74#define VIRTIO_SCSI_F_HOTPLUG                  1
  75
  76/* Response codes */
  77#define VIRTIO_SCSI_S_OK                       0
  78#define VIRTIO_SCSI_S_OVERRUN                  1
  79#define VIRTIO_SCSI_S_ABORTED                  2
  80#define VIRTIO_SCSI_S_BAD_TARGET               3
  81#define VIRTIO_SCSI_S_RESET                    4
  82#define VIRTIO_SCSI_S_BUSY                     5
  83#define VIRTIO_SCSI_S_TRANSPORT_FAILURE        6
  84#define VIRTIO_SCSI_S_TARGET_FAILURE           7
  85#define VIRTIO_SCSI_S_NEXUS_FAILURE            8
  86#define VIRTIO_SCSI_S_FAILURE                  9
  87#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED       10
  88#define VIRTIO_SCSI_S_FUNCTION_REJECTED        11
  89#define VIRTIO_SCSI_S_INCORRECT_LUN            12
  90
  91/* Controlq type codes.  */
  92#define VIRTIO_SCSI_T_TMF                      0
  93#define VIRTIO_SCSI_T_AN_QUERY                 1
  94#define VIRTIO_SCSI_T_AN_SUBSCRIBE             2
  95
  96/* Valid TMF subtypes.  */
  97#define VIRTIO_SCSI_T_TMF_ABORT_TASK           0
  98#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET       1
  99#define VIRTIO_SCSI_T_TMF_CLEAR_ACA            2
 100#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET       3
 101#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET      4
 102#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET   5
 103#define VIRTIO_SCSI_T_TMF_QUERY_TASK           6
 104#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET       7
 105
 106/* Events.  */
 107#define VIRTIO_SCSI_T_EVENTS_MISSED            0x80000000
 108#define VIRTIO_SCSI_T_NO_EVENT                 0
 109#define VIRTIO_SCSI_T_TRANSPORT_RESET          1
 110#define VIRTIO_SCSI_T_ASYNC_NOTIFY             2
 111
 112/* Reasons of transport reset event */
 113#define VIRTIO_SCSI_EVT_RESET_HARD             0
 114#define VIRTIO_SCSI_EVT_RESET_RESCAN           1
 115#define VIRTIO_SCSI_EVT_RESET_REMOVED          2
 116
 117#define VIRTIO_SCSI_S_SIMPLE                   0
 118#define VIRTIO_SCSI_S_ORDERED                  1
 119#define VIRTIO_SCSI_S_HEAD                     2
 120#define VIRTIO_SCSI_S_ACA                      3
 121
 122
 123#endif /* _LINUX_VIRTIO_SCSI_H */
 124
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.