autoCmdCmplt(ioport,thisCard); 
FPT_autoCmdCmplt(ioport,thisCard); 
int SccbMgr_isr(ULONG pCurrCard)#endif#endif{   PSCCB currSCCB;   UCHAR thisCard,result,bm_status, bm_int_st;   USHORT hp_int;   UCHAR i, target;#if defined(DOS)   USHORT ioport;#else   ULONG ioport;#endif   mOS_Lock((PSCCBcard)pCurrCard);   thisCard = ((PSCCBcard)pCurrCard)->cardIndex;   ioport = ((PSCCBcard)pCurrCard)->ioPort;   MDISABLE_INT(ioport);#if defined(BUGBUG)   WR_HARPOON(ioport+hp_user_defined_D, RD_HARPOON(ioport+hp_int_status));#endif   if ((bm_int_st=RD_HARPOON(ioport+hp_int_status)) & EXT_STATUS_ON)		bm_status = RD_HARPOON(ioport+hp_ext_status) & (UCHAR)BAD_EXT_STATUS;   else      bm_status = 0;   WR_HARPOON(ioport+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));   mOS_UnLock((PSCCBcard)pCurrCard);   while ((hp_int = RDW_HARPOON((ioport+hp_intstat)) & default_intena) |	  bm_status)     {       currSCCB = ((PSCCBcard)pCurrCard)->currentSCCB;#if defined(BUGBUG)   Debug_Load(thisCard,(UCHAR) 0XFF);   Debug_Load(thisCard,bm_int_st);   Debug_Load(thisCard,hp_int_0);   Debug_Load(thisCard,hp_int_1);#endif      if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) {         result = SccbMgr_bad_isr(ioport,thisCard,((PSCCBcard)pCurrCard),hp_int);         WRW_HARPOON((ioport+hp_intstat), (FIFO | TIMEOUT | RESET | SCAM_SEL));         bm_status = 0;         if (result) {			   mOS_Lock((PSCCBcard)pCurrCard);            MENABLE_INT(ioport);			   mOS_UnLock((PSCCBcard)pCurrCard);            return(result);            }         }      else if (hp_int & ICMD_COMP) {         if ( !(hp_int & BUS_FREE) ) {            /* Wait for the BusFree before starting a new command.  We               must also check for being reselected since the BusFree               may not show up if another device reselects us in 1.5us or               less.  SRR Wednesday, 3/8/1995.	         */	   while (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL))) ;	 }         if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT)            phaseChkFifo(ioport, thisCard);/*         WRW_HARPOON((ioport+hp_intstat),            (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0));         */		 WRW_HARPOON((ioport+hp_intstat), CLR_ALL_INT_1);         autoCmdCmplt(ioport,thisCard);         }      else if (hp_int & ITAR_DISC)         {         if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) {            phaseChkFifo(ioport, thisCard);            }         if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR) {            WR_HARPOON(ioport+hp_gp_reg_1, 0x00);            currSCCB->Sccb_XferState |= F_NO_DATA_YET;            currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC;            }         currSCCB->Sccb_scsistat = DISCONNECT_ST;         queueDisconnect(currSCCB,thisCard);            /* Wait for the BusFree before starting a new command.  We               must also check for being reselected since the BusFree               may not show up if another device reselects us in 1.5us or               less.  SRR Wednesday, 3/8/1995.             */	   while (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL)) &&		  !((RDW_HARPOON((ioport+hp_intstat)) & PHASE) &&		    RD_HARPOON((ioport+hp_scsisig)) ==		    (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG | SCSI_IOBIT))) ;	   /*	     The additional loop exit condition above detects a timing problem	     with the revision D/E harpoon chips.  The caller should reset the	     host adapter to recover when 0xFE is returned.	   */	   if (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL)))	     {	       mOS_Lock((PSCCBcard)pCurrCard);	       MENABLE_INT(ioport);	       mOS_UnLock((PSCCBcard)pCurrCard);	       return 0xFE;	     }         WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC));         ((PSCCBcard)pCurrCard)->globalFlags |= F_NEW_SCCB_CMD;      	}      else if (hp_int & RSEL) {         WRW_HARPOON((ioport+hp_intstat), (PROG_HLT | RSEL | PHASE | BUS_FREE));         if (RDW_HARPOON((ioport+hp_intstat)) & ITAR_DISC)		      {            if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT)			      {               phaseChkFifo(ioport, thisCard);               }            if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR)			      {               WR_HARPOON(ioport+hp_gp_reg_1, 0x00);               currSCCB->Sccb_XferState |= F_NO_DATA_YET;               currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC;               }            WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC));            currSCCB->Sccb_scsistat = DISCONNECT_ST;            queueDisconnect(currSCCB,thisCard);            }         sres(ioport,thisCard,((PSCCBcard)pCurrCard));         phaseDecode(ioport,thisCard);         }      else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE)))         {            WRW_HARPOON((ioport+hp_intstat), (IDO_STRT | XFER_CNT_0));            phaseDecode(ioport,thisCard);         }      else if ( (hp_int & IUNKWN) || (hp_int & PROG_HLT) )		   {	 	   WRW_HARPOON((ioport+hp_intstat), (PHASE | IUNKWN | PROG_HLT));	 	   if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (UCHAR)0x3f)< (UCHAR)SELCHK)	    		{	    		phaseDecode(ioport,thisCard);	    		}	 	   else	    		{   /* Harpoon problem some SCSI target device respond to selection   with short BUSY pulse (<400ns) this will make the Harpoon is not able   to latch the correct Target ID into reg. x53.   The work around require to correct this reg. But when write to this   reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we   need to read this reg first then restore it later. After update to 0x53 */	    		i = (UCHAR)(RD_HARPOON(ioport+hp_fifowrite));	    		target = (UCHAR)(RD_HARPOON(ioport+hp_gp_reg_3));	    		WR_HARPOON(ioport+hp_xfer_pad, (UCHAR) ID_UNLOCK);	    		WR_HARPOON(ioport+hp_select_id, (UCHAR)(target | target<<4));	    		WR_HARPOON(ioport+hp_xfer_pad, (UCHAR) 0x00);	    		WR_HARPOON(ioport+hp_fifowrite, i);	    		WR_HARPOON(ioport+hp_autostart_3, (AUTO_IMMED+TAG_STRT));	    		}	 	   }      else if (hp_int & XFER_CNT_0) {         WRW_HARPOON((ioport+hp_intstat), XFER_CNT_0);         schkdd(ioport,thisCard);         }      else if (hp_int & BUS_FREE) {         WRW_HARPOON((ioport+hp_intstat), BUS_FREE);        	if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) {           	hostDataXferAbort(ioport,thisCard,currSCCB);				}         phaseBusFree(ioport,thisCard);			}      else if (hp_int & ITICKLE) {         WRW_HARPOON((ioport+hp_intstat), ITICKLE);         ((PSCCBcard)pCurrCard)->globalFlags |= F_NEW_SCCB_CMD;         }      if (((PSCCBcard)pCurrCard)->globalFlags & F_NEW_SCCB_CMD) {         ((PSCCBcard)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD;         if (((PSCCBcard)pCurrCard)->currentSCCB == NULL) {            queueSearchSelect(((PSCCBcard)pCurrCard),thisCard);            }         if (((PSCCBcard)pCurrCard)->currentSCCB != NULL) {            ((PSCCBcard)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD;            ssel(ioport,thisCard);            }         break;         }      }  /*end while */   mOS_Lock((PSCCBcard)pCurrCard);   MENABLE_INT(ioport);   mOS_UnLock((PSCCBcard)pCurrCard);   return(0);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129/FlashPoint.c/buggy/drivers/scsi/FlashPoint.c