mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-15 17:48:58 +00:00
virtio-scsi: use standard-headers
Drop duplicated code. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3e96b2db08
commit
019adbd371
@ -13,6 +13,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "standard-headers/linux/virtio_ids.h"
|
||||
#include "hw/virtio/virtio-scsi.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef _QEMU_VIRTIO_SCSI_H
|
||||
#define _QEMU_VIRTIO_SCSI_H
|
||||
|
||||
#include "standard-headers/linux/virtio_scsi.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/scsi/scsi.h"
|
||||
@ -28,15 +29,6 @@
|
||||
#define VIRTIO_SCSI(obj) \
|
||||
OBJECT_CHECK(VirtIOSCSI, (obj), TYPE_VIRTIO_SCSI)
|
||||
|
||||
|
||||
/* The ID for virtio_scsi */
|
||||
#define VIRTIO_ID_SCSI 8
|
||||
|
||||
/* Feature Bits */
|
||||
#define VIRTIO_SCSI_F_INOUT 0
|
||||
#define VIRTIO_SCSI_F_HOTPLUG 1
|
||||
#define VIRTIO_SCSI_F_CHANGE 2
|
||||
|
||||
#define VIRTIO_SCSI_VQ_SIZE 128
|
||||
#define VIRTIO_SCSI_CDB_SIZE 32
|
||||
#define VIRTIO_SCSI_SENSE_SIZE 96
|
||||
@ -44,108 +36,14 @@
|
||||
#define VIRTIO_SCSI_MAX_TARGET 255
|
||||
#define VIRTIO_SCSI_MAX_LUN 16383
|
||||
|
||||
/* Response codes */
|
||||
#define VIRTIO_SCSI_S_OK 0
|
||||
#define VIRTIO_SCSI_S_OVERRUN 1
|
||||
#define VIRTIO_SCSI_S_ABORTED 2
|
||||
#define VIRTIO_SCSI_S_BAD_TARGET 3
|
||||
#define VIRTIO_SCSI_S_RESET 4
|
||||
#define VIRTIO_SCSI_S_BUSY 5
|
||||
#define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
|
||||
#define VIRTIO_SCSI_S_TARGET_FAILURE 7
|
||||
#define VIRTIO_SCSI_S_NEXUS_FAILURE 8
|
||||
#define VIRTIO_SCSI_S_FAILURE 9
|
||||
#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10
|
||||
#define VIRTIO_SCSI_S_FUNCTION_REJECTED 11
|
||||
#define VIRTIO_SCSI_S_INCORRECT_LUN 12
|
||||
|
||||
/* Controlq type codes. */
|
||||
#define VIRTIO_SCSI_T_TMF 0
|
||||
#define VIRTIO_SCSI_T_AN_QUERY 1
|
||||
#define VIRTIO_SCSI_T_AN_SUBSCRIBE 2
|
||||
|
||||
/* Valid TMF subtypes. */
|
||||
#define VIRTIO_SCSI_T_TMF_ABORT_TASK 0
|
||||
#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1
|
||||
#define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2
|
||||
#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3
|
||||
#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4
|
||||
#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5
|
||||
#define VIRTIO_SCSI_T_TMF_QUERY_TASK 6
|
||||
#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7
|
||||
|
||||
/* Events. */
|
||||
#define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000
|
||||
#define VIRTIO_SCSI_T_NO_EVENT 0
|
||||
#define VIRTIO_SCSI_T_TRANSPORT_RESET 1
|
||||
#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
|
||||
#define VIRTIO_SCSI_T_PARAM_CHANGE 3
|
||||
|
||||
/* Reasons for transport reset event */
|
||||
#define VIRTIO_SCSI_EVT_RESET_HARD 0
|
||||
#define VIRTIO_SCSI_EVT_RESET_RESCAN 1
|
||||
#define VIRTIO_SCSI_EVT_RESET_REMOVED 2
|
||||
|
||||
/* SCSI command request, followed by CDB and data-out */
|
||||
typedef struct {
|
||||
uint8_t lun[8]; /* Logical Unit Number */
|
||||
uint64_t tag; /* Command identifier */
|
||||
uint8_t task_attr; /* Task attribute */
|
||||
uint8_t prio;
|
||||
uint8_t crn;
|
||||
} QEMU_PACKED VirtIOSCSICmdReq;
|
||||
|
||||
/* Response, followed by sense data and data-in */
|
||||
typedef struct {
|
||||
uint32_t sense_len; /* Sense data length */
|
||||
uint32_t resid; /* Residual bytes in data buffer */
|
||||
uint16_t status_qualifier; /* Status qualifier */
|
||||
uint8_t status; /* Command completion status */
|
||||
uint8_t response; /* Response values */
|
||||
} QEMU_PACKED VirtIOSCSICmdResp;
|
||||
|
||||
/* Task Management Request */
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint32_t subtype;
|
||||
uint8_t lun[8];
|
||||
uint64_t tag;
|
||||
} QEMU_PACKED VirtIOSCSICtrlTMFReq;
|
||||
|
||||
typedef struct {
|
||||
uint8_t response;
|
||||
} QEMU_PACKED VirtIOSCSICtrlTMFResp;
|
||||
|
||||
/* Asynchronous notification query/subscription */
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint8_t lun[8];
|
||||
uint32_t event_requested;
|
||||
} QEMU_PACKED VirtIOSCSICtrlANReq;
|
||||
|
||||
typedef struct {
|
||||
uint32_t event_actual;
|
||||
uint8_t response;
|
||||
} QEMU_PACKED VirtIOSCSICtrlANResp;
|
||||
|
||||
typedef struct {
|
||||
uint32_t event;
|
||||
uint8_t lun[8];
|
||||
uint32_t reason;
|
||||
} QEMU_PACKED VirtIOSCSIEvent;
|
||||
|
||||
typedef struct {
|
||||
uint32_t num_queues;
|
||||
uint32_t seg_max;
|
||||
uint32_t max_sectors;
|
||||
uint32_t cmd_per_lun;
|
||||
uint32_t event_info_size;
|
||||
uint32_t sense_size;
|
||||
uint32_t cdb_size;
|
||||
uint16_t max_channel;
|
||||
uint16_t max_target;
|
||||
uint32_t max_lun;
|
||||
} QEMU_PACKED VirtIOSCSIConfig;
|
||||
typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq;
|
||||
typedef struct virtio_scsi_cmd_resp VirtIOSCSICmdResp;
|
||||
typedef struct virtio_scsi_ctrl_tmf_req VirtIOSCSICtrlTMFReq;
|
||||
typedef struct virtio_scsi_ctrl_tmf_resp VirtIOSCSICtrlTMFResp;
|
||||
typedef struct virtio_scsi_ctrl_an_req VirtIOSCSICtrlANReq;
|
||||
typedef struct virtio_scsi_ctrl_an_resp VirtIOSCSICtrlANResp;
|
||||
typedef struct virtio_scsi_event VirtIOSCSIEvent;
|
||||
typedef struct virtio_scsi_config VirtIOSCSIConfig;
|
||||
|
||||
struct VirtIOSCSIConf {
|
||||
uint32_t num_queues;
|
||||
|
Loading…
x
Reference in New Issue
Block a user