📄 isp_target.c
字号:
{ int lun; if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) { lun = aep->at_scclun; } else { lun = aep->at_lun; } /* * The firmware status (except for the QLTM_SVALID bit) indicates * why this ATIO was sent to us. * * If QLTM_SVALID is set, the firware has recommended Sense Data. * * If the DISCONNECTS DISABLED bit is set in the flags field, * we're still connected on the SCSI bus - i.e. the initiator * did not set DiscPriv in the identify message. We don't care * about this so it's ignored. */ switch(aep->at_status & ~QLTM_SVALID) { case AT_PATH_INVALID: /* * ATIO rejected by the firmware due to disabled lun. */ isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for disabled lun %d", lun); break; case AT_NOCAP: /* * Requested Capability not available * We sent an ATIO that overflowed the firmware's * command resource count. */ isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for lun %d- command count overflow", lun); break; case AT_BDR_MSG: /* * If we send an ATIO to the firmware to increment * its command resource count, and the firmware is * recovering from a Bus Device Reset, it returns * the ATIO with this status. We set the command * resource count in the Enable Lun entry and no * not increment it. Therefore we should never get * this status here. */ isp_prt(isp, ISP_LOGERR, atiocope, lun, 0); break; case AT_CDB: /* Got a CDB */ /* * Punt to platform specific layer. */ (void) isp_async(isp, ISPASYNC_TARGET_ACTION, aep); break; case AT_RESET: /* * A bus reset came along an blew away this command. Why * they do this in addition the async event code stuff, * I dunno. * * Ignore it because the async event will clear things * up for us. */ isp_prt(isp, ISP_LOGERR, atior, lun, aep->at_iid, 0); break; default: isp_prt(isp, ISP_LOGERR, "Unknown ATIO2 status 0x%x from initiator %d for lun %d", aep->at_status, aep->at_iid, lun); (void) isp_target_put_atio(isp, aep); break; }}static voidisp_handle_ctio(struct ispsoftc *isp, ct_entry_t *ct){ void *xs; int pl = ISP_LOGTDEBUG2; char *fmsg = NULL; if (ct->ct_syshandle) { xs = isp_find_xs(isp, ct->ct_syshandle); if (xs == NULL) pl = ISP_LOGALL; } else { xs = NULL; } switch(ct->ct_status & ~QLTM_SVALID) { case CT_OK: /* * There are generally 3 possibilities as to why we'd get * this condition: * We disconnected after receiving a CDB. * We sent or received data. * We sent status & command complete. */ if (ct->ct_flags & CT_SENDSTATUS) { break; } else if ((ct->ct_flags & CT_DATAMASK) == CT_NO_DATA) { /* * Nothing to do in this case. */ isp_prt(isp, pl, "CTIO- iid %d disconnected OK", ct->ct_iid); return; } break; case CT_BDR_MSG: /* * Bus Device Reset message received or the SCSI Bus has * been Reset; the firmware has gone to Bus Free. * * The firmware generates an async mailbox interupt to * notify us of this and returns outstanding CTIOs with this * status. These CTIOs are handled in that same way as * CT_ABORTED ones, so just fall through here. */ fmsg = "Bus Device Reset"; /*FALLTHROUGH*/ case CT_RESET: if (fmsg == NULL) fmsg = "Bus Reset"; /*FALLTHROUGH*/ case CT_ABORTED: /* * When an Abort message is received the firmware goes to * Bus Free and returns all outstanding CTIOs with the status * set, then sends us an Immediate Notify entry. */ if (fmsg == NULL) fmsg = "ABORT TAG message sent by Initiator"; isp_prt(isp, ISP_LOGWARN, "CTIO destroyed by %s", fmsg); break; case CT_INVAL: /* * CTIO rejected by the firmware due to disabled lun. * "Cannot Happen". */ isp_prt(isp, ISP_LOGERR, "Firmware rejected CTIO for disabled lun %d", ct->ct_lun); break; case CT_NOPATH: /* * CTIO rejected by the firmware due "no path for the * nondisconnecting nexus specified". This means that * we tried to access the bus while a non-disconnecting * command is in process. */ isp_prt(isp, ISP_LOGERR, "Firmware rejected CTIO for bad nexus %d/%d/%d", ct->ct_iid, ct->ct_tgt, ct->ct_lun); break; case CT_RSELTMO: fmsg = "Reselection"; /*FALLTHROUGH*/ case CT_TIMEOUT: if (fmsg == NULL) fmsg = "Command"; isp_prt(isp, ISP_LOGERR, "Firmware timed out on %s", fmsg); break; case CT_PANIC: if (fmsg == NULL) fmsg = "Unrecoverable Error"; /*FALLTHROUGH*/ case CT_ERR: if (fmsg == NULL) fmsg = "Completed with Error"; /*FALLTHROUGH*/ case CT_PHASE_ERROR: if (fmsg == NULL) fmsg = "Phase Sequence Error"; /*FALLTHROUGH*/ case CT_TERMINATED: if (fmsg == NULL) fmsg = "terminated by TERMINATE TRANSFER"; /*FALLTHROUGH*/ case CT_NOACK: if (fmsg == NULL) fmsg = "unacknowledged Immediate Notify pending"; isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg); break; default: isp_prt(isp, ISP_LOGERR, "Unknown CTIO status 0x%x", ct->ct_status & ~QLTM_SVALID); break; } if (xs == NULL) { /* * There may be more than one CTIO for a data transfer, * or this may be a status CTIO we're not monitoring. * * The assumption is that they'll all be returned in the * order we got them. */ if (ct->ct_syshandle == 0) { if ((ct->ct_flags & CT_SENDSTATUS) == 0) { isp_prt(isp, pl, "intermediate CTIO completed ok"); } else { isp_prt(isp, pl, "unmonitored CTIO completed ok"); } } else { isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID); } } else { /* * Final CTIO completed. Release DMA resources and * notify platform dependent layers. */ if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) { ISP_DMAFREE(isp, xs, ct->ct_syshandle); } isp_prt(isp, pl, "final CTIO complete"); /* * The platform layer will destroy the handle if appropriate. */ (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); }}static voidisp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct){ XS_T *xs; int pl = ISP_LOGTDEBUG2; char *fmsg = NULL; if (ct->ct_syshandle) { xs = isp_find_xs(isp, ct->ct_syshandle); if (xs == NULL) pl = ISP_LOGALL; } else { xs = NULL; } switch(ct->ct_status & ~QLTM_SVALID) { case CT_BUS_ERROR: isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error"); /* FALL Through */ case CT_DATA_OVER: case CT_DATA_UNDER: case CT_OK: /* * There are generally 2 possibilities as to why we'd get * this condition: * We sent or received data. * We sent status & command complete. */ break; case CT_BDR_MSG: /* * Target Reset function received. * * The firmware generates an async mailbox interupt to * notify us of this and returns outstanding CTIOs with this * status. These CTIOs are handled in that same way as * CT_ABORTED ones, so just fall through here. */ fmsg = "TARGET RESET Task Management Function Received"; /*FALLTHROUGH*/ case CT_RESET: if (fmsg == NULL) fmsg = "LIP Reset"; /*FALLTHROUGH*/ case CT_ABORTED: /* * When an Abort message is received the firmware goes to * Bus Free and returns all outstanding CTIOs with the status * set, then sends us an Immediate Notify entry. */ if (fmsg == NULL) fmsg = "ABORT Task Management Function Received"; isp_prt(isp, ISP_LOGERR, "CTIO2 destroyed by %s", fmsg); break; case CT_INVAL: /* * CTIO rejected by the firmware - invalid data direction. */ isp_prt(isp, ISP_LOGERR, "CTIO2 had wrong data directiond"); break; case CT_RSELTMO: fmsg = "failure to reconnect to initiator"; /*FALLTHROUGH*/ case CT_TIMEOUT: if (fmsg == NULL) fmsg = "command"; isp_prt(isp, ISP_LOGERR, "Firmware timed out on %s", fmsg); break; case CT_ERR: fmsg = "Completed with Error"; /*FALLTHROUGH*/ case CT_LOGOUT: if (fmsg == NULL) fmsg = "Port Logout"; /*FALLTHROUGH*/ case CT_PORTNOTAVAIL: if (fmsg == NULL) fmsg = "Port not available"; case CT_PORTCHANGED: if (fmsg == NULL) fmsg = "Port Changed"; case CT_NOACK: if (fmsg == NULL) fmsg = "unacknowledged Immediate Notify pending"; isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg); break; case CT_INVRXID: /* * CTIO rejected by the firmware because an invalid RX_ID. * Just print a message. */ isp_prt(isp, ISP_LOGERR, "CTIO2 completed with Invalid RX_ID 0x%x", ct->ct_rxid); break; default: isp_prt(isp, ISP_LOGERR, "Unknown CTIO2 status 0x%x", ct->ct_status & ~QLTM_SVALID); break; } if (xs == NULL) { /* * There may be more than one CTIO for a data transfer, * or this may be a status CTIO we're not monitoring. * * The assumption is that they'll all be returned in the * order we got them. */ if (ct->ct_syshandle == 0) { if ((ct->ct_flags & CT_SENDSTATUS) == 0) { isp_prt(isp, pl, "intermediate CTIO completed ok"); } else { isp_prt(isp, pl, "unmonitored CTIO completed ok"); } } else { isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID); } } else { if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) { ISP_DMAFREE(isp, xs, ct->ct_syshandle); } if (ct->ct_flags & CT_SENDSTATUS) { /* * Sent status and command complete. * * We're now really done with this command, so we * punt to the platform dependent layers because * only there can we do the appropriate command * complete thread synchronization. */ isp_prt(isp, pl, "status CTIO complete"); } else { /* * Final CTIO completed. Release DMA resources and * notify platform dependent layers. */ isp_prt(isp, pl, "data CTIO complete"); } (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); /* * The platform layer will destroy the handle if appropriate. */ }}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -