Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mpi3mr/mpi3mr.c
Show First 20 Lines • Show All 2,262 Lines • ▼ Show 20 Lines | mpi3mr_dprint(sc, MPI3MR_INFO, "%s\n", sc->fw_version); | ||||
printf("%sNVMe attachment", i ? "," : ""); | printf("%sNVMe attachment", i ? "," : ""); | ||||
i++; | i++; | ||||
} | } | ||||
i = 0; | i = 0; | ||||
printf("), "); | printf("), "); | ||||
printf("Capabilities=("); | printf("Capabilities=("); | ||||
if (sc->facts.ioc_capabilities & | if (sc->facts.ioc_capabilities & | ||||
MPI3_IOCFACTS_CAPABILITY_RAID_CAPABLE) { | MPI3_IOCFACTS_CAPABILITY_RAID_SUPPORTED) { | ||||
printf("RAID"); | printf("RAID"); | ||||
i++; | i++; | ||||
} | } | ||||
printf(")\n"); | printf(")\n"); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 1,603 Lines • ▼ Show 20 Lines | static void mpi3mr_sastopochg_evt_th(struct mpi3mr_softc *sc, | ||||
U16 handle; | U16 handle; | ||||
U8 reason_code; | U8 reason_code; | ||||
struct mpi3mr_target *tgtdev = NULL; | struct mpi3mr_target *tgtdev = NULL; | ||||
for (i = 0; i < topo_evt->NumEntries; i++) { | for (i = 0; i < topo_evt->NumEntries; i++) { | ||||
handle = le16toh(topo_evt->PhyEntry[i].AttachedDevHandle); | handle = le16toh(topo_evt->PhyEntry[i].AttachedDevHandle); | ||||
if (!handle) | if (!handle) | ||||
continue; | continue; | ||||
reason_code = topo_evt->PhyEntry[i].Status & | reason_code = topo_evt->PhyEntry[i].PhyStatus & | ||||
MPI3_EVENT_SAS_TOPO_PHY_RC_MASK; | MPI3_EVENT_SAS_TOPO_PHY_RC_MASK; | ||||
tgtdev = mpi3mr_find_target_by_dev_handle(sc->cam_sc, handle); | tgtdev = mpi3mr_find_target_by_dev_handle(sc->cam_sc, handle); | ||||
switch (reason_code) { | switch (reason_code) { | ||||
case MPI3_EVENT_SAS_TOPO_PHY_RC_TARG_NOT_RESPONDING: | case MPI3_EVENT_SAS_TOPO_PHY_RC_TARG_NOT_RESPONDING: | ||||
if (tgtdev) { | if (tgtdev) { | ||||
tgtdev->dev_removed = 1; | tgtdev->dev_removed = 1; | ||||
tgtdev->dev_removedelay = 0; | tgtdev->dev_removedelay = 0; | ||||
mpi3mr_atomic_set(&tgtdev->block_io, 0); | mpi3mr_atomic_set(&tgtdev->block_io, 0); | ||||
▲ Show 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | static void mpi3mr_process_admin_reply_desc(struct mpi3mr_softc *sc, | ||||
*reply_dma = 0; | *reply_dma = 0; | ||||
reply_desc_type = reply_desc->ReplyFlags & | reply_desc_type = reply_desc->ReplyFlags & | ||||
MPI3_REPLY_DESCRIPT_FLAGS_TYPE_MASK; | MPI3_REPLY_DESCRIPT_FLAGS_TYPE_MASK; | ||||
switch (reply_desc_type) { | switch (reply_desc_type) { | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_STATUS: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_STATUS: | ||||
status_desc = (Mpi3StatusReplyDescriptor_t *)reply_desc; | status_desc = (Mpi3StatusReplyDescriptor_t *)reply_desc; | ||||
host_tag = status_desc->HostTag; | host_tag = status_desc->HostTag; | ||||
ioc_status = status_desc->IOCStatus; | ioc_status = status_desc->IOCStatus; | ||||
if (ioc_status & | if (ioc_status & MPI3_IOCSTATUS_STATUS_MASK) | ||||
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) | |||||
ioc_loginfo = status_desc->IOCLogInfo; | ioc_loginfo = status_desc->IOCLogInfo; | ||||
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; | ioc_status &= MPI3_IOCSTATUS_STATUS_MASK; | ||||
break; | break; | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY: | ||||
addr_desc = (Mpi3AddressReplyDescriptor_t *)reply_desc; | addr_desc = (Mpi3AddressReplyDescriptor_t *)reply_desc; | ||||
*reply_dma = addr_desc->ReplyFrameAddress; | *reply_dma = addr_desc->ReplyFrameAddress; | ||||
def_reply = mpi3mr_get_reply_virt_addr(sc, *reply_dma); | def_reply = mpi3mr_get_reply_virt_addr(sc, *reply_dma); | ||||
if (def_reply == NULL) | if (def_reply == NULL) | ||||
goto out; | goto out; | ||||
host_tag = def_reply->HostTag; | host_tag = def_reply->HostTag; | ||||
ioc_status = def_reply->IOCStatus; | ioc_status = def_reply->IOCStatus; | ||||
if (ioc_status & | if (ioc_status & MPI3_IOCSTATUS_STATUS_MASK) | ||||
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) | |||||
ioc_loginfo = def_reply->IOCLogInfo; | ioc_loginfo = def_reply->IOCLogInfo; | ||||
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; | ioc_status &= MPI3_IOCSTATUS_STATUS_MASK; | ||||
if (def_reply->Function == MPI3_FUNCTION_SCSI_IO) { | if (def_reply->Function == MPI3_FUNCTION_SCSI_IO) { | ||||
scsi_reply = (Mpi3SCSIIOReply_t *)def_reply; | scsi_reply = (Mpi3SCSIIOReply_t *)def_reply; | ||||
sense_buf = mpi3mr_get_sensebuf_virt_addr(sc, | sense_buf = mpi3mr_get_sensebuf_virt_addr(sc, | ||||
scsi_reply->SenseDataBufferAddress); | scsi_reply->SenseDataBufferAddress); | ||||
} | } | ||||
break; | break; | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS: | ||||
success_desc = (Mpi3SuccessReplyDescriptor_t *)reply_desc; | success_desc = (Mpi3SuccessReplyDescriptor_t *)reply_desc; | ||||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | void mpi3mr_process_op_reply_desc(struct mpi3mr_softc *sc, | ||||
*reply_dma = 0; | *reply_dma = 0; | ||||
reply_desc_type = reply_desc->ReplyFlags & | reply_desc_type = reply_desc->ReplyFlags & | ||||
MPI3_REPLY_DESCRIPT_FLAGS_TYPE_MASK; | MPI3_REPLY_DESCRIPT_FLAGS_TYPE_MASK; | ||||
switch (reply_desc_type) { | switch (reply_desc_type) { | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_STATUS: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_STATUS: | ||||
status_desc = (Mpi3StatusReplyDescriptor_t *)reply_desc; | status_desc = (Mpi3StatusReplyDescriptor_t *)reply_desc; | ||||
host_tag = status_desc->HostTag; | host_tag = status_desc->HostTag; | ||||
ioc_status = status_desc->IOCStatus; | ioc_status = status_desc->IOCStatus; | ||||
if (ioc_status & | if (ioc_status & MPI3_IOCSTATUS_STATUS_MASK) | ||||
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) | |||||
ioc_loginfo = status_desc->IOCLogInfo; | ioc_loginfo = status_desc->IOCLogInfo; | ||||
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; | ioc_status &= MPI3_IOCSTATUS_STATUS_MASK; | ||||
break; | break; | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY: | ||||
addr_desc = (Mpi3AddressReplyDescriptor_t *)reply_desc; | addr_desc = (Mpi3AddressReplyDescriptor_t *)reply_desc; | ||||
*reply_dma = addr_desc->ReplyFrameAddress; | *reply_dma = addr_desc->ReplyFrameAddress; | ||||
scsi_reply = mpi3mr_get_reply_virt_addr(sc, | scsi_reply = mpi3mr_get_reply_virt_addr(sc, | ||||
*reply_dma); | *reply_dma); | ||||
if (scsi_reply == NULL) { | if (scsi_reply == NULL) { | ||||
mpi3mr_dprint(sc, MPI3MR_ERROR, "scsi_reply is NULL, " | mpi3mr_dprint(sc, MPI3MR_ERROR, "scsi_reply is NULL, " | ||||
"this shouldn't happen, reply_desc: %p\n", | "this shouldn't happen, reply_desc: %p\n", | ||||
reply_desc); | reply_desc); | ||||
goto out; | goto out; | ||||
} | } | ||||
host_tag = scsi_reply->HostTag; | host_tag = scsi_reply->HostTag; | ||||
ioc_status = scsi_reply->IOCStatus; | ioc_status = scsi_reply->IOCStatus; | ||||
scsi_status = scsi_reply->SCSIStatus; | scsi_status = scsi_reply->SCSIStatus; | ||||
scsi_state = scsi_reply->SCSIState; | scsi_state = scsi_reply->SCSIState; | ||||
sense_state = (scsi_state & MPI3_SCSI_STATE_SENSE_MASK); | sense_state = (scsi_state & MPI3_SCSI_STATE_SENSE_MASK); | ||||
xfer_count = scsi_reply->TransferCount; | xfer_count = scsi_reply->TransferCount; | ||||
sense_count = scsi_reply->SenseCount; | sense_count = scsi_reply->SenseCount; | ||||
resp_data = scsi_reply->ResponseData; | resp_data = scsi_reply->ResponseData; | ||||
sense_buf = mpi3mr_get_sensebuf_virt_addr(sc, | sense_buf = mpi3mr_get_sensebuf_virt_addr(sc, | ||||
scsi_reply->SenseDataBufferAddress); | scsi_reply->SenseDataBufferAddress); | ||||
if (ioc_status & | if (ioc_status & MPI3_IOCSTATUS_STATUS_MASK) | ||||
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) | |||||
ioc_loginfo = scsi_reply->IOCLogInfo; | ioc_loginfo = scsi_reply->IOCLogInfo; | ||||
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; | ioc_status &= MPI3_IOCSTATUS_STATUS_MASK; | ||||
if (sense_state == MPI3_SCSI_STATE_SENSE_BUFF_Q_EMPTY) | if (sense_state == MPI3_SCSI_STATE_SENSE_BUFF_Q_EMPTY) | ||||
mpi3mr_dprint(sc, MPI3MR_ERROR, "Ran out of sense buffers\n"); | mpi3mr_dprint(sc, MPI3MR_ERROR, "Ran out of sense buffers\n"); | ||||
break; | break; | ||||
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS: | case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS: | ||||
success_desc = (Mpi3SuccessReplyDescriptor_t *)reply_desc; | success_desc = (Mpi3SuccessReplyDescriptor_t *)reply_desc; | ||||
host_tag = success_desc->HostTag; | host_tag = success_desc->HostTag; | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | case MPI3_IOCSTATUS_SCSI_DATA_OVERRUN: | ||||
/* resid is ignored for this condition */ | /* resid is ignored for this condition */ | ||||
csio->resid = 0; | csio->resid = 0; | ||||
mpi3mr_set_ccbstatus(ccb, CAM_DATA_RUN_ERR); | mpi3mr_set_ccbstatus(ccb, CAM_DATA_RUN_ERR); | ||||
break; | break; | ||||
case MPI3_IOCSTATUS_SCSI_DATA_UNDERRUN: | case MPI3_IOCSTATUS_SCSI_DATA_UNDERRUN: | ||||
csio->resid = cm->length - le32toh(xfer_count); | csio->resid = cm->length - le32toh(xfer_count); | ||||
case MPI3_IOCSTATUS_SCSI_RECOVERED_ERROR: | case MPI3_IOCSTATUS_SCSI_RECOVERED_ERROR: | ||||
case MPI3_IOCSTATUS_SUCCESS: | case MPI3_IOCSTATUS_SUCCESS: | ||||
if ((scsi_reply->IOCStatus & MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK) == | if ((scsi_reply->IOCStatus & MPI3_IOCSTATUS_STATUS_MASK) == | ||||
MPI3_IOCSTATUS_SCSI_RECOVERED_ERROR) | MPI3_IOCSTATUS_SCSI_RECOVERED_ERROR) | ||||
mpi3mr_dprint(sc, MPI3MR_XINFO, "func: %s line: %d recovered error\n", __func__, __LINE__); | mpi3mr_dprint(sc, MPI3MR_XINFO, "func: %s line: %d recovered error\n", __func__, __LINE__); | ||||
/* Completion failed at the transport level. */ | /* Completion failed at the transport level. */ | ||||
if (scsi_reply->SCSIState & (MPI3_SCSI_STATE_NO_SCSI_STATUS | | if (scsi_reply->SCSIState & (MPI3_SCSI_STATE_NO_SCSI_STATUS | | ||||
MPI3_SCSI_STATE_TERMINATED)) { | MPI3_SCSI_STATE_TERMINATED)) { | ||||
mpi3mr_set_ccbstatus(ccb, CAM_REQ_CMP_ERR); | mpi3mr_set_ccbstatus(ccb, CAM_REQ_CMP_ERR); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 1,417 Lines • Show Last 20 Lines |