in FlashPoint.c [4615:4865]
static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card)
{
struct sccb *currSCCB;
unsigned char status_byte;
currSCCB = FPT_BL_Card[p_card].currentSCCB;
status_byte = RD_HARPOON(p_port + hp_gp_reg_0);
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0;
if (status_byte != SAM_STAT_GOOD) {
if (status_byte == SAM_STAT_TASK_SET_FULL) {
if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[currSCCB->Lun] = 1;
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[currSCCB->Lun]] =
NULL;
} else {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[0] = 1;
if (currSCCB->Sccb_tag) {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
Sccb_tag]
= NULL;
} else {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[0]] = NULL;
}
}
currSCCB->Sccb_MGRFlags |= F_STATUSLOADED;
FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
return;
}
if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
(unsigned char)SYNC_SUPPORTED;
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
~EE_SYNC_MASK;
FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[currSCCB->Lun] = 1;
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[currSCCB->Lun]] =
NULL;
} else {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[0] = 1;
if (currSCCB->Sccb_tag) {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
Sccb_tag]
= NULL;
} else {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[0]] = NULL;
}
}
return;
}
if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
(FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
~EE_WIDE_SCSI;
FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[currSCCB->Lun] = 1;
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[currSCCB->Lun]] =
NULL;
} else {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUNBusy[0] = 1;
if (currSCCB->Sccb_tag) {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
Sccb_tag]
= NULL;
} else {
if (FPT_BL_Card[p_card].discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
LunDiscQ_Idx[0]] = NULL;
}
}
return;
}
if (status_byte == SAM_STAT_CHECK_CONDITION) {
if (FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) {
if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarEEValue & EE_SYNC_MASK) {
FPT_sccbMgrTbl[p_card][currSCCB->
TargID].
TarStatus &= ~TAR_SYNC_MASK;
}
if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarEEValue & EE_WIDE_SCSI) {
FPT_sccbMgrTbl[p_card][currSCCB->
TargID].
TarStatus &= ~TAR_WIDE_MASK;
}
}
}
if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) {
currSCCB->SccbStatus = SCCB_ERROR;
currSCCB->TargetStatus = status_byte;
if (status_byte == SAM_STAT_CHECK_CONDITION) {
FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarLUN_CA = 1;
if (currSCCB->RequestSenseLength !=
NO_AUTO_REQUEST_SENSE) {
if (currSCCB->RequestSenseLength == 0)
currSCCB->RequestSenseLength =
14;
FPT_ssenss(&FPT_BL_Card[p_card]);
FPT_BL_Card[p_card].globalFlags |=
F_NEW_SCCB_CMD;
if (((FPT_BL_Card[p_card].
globalFlags & F_CONLUN_IO)
&&
((FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
TarStatus & TAR_TAG_Q_MASK) !=
TAG_Q_TRYING))) {
FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
TarLUNBusy[currSCCB->Lun] =
1;
if (FPT_BL_Card[p_card].
discQCount != 0)
FPT_BL_Card[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[FPT_sccbMgrTbl
[p_card]
[currSCCB->
TargID].
LunDiscQ_Idx
[currSCCB->Lun]] =
NULL;
} else {
FPT_sccbMgrTbl[p_card]
[currSCCB->TargID].
TarLUNBusy[0] = 1;
if (currSCCB->Sccb_tag) {
if (FPT_BL_Card[p_card].
discQCount != 0)
FPT_BL_Card
[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl[currSCCB->
Sccb_tag]
= NULL;
} else {
if (FPT_BL_Card[p_card].
discQCount != 0)
FPT_BL_Card
[p_card].
discQCount--;
FPT_BL_Card[p_card].
discQ_Tbl
[FPT_sccbMgrTbl
[p_card][currSCCB->
TargID].
LunDiscQ_Idx[0]] =
NULL;
}
}
return;
}
}
}
}
if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->
Lun] = 0;
else
FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0;
FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card);
}