Revision a1f0cce2 hw/scsi.h

b/hw/scsi.h
27 27
    SCSI_XFER_TO_DEV,    /*  WRITE, MODE_SELECT, ...         */
28 28
};
29 29

  
30
typedef struct SCSISense {
31
    uint8_t key;
32
    uint8_t asc;
33
    uint8_t ascq;
34
} SCSISense;
35

  
30 36
struct SCSIRequest {
31 37
    SCSIBus           *bus;
32 38
    SCSIDevice        *dev;
......
104 110
                                      int unit, bool removable);
105 111
int scsi_bus_legacy_handle_cmdline(SCSIBus *bus);
106 112

  
113
/*
114
 * Predefined sense codes
115
 */
116

  
117
/* No sense data available */
118
extern const struct SCSISense sense_code_NO_SENSE;
119
/* LUN not ready, Manual intervention required */
120
extern const struct SCSISense sense_code_LUN_NOT_READY;
121
/* LUN not ready, Medium not present */
122
extern const struct SCSISense sense_code_NO_MEDIUM;
123
/* Hardware error, internal target failure */
124
extern const struct SCSISense sense_code_TARGET_FAILURE;
125
/* Illegal request, invalid command operation code */
126
extern const struct SCSISense sense_code_INVALID_OPCODE;
127
/* Illegal request, LBA out of range */
128
extern const struct SCSISense sense_code_LBA_OUT_OF_RANGE;
129
/* Illegal request, Invalid field in CDB */
130
extern const struct SCSISense sense_code_INVALID_FIELD;
131
/* Illegal request, LUN not supported */
132
extern const struct SCSISense sense_code_LUN_NOT_SUPPORTED;
133
/* Command aborted, I/O process terminated */
134
extern const struct SCSISense sense_code_IO_ERROR;
135
/* Command aborted, I_T Nexus loss occurred */
136
extern const struct SCSISense sense_code_I_T_NEXUS_LOSS;
137
/* Command aborted, Logical Unit failure */
138
extern const struct SCSISense sense_code_LUN_FAILURE;
139

  
140
#define SENSE_CODE(x) sense_code_ ## x
141

  
142
int scsi_build_sense(SCSISense sense, uint8_t *buf, int len, int fixed);
143
int scsi_sense_valid(SCSISense sense);
144

  
107 145
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun);
108 146
void scsi_req_enqueue(SCSIRequest *req);
109 147
void scsi_req_free(SCSIRequest *req);
110
void scsi_req_dequeue(SCSIRequest *req);
111 148
SCSIRequest *scsi_req_ref(SCSIRequest *req);
112 149
void scsi_req_unref(SCSIRequest *req);
113 150

  

Also available in: Unified diff