#if defined(COMPILER_16_BIT) && !defined(DOS) if (remain_cnt > (ULONG)(*(((ULONG far *)pCurrSCCB-> DataPointer) + (sg_ptr * 2)))) {  remain_cnt -= (ULONG)(*(((ULONG far *)pCurrSCCB-> DataPointer) + (sg_ptr * 2))); }  #else 
void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)#endif{   ULONG timeout;   ULONG remain_cnt;   UINT sg_ptr;   BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT;   if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) {      if (!(RD_HARPOON(port+hp_int_status) & INT_CMD_COMPL)) {         WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) | FLUSH_XFER_CNTR));         timeout = LONG_WAIT;         while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && timeout--) {}         WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) & ~FLUSH_XFER_CNTR));         if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {            if (busMstrTimeOut(port)) {               if (pCurrSCCB->HostStatus == 0x00)                  pCurrSCCB->HostStatus = SCCB_BM_ERR;               }            if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS)                if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS)                   if (pCurrSCCB->HostStatus == 0x00)                     {                     pCurrSCCB->HostStatus = SCCB_BM_ERR;#if defined(BUGBUG)                     WR_HARPOON(port+hp_dual_addr_lo,                        RD_HARPOON(port+hp_ext_status));#endif                     }            }         }      }   else if (pCurrSCCB->Sccb_XferCnt) {      if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {              WR_HARPOON(port+hp_page_ctrl, (RD_HARPOON(port+hp_page_ctrl) &            ~SCATTER_EN));         WR_HARPOON(port+hp_sg_addr,0x00);         sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT;         if (sg_ptr > (UINT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE)) {            sg_ptr = (UINT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);            }         remain_cnt = pCurrSCCB->Sccb_XferCnt;         while (remain_cnt < 0x01000000L) {            sg_ptr--;#if defined(COMPILER_16_BIT) && !defined(DOS)            if (remain_cnt > (ULONG)(*(((ULONG far *)pCurrSCCB->               DataPointer) + (sg_ptr * 2)))) {               remain_cnt -= (ULONG)(*(((ULONG far *)pCurrSCCB->                  DataPointer) + (sg_ptr * 2)));               }#else            if (remain_cnt > (ULONG)(*(((ULONG *)pCurrSCCB->               DataPointer) + (sg_ptr * 2)))) {               remain_cnt -= (ULONG)(*(((ULONG *)pCurrSCCB->                  DataPointer) + (sg_ptr * 2)));               }#endif            else {               break;               }            }         if (remain_cnt < 0x01000000L) {            pCurrSCCB->Sccb_SGoffset = remain_cnt;            pCurrSCCB->Sccb_sgseg = (USHORT)sg_ptr;            if ((ULONG)(sg_ptr * SG_ELEMENT_SIZE) == pCurrSCCB->DataLength                 && (remain_cnt == 0))               pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;            }         else {            if (pCurrSCCB->HostStatus == 0x00) {               pCurrSCCB->HostStatus = SCCB_GROSS_FW_ERR;               }            }         }      if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) {         if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {            busMstrTimeOut(port);            }         else {            if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) {               if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) {                  if (pCurrSCCB->HostStatus == 0x00) {                     pCurrSCCB->HostStatus = SCCB_BM_ERR;#if defined(BUGBUG)                     WR_HARPOON(port+hp_dual_addr_lo,                        RD_HARPOON(port+hp_ext_status));#endif                     }                  }               }            }         }      else {         if ((RD_HARPOON(port+hp_fifo_cnt)) >= BM_THRESHOLD) {            timeout = SHORT_WAIT;            while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) &&               ((RD_HARPOON(port+hp_fifo_cnt)) >= BM_THRESHOLD) &&               timeout--) {}            }         if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {            WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) |               FLUSH_XFER_CNTR));            timeout = LONG_WAIT;            while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) &&               timeout--) {}            WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) &               ~FLUSH_XFER_CNTR));            if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {               if (pCurrSCCB->HostStatus == 0x00) {                  pCurrSCCB->HostStatus = SCCB_BM_ERR;                  }               busMstrTimeOut(port);               }            }         if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) {            if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) {               if (pCurrSCCB->HostStatus == 0x00) {                  pCurrSCCB->HostStatus = SCCB_BM_ERR;#if defined(BUGBUG)                  WR_HARPOON(port+hp_dual_addr_lo,                     RD_HARPOON(port+hp_ext_status));#endif                  }               }            }         }      }   else {      if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {         timeout = LONG_WAIT;         while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && timeout--) {}         if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) {            if (pCurrSCCB->HostStatus == 0x00) {               pCurrSCCB->HostStatus = SCCB_BM_ERR;               }            busMstrTimeOut(port);            }         }      if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) {         if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) {            if (pCurrSCCB->HostStatus == 0x00) {               pCurrSCCB->HostStatus = SCCB_BM_ERR;#if defined(BUGBUG)               WR_HARPOON(port+hp_dual_addr_lo,                  RD_HARPOON(port+hp_ext_status));#endif               }            }         }      if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {         WR_HARPOON(port+hp_page_ctrl, (RD_HARPOON(port+hp_page_ctrl) &                 ~SCATTER_EN));         WR_HARPOON(port+hp_sg_addr,0x00);         pCurrSCCB->Sccb_sgseg += SG_BUF_CNT;         pCurrSCCB->Sccb_SGoffset = 0x00;          if ((ULONG)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=            pCurrSCCB->DataLength) {            pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;            pCurrSCCB->Sccb_sgseg = (USHORT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);            }         }      else {         if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE))            pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;         }      }   WR_HARPOON(port+hp_int_mask,(INT_CMD_COMPL | SCSI_INTERRUPT));}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129/FlashPoint.c/buggy/drivers/scsi/FlashPoint.c