These codes potentially come from the firmware on a host adapter or from one of several hosts that an adapter driver controls. The 'host_status' field has the following values whose #defines mimic those which are only visible within the kernel (with the "SG_ERR_" removed from the front of each define). A copy of these defines can be found in sg_err.h (see Appendix A, Sg3_utils package):
SG_ERR_DID_OK [0x00] NO error
SG_ERR_DID_NO_CONNECT [0x01] Couldn't connect before timeout period
SG_ERR_DID_BUS_BUSY [0x02] BUS stayed busy through time out period
SG_ERR_DID_TIME_OUT [0x03] TIMED OUT for other reason (often this an unexpected device selection timeout)
SG_ERR_DID_BAD_TARGET [0x04] BAD target, device not responding?
SG_ERR_DID_ABORT [0x05] Told to abort for some other reason. From lk 2.4.15 the SCSI subsystem supports 16 byte commands however few adapter drivers do. Those HBA drivers that don't support 16 byte commands will yield this error code if a 16 byte command is passed to a SCSI device they control.
SG_ERR_DID_PARITY [0x06] Parity error. Older SCSI parallel buses have a parity bit for error detection. This probably indicates a cable or termination problem.
SG_ERR_DID_ERROR [0x07] Internal error detected in the host adapter. This may not be fatal (and the command may have succeeded). The aic7xxx and sym53c8xx adapter drivers sometimes report this for data underruns or overruns. [10]
SG_ERR_DID_RESET [0x08] The SCSI bus (or this device) has been reset. Any SCSI device on a SCSI bus is capable of instigating a reset.
SG_ERR_DID_BAD_INTR [0x09] Got an interrupt we weren't expecting
SG_ERR_DID_PASSTHROUGH [0x0a] Force command past mid-layer
SG_ERR_DID_SOFT_ERROR [0x0b] The low level driver wants a retry
SG_ERR_DID_IMM_RETRY [0x0c] Retry without decrementing retry count
SG_ERR_DID_REQUEUE [0x0d] Requeue command (no immediate retry) also without decrementing the retry count
The type of host_status is unsigned short .
[10] In some cases the sym53cxx driver reports a DID_ERROR when it internally rounds up an odd transfer length by 1. This is an example of a "non-error".