/* Report a driver-initiated bus reset to the SCSI layer. * Calling this for a SCSI-initiated reset is unnecessary but harmless. * The caller must not own the SCSI host lock. */ void usb_stor_report_bus_reset(struct us_data *us) { struct Scsi_Host *host = us_to_host(us); scsi_lock(host); scsi_report_bus_reset(host, 0); scsi_unlock(host); }
/* Report a driver-initiated bus reset to the SCSI layer. * Calling this for a SCSI-initiated reset is unnecessary but harmless. * The caller must own the SCSI host lock. */ void usb_stor_report_bus_reset(struct us_data *us) { scsi_report_bus_reset(us_to_host(us), 0); }
MV_BOOLEAN IALCompletion(struct mvSataAdapter *pSataAdapter, MV_SATA_SCSI_CMD_BLOCK *pCmdBlock) { struct scsi_cmnd *SCpnt = (struct scsi_cmnd *)pCmdBlock->IALData; struct mv_comp_info *pInfo = ( struct mv_comp_info *) &(SCpnt->SCp); MV_U8 host_status; switch (pCmdBlock->ScsiCommandCompletion) { case MV_SCSI_COMPLETION_SUCCESS: host_status = DID_OK; break; case MV_SCSI_COMPLETION_BAD_SCSI_COMMAND: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with BAD_SCSI_COMMAND\n"); host_status = DID_OK; break; case MV_SCSI_COMPLETION_ATA_FAILED: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with ATA FAILED\n"); host_status = DID_OK; break; case MV_SCSI_COMPLETION_UA_RESET: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with UA BUS" " RESET\n"); scsi_report_bus_reset(pInfo->SCpnt->device->host, pInfo->SCpnt->device->channel); host_status = DID_OK; break; case MV_SCSI_COMPLETION_UA_PARAMS_CHANGED: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with UA " "PARAMETERS CHANGED\n"); scsi_report_bus_reset(pInfo->SCpnt->device->host, pInfo->SCpnt->device->channel); host_status = DID_OK; break; case MV_SCSI_COMPLETION_QUEUE_FULL: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with QUEUE FULL\n"); /* flushed from ial common*/ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) if (pCmdBlock->ScsiStatus == MV_SCSI_STATUS_BUSY) { mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Host status: DID_RESET\n"); host_status = DID_RESET; pInfo->SCpnt->flags |= IS_RESETTING; } else #endif { host_status = DID_OK; } break; case MV_SCSI_COMPLETION_ABORTED: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with ABORTED\n"); host_status = DID_ERROR; break; case MV_SCSI_COMPLETION_OVERRUN: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with OVERRUN\n"); if (pInfo->SCpnt->underflow > pCmdBlock->dataTransfered) { host_status = DID_ERROR; } else { host_status = DID_OK; } break; case MV_SCSI_COMPLETION_UNDERRUN: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with UNDERRUN\n"); host_status = DID_ERROR; break; case MV_SCSI_COMPLETION_PARITY_ERROR: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR, "Scsi command completed with PARITY ERROR\n"); host_status = DID_PARITY; break; case MV_SCSI_COMPLETION_INVALID_BUS: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with INVALID BUS\n"); host_status = DID_BAD_TARGET; break; case MV_SCSI_COMPLETION_NO_DEVICE: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "Scsi command completed with NO DEVICE\n"); host_status = DID_NO_CONNECT; break; case MV_SCSI_COMPLETION_INVALID_STATUS: case MV_SCSI_COMPLETION_BAD_SCB: case MV_SCSI_COMPLETION_NOT_READY: case MV_SCSI_COMPLETION_DISCONNECT: case MV_SCSI_COMPLETION_BUS_RESET: case MV_SCSI_COMPLETION_BUSY: default: mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR,"Bad Scsi completion status %d\n", pCmdBlock->ScsiCommandCompletion); host_status = DID_ERROR; } if ((pCmdBlock->senseDataLength == 0) && (pCmdBlock->senseBufferLength)) { pCmdBlock->pSenseBuffer[0] = 0; } pInfo->SCpnt->result = host_status << 16 | (pCmdBlock->ScsiStatus & 0x3f); { MV_U8 channelIndex = pCmdBlock->bus; release_ata_mem(pInfo); mv_ial_lib_add_done_queue (pSataAdapter->IALData, channelIndex, SCpnt); } return MV_TRUE; }