linux/include/uapi/linux/virtio_scsi.h

/*
 * This header is BSD licensed so anyone can use the definitions to implement
 * compatible drivers/servers.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef _LINUX_VIRTIO_SCSI_H
#define _LINUX_VIRTIO_SCSI_H

#include <linux/virtio_types.h>

/* Default values of the CDB and sense data size configuration fields */
#define VIRTIO_SCSI_CDB_DEFAULT_SIZE
#define VIRTIO_SCSI_SENSE_DEFAULT_SIZE

#ifndef VIRTIO_SCSI_CDB_SIZE
#define VIRTIO_SCSI_CDB_SIZE
#endif
#ifndef VIRTIO_SCSI_SENSE_SIZE
#define VIRTIO_SCSI_SENSE_SIZE
#endif

/* SCSI command request, followed by data-out */
struct virtio_scsi_cmd_req {} __attribute__((packed));

/* SCSI command request, followed by protection information */
struct virtio_scsi_cmd_req_pi {} __attribute__((packed));

/* Response, followed by sense data and data-in */
struct virtio_scsi_cmd_resp {} __attribute__((packed));

/* Task Management Request */
struct virtio_scsi_ctrl_tmf_req {} __attribute__((packed));

struct virtio_scsi_ctrl_tmf_resp {} __attribute__((packed));

/* Asynchronous notification query/subscription */
struct virtio_scsi_ctrl_an_req {} __attribute__((packed));

struct virtio_scsi_ctrl_an_resp {} __attribute__((packed));

struct virtio_scsi_event {} __attribute__((packed));

struct virtio_scsi_config {} __attribute__((packed));

/* Feature Bits */
#define VIRTIO_SCSI_F_INOUT
#define VIRTIO_SCSI_F_HOTPLUG
#define VIRTIO_SCSI_F_CHANGE
#define VIRTIO_SCSI_F_T10_PI

/* Response codes */
#define VIRTIO_SCSI_S_OK
#define VIRTIO_SCSI_S_OVERRUN
#define VIRTIO_SCSI_S_ABORTED
#define VIRTIO_SCSI_S_BAD_TARGET
#define VIRTIO_SCSI_S_RESET
#define VIRTIO_SCSI_S_BUSY
#define VIRTIO_SCSI_S_TRANSPORT_FAILURE
#define VIRTIO_SCSI_S_TARGET_FAILURE
#define VIRTIO_SCSI_S_NEXUS_FAILURE
#define VIRTIO_SCSI_S_FAILURE
#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED
#define VIRTIO_SCSI_S_FUNCTION_REJECTED
#define VIRTIO_SCSI_S_INCORRECT_LUN

/* Controlq type codes.  */
#define VIRTIO_SCSI_T_TMF
#define VIRTIO_SCSI_T_AN_QUERY
#define VIRTIO_SCSI_T_AN_SUBSCRIBE

/* Valid TMF subtypes.  */
#define VIRTIO_SCSI_T_TMF_ABORT_TASK
#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET
#define VIRTIO_SCSI_T_TMF_CLEAR_ACA
#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET
#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET
#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET
#define VIRTIO_SCSI_T_TMF_QUERY_TASK
#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET

/* Events.  */
#define VIRTIO_SCSI_T_EVENTS_MISSED
#define VIRTIO_SCSI_T_NO_EVENT
#define VIRTIO_SCSI_T_TRANSPORT_RESET
#define VIRTIO_SCSI_T_ASYNC_NOTIFY
#define VIRTIO_SCSI_T_PARAM_CHANGE

/* Reasons of transport reset event */
#define VIRTIO_SCSI_EVT_RESET_HARD
#define VIRTIO_SCSI_EVT_RESET_RESCAN
#define VIRTIO_SCSI_EVT_RESET_REMOVED

#define VIRTIO_SCSI_S_SIMPLE
#define VIRTIO_SCSI_S_ORDERED
#define VIRTIO_SCSI_S_HEAD
#define VIRTIO_SCSI_S_ACA


#endif /* _LINUX_VIRTIO_SCSI_H */