Searched refs:asc_dvc (Results 1 - 1 of 1) sorted by relevance

/linux-4.4.14/drivers/scsi/
H A Dadvansys.c1988 #define AdvAbortQueue(asc_dvc, srb_tag) \
1989 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_ABORT, \
2003 #define AdvResetDevice(asc_dvc, target_id) \
2004 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_DEVICE_RESET, \
2297 #define asc_dvc_to_board(asc_dvc) container_of(asc_dvc, struct asc_board, \
3720 static bool AscResetChipAndScsiBus(ASC_DVC_VAR *asc_dvc) AscResetChipAndScsiBus() argument
3725 iop_base = asc_dvc->iop_base; AscResetChipAndScsiBus()
3915 static void AscInitLram(ASC_DVC_VAR *asc_dvc) AscInitLram() argument
3921 iop_base = asc_dvc->iop_base; AscInitLram()
3923 (ushort)(((int)(asc_dvc->max_total_qng + 2 + 1) * AscInitLram()
3930 (uchar)(asc_dvc->max_total_qng)); AscInitLram()
3935 for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) { AscInitLram()
3946 (uchar)(asc_dvc->max_total_qng - 1)); AscInitLram()
3948 (uchar)asc_dvc->max_total_qng); AscInitLram()
3951 for (; i <= (uchar)(asc_dvc->max_total_qng + 3); AscInitLram()
3989 static void AscInitQLinkVar(ASC_DVC_VAR *asc_dvc) AscInitQLinkVar() argument
3995 iop_base = asc_dvc->iop_base; AscInitQLinkVar()
3997 AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng); AscInitQLinkVar()
3999 AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng); AscInitQLinkVar()
4001 (uchar)((int)asc_dvc->max_total_qng + 1)); AscInitQLinkVar()
4003 (uchar)((int)asc_dvc->max_total_qng + 2)); AscInitQLinkVar()
4005 asc_dvc->max_total_qng); AscInitQLinkVar()
4018 static int AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc) AscInitMicroCodeVar() argument
4025 struct asc_board *board = asc_dvc_to_board(asc_dvc); AscInitMicroCodeVar()
4027 iop_base = asc_dvc->iop_base; AscInitMicroCodeVar()
4031 asc_dvc->cfg->sdtr_period_offset[i]); AscInitMicroCodeVar()
4034 AscInitQLinkVar(asc_dvc); AscInitMicroCodeVar()
4036 asc_dvc->cfg->disc_enable); AscInitMicroCodeVar()
4038 ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id)); AscInitMicroCodeVar()
4041 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7); AscInitMicroCodeVar()
4042 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf, AscInitMicroCodeVar()
4044 if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) { AscInitMicroCodeVar()
4048 phy_addr = cpu_to_le32(asc_dvc->overrun_dma); AscInitMicroCodeVar()
4055 asc_dvc->cfg->mcode_date = AscInitMicroCodeVar()
4057 asc_dvc->cfg->mcode_version = AscInitMicroCodeVar()
4062 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; AscInitMicroCodeVar()
4067 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; AscInitMicroCodeVar()
4075 dma_unmap_single(board->dev, asc_dvc->overrun_dma, AscInitMicroCodeVar()
4078 asc_dvc->overrun_dma = 0; AscInitMicroCodeVar()
4082 static int AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc) AscInitAsc1000Driver() argument
4091 iop_base = asc_dvc->iop_base; AscInitAsc1000Driver()
4093 if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) && AscInitAsc1000Driver()
4094 !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) { AscInitAsc1000Driver()
4095 AscResetChipAndScsiBus(asc_dvc); AscInitAsc1000Driver()
4096 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ AscInitAsc1000Driver()
4098 asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC; AscInitAsc1000Driver()
4099 if (asc_dvc->err_code != 0) AscInitAsc1000Driver()
4101 if (!AscFindSignature(asc_dvc->iop_base)) { AscInitAsc1000Driver()
4102 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; AscInitAsc1000Driver()
4106 AscInitLram(asc_dvc); AscInitAsc1000Driver()
4108 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); AscInitAsc1000Driver()
4112 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; AscInitAsc1000Driver()
4119 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; AscInitAsc1000Driver()
4127 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; AscInitAsc1000Driver()
4132 warn_code |= AscInitMicroCodeVar(asc_dvc); AscInitAsc1000Driver()
4133 if (!asc_dvc->overrun_dma) AscInitAsc1000Driver()
4135 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC; AscInitAsc1000Driver()
4295 AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc, AdvSendIdleCmd() argument
4301 iop_base = asc_dvc->iop_base; AdvSendIdleCmd()
4324 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { AdvSendIdleCmd()
4358 static int AdvResetSB(ADV_DVC_VAR *asc_dvc) AdvResetSB() argument
4366 status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_START, 0L); AdvResetSB()
4383 status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_END, 0L); AdvResetSB()
4388 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ AdvResetSB()
4403 static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc) AdvInitAsc3550Driver() argument
4423 if (asc_dvc->err_code != 0) AdvInitAsc3550Driver()
4429 if (asc_dvc->chip_type != ADV_CHIP_ASC3550) { AdvInitAsc3550Driver()
4430 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; AdvInitAsc3550Driver()
4435 iop_base = asc_dvc->iop_base; AdvInitAsc3550Driver()
4474 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); AdvInitAsc3550Driver()
4478 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc3550Driver()
4485 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc3550Driver()
4490 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], AdvInitAsc3550Driver()
4494 if (asc_dvc->err_code) AdvInitAsc3550Driver()
4522 asc_dvc->cfg->mcode_date); AdvInitAsc3550Driver()
4524 asc_dvc->cfg->mcode_version); AdvInitAsc3550Driver()
4537 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { AdvInitAsc3550Driver()
4562 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { AdvInitAsc3550Driver()
4564 asc_dvc->wdtr_able); AdvInitAsc3550Driver()
4566 asc_dvc->sdtr_able); AdvInitAsc3550Driver()
4593 if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able) { AdvInitAsc3550Driver()
4619 asc_dvc->cfg->disc_enable); AdvInitAsc3550Driver()
4629 asc_dvc->chip_scsi_id); AdvInitAsc3550Driver()
4646 asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION; AdvInitAsc3550Driver()
4656 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; AdvInitAsc3550Driver()
4665 asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE; AdvInitAsc3550Driver()
4677 if (asc_dvc->cfg->termination == 0) { AdvInitAsc3550Driver()
4682 asc_dvc->cfg->termination |= TERM_CTL_SEL; AdvInitAsc3550Driver()
4692 asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L); AdvInitAsc3550Driver()
4701 asc_dvc->cfg->termination |= TERM_CTL_H; AdvInitAsc3550Driver()
4722 scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL)); AdvInitAsc3550Driver()
4757 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); AdvInitAsc3550Driver()
4759 AdvBuildCarrierFreelist(asc_dvc); AdvInitAsc3550Driver()
4765 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc3550Driver()
4766 if (!asc_dvc->icq_sp) { AdvInitAsc3550Driver()
4767 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc3550Driver()
4774 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); AdvInitAsc3550Driver()
4779 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc3550Driver()
4780 if (!asc_dvc->irq_sp) { AdvInitAsc3550Driver()
4781 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc3550Driver()
4788 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); AdvInitAsc3550Driver()
4789 asc_dvc->carr_pending_cnt = 0; AdvInitAsc3550Driver()
4806 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { AdvInitAsc3550Driver()
4827 if (AdvResetSB(asc_dvc) != ADV_TRUE) { AdvInitAsc3550Driver()
4846 static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc) AdvInitAsc38C0800Driver() argument
4867 if (asc_dvc->err_code != 0) AdvInitAsc38C0800Driver()
4873 if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800) { AdvInitAsc38C0800Driver()
4874 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; AdvInitAsc38C0800Driver()
4879 iop_base = asc_dvc->iop_base; AdvInitAsc38C0800Driver()
4940 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; AdvInitAsc38C0800Driver()
4948 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; AdvInitAsc38C0800Driver()
4966 asc_dvc->bist_err_code = byte; /* for BIOS display message */ AdvInitAsc38C0800Driver()
4967 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; AdvInitAsc38C0800Driver()
4974 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); AdvInitAsc38C0800Driver()
4978 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc38C0800Driver()
4985 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc38C0800Driver()
4990 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], AdvInitAsc38C0800Driver()
4994 if (asc_dvc->err_code) AdvInitAsc38C0800Driver()
5022 asc_dvc->cfg->mcode_date); AdvInitAsc38C0800Driver()
5024 asc_dvc->cfg->mcode_version); AdvInitAsc38C0800Driver()
5049 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { AdvInitAsc38C0800Driver()
5079 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { AdvInitAsc38C0800Driver()
5081 asc_dvc->wdtr_able); AdvInitAsc38C0800Driver()
5083 asc_dvc->sdtr_able); AdvInitAsc38C0800Driver()
5096 asc_dvc->cfg->disc_enable); AdvInitAsc38C0800Driver()
5097 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); AdvInitAsc38C0800Driver()
5098 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); AdvInitAsc38C0800Driver()
5099 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); AdvInitAsc38C0800Driver()
5100 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); AdvInitAsc38C0800Driver()
5110 asc_dvc->chip_scsi_id); AdvInitAsc38C0800Driver()
5128 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; AdvInitAsc38C0800Driver()
5144 asc_dvc->err_code = ASC_IERR_HVD_DEVICE; AdvInitAsc38C0800Driver()
5156 if ((asc_dvc->cfg->termination & TERM_SE) == 0) { AdvInitAsc38C0800Driver()
5163 asc_dvc->cfg->termination |= TERM_SE; AdvInitAsc38C0800Driver()
5168 asc_dvc->cfg->termination |= TERM_SE_HI; AdvInitAsc38C0800Driver()
5173 if ((asc_dvc->cfg->termination & TERM_LVD) == 0) { AdvInitAsc38C0800Driver()
5180 asc_dvc->cfg->termination |= TERM_LVD; AdvInitAsc38C0800Driver()
5197 scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0); AdvInitAsc38C0800Driver()
5238 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); AdvInitAsc38C0800Driver()
5240 AdvBuildCarrierFreelist(asc_dvc); AdvInitAsc38C0800Driver()
5246 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc38C0800Driver()
5247 if (!asc_dvc->icq_sp) { AdvInitAsc38C0800Driver()
5249 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc38C0800Driver()
5257 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); AdvInitAsc38C0800Driver()
5262 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc38C0800Driver()
5263 if (!asc_dvc->irq_sp) { AdvInitAsc38C0800Driver()
5265 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc38C0800Driver()
5274 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); AdvInitAsc38C0800Driver()
5275 asc_dvc->carr_pending_cnt = 0; AdvInitAsc38C0800Driver()
5292 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { AdvInitAsc38C0800Driver()
5313 if (AdvResetSB(asc_dvc) != ADV_TRUE) { AdvInitAsc38C0800Driver()
5332 static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) AdvInitAsc38C1600Driver() argument
5353 if (asc_dvc->err_code != 0) { AdvInitAsc38C1600Driver()
5360 if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { AdvInitAsc38C1600Driver()
5361 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; AdvInitAsc38C1600Driver()
5366 iop_base = asc_dvc->iop_base; AdvInitAsc38C1600Driver()
5428 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; AdvInitAsc38C1600Driver()
5436 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; AdvInitAsc38C1600Driver()
5454 asc_dvc->bist_err_code = byte; /* for BIOS display message */ AdvInitAsc38C1600Driver()
5455 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; AdvInitAsc38C1600Driver()
5462 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); AdvInitAsc38C1600Driver()
5466 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc38C1600Driver()
5473 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; AdvInitAsc38C1600Driver()
5478 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], AdvInitAsc38C1600Driver()
5482 if (asc_dvc->err_code) AdvInitAsc38C1600Driver()
5510 asc_dvc->cfg->mcode_date); AdvInitAsc38C1600Driver()
5512 asc_dvc->cfg->mcode_version); AdvInitAsc38C1600Driver()
5537 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { AdvInitAsc38C1600Driver()
5549 if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0) { AdvInitAsc38C1600Driver()
5574 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { AdvInitAsc38C1600Driver()
5576 asc_dvc->wdtr_able); AdvInitAsc38C1600Driver()
5578 asc_dvc->sdtr_able); AdvInitAsc38C1600Driver()
5591 asc_dvc->cfg->disc_enable); AdvInitAsc38C1600Driver()
5592 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); AdvInitAsc38C1600Driver()
5593 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); AdvInitAsc38C1600Driver()
5594 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); AdvInitAsc38C1600Driver()
5595 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); AdvInitAsc38C1600Driver()
5605 asc_dvc->chip_scsi_id); AdvInitAsc38C1600Driver()
5624 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; AdvInitAsc38C1600Driver()
5637 asc_dvc->err_code |= ASC_IERR_HVD_DEVICE; AdvInitAsc38C1600Driver()
5654 if ((asc_dvc->cfg->termination & TERM_SE) == 0) { AdvInitAsc38C1600Driver()
5655 struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); AdvInitAsc38C1600Driver()
5662 asc_dvc->cfg->termination |= TERM_SE; AdvInitAsc38C1600Driver()
5670 asc_dvc->cfg->termination |= TERM_SE_HI; AdvInitAsc38C1600Driver()
5684 scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE); AdvInitAsc38C1600Driver()
5735 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); AdvInitAsc38C1600Driver()
5737 AdvBuildCarrierFreelist(asc_dvc); AdvInitAsc38C1600Driver()
5742 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc38C1600Driver()
5743 if (!asc_dvc->icq_sp) { AdvInitAsc38C1600Driver()
5744 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc38C1600Driver()
5753 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); AdvInitAsc38C1600Driver()
5755 le32_to_cpu(asc_dvc->icq_sp->carr_pa)); AdvInitAsc38C1600Driver()
5760 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); AdvInitAsc38C1600Driver()
5761 if (!asc_dvc->irq_sp) { AdvInitAsc38C1600Driver()
5762 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; AdvInitAsc38C1600Driver()
5769 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); AdvInitAsc38C1600Driver()
5770 asc_dvc->carr_pending_cnt = 0; AdvInitAsc38C1600Driver()
5786 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { AdvInitAsc38C1600Driver()
5807 if (AdvResetSB(asc_dvc) != ADV_TRUE) { AdvInitAsc38C1600Driver()
5823 static int AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc) AdvResetChipAndSB() argument
5832 iop_base = asc_dvc->iop_base; AdvResetChipAndSB()
5839 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { AdvResetChipAndSB()
5870 asc_dvc->err_code = 0; AdvResetChipAndSB()
5871 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { AdvResetChipAndSB()
5872 status = AdvInitAsc38C1600Driver(asc_dvc); AdvResetChipAndSB()
5873 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { AdvResetChipAndSB()
5874 status = AdvInitAsc38C0800Driver(asc_dvc); AdvResetChipAndSB()
5876 status = AdvInitAsc3550Driver(asc_dvc); AdvResetChipAndSB()
5896 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { AdvResetChipAndSB()
6116 static int AdvISR(ADV_DVC_VAR *asc_dvc) AdvISR() argument
6126 iop_base = asc_dvc->iop_base; AdvISR()
6146 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || AdvISR()
6147 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { AdvISR()
6149 asc_dvc->carr_pending_cnt != 0) { AdvISR()
6152 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { AdvISR()
6160 adv_async_callback(asc_dvc, intrb_code); AdvISR()
6167 le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ADV_RQ_DONE) != 0) { AdvISR()
6177 u32 pa_offset = le32_to_cpu(asc_dvc->irq_sp->areq_vpa); AdvISR()
6179 asc_dvc->irq_sp, pa_offset); AdvISR()
6180 reqp = adv_get_reqp(asc_dvc, pa_offset); AdvISR()
6199 free_carrp = asc_dvc->irq_sp; AdvISR()
6200 asc_dvc->irq_sp = adv_get_carrier(asc_dvc, AdvISR()
6203 free_carrp->next_vpa = asc_dvc->carr_freelist->carr_va; AdvISR()
6204 asc_dvc->carr_freelist = free_carrp; AdvISR()
6205 asc_dvc->carr_pending_cnt--; AdvISR()
6218 adv_isr_callback(asc_dvc, scsiq); AdvISR()
6230 static int AscSetLibErrorCode(ASC_DVC_VAR *asc_dvc, ushort err_code) AscSetLibErrorCode() argument
6232 if (asc_dvc->err_code == 0) { AscSetLibErrorCode()
6233 asc_dvc->err_code = err_code; AscSetLibErrorCode()
6234 AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W, AscSetLibErrorCode()
6269 static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time) AscGetSynPeriodIndex() argument
6276 period_table = asc_dvc->sdtr_period_tbl; AscGetSynPeriodIndex()
6277 max_index = (int)asc_dvc->max_sdtr_index; AscGetSynPeriodIndex()
6278 min_index = (int)asc_dvc->min_sdtr_index; AscGetSynPeriodIndex()
6292 AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset) AscMsgOutSDTR() argument
6298 iop_base = asc_dvc->iop_base; AscMsgOutSDTR()
6305 sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period); AscMsgOutSDTR()
6306 if (sdtr_period_index <= asc_dvc->max_sdtr_index) { AscMsgOutSDTR()
6321 AscCalSDTRData(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar syn_offset) AscCalSDTRData() argument
6326 sdtr_period_ix = AscGetSynPeriodIndex(asc_dvc, sdtr_period); AscCalSDTRData()
6327 if (sdtr_period_ix > asc_dvc->max_sdtr_index) AscCalSDTRData()
6368 static void AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) AscIsrChipHalted() argument
6389 BUG_ON(!asc_dvc->drv_ptr); AscIsrChipHalted()
6390 boardp = asc_dvc->drv_ptr; AscIsrChipHalted()
6392 iop_base = asc_dvc->iop_base; AscIsrChipHalted()
6404 if (asc_dvc->pci_fix_asyn_xfer & target_id) { AscIsrChipHalted()
6410 if (asc_dvc->pci_fix_asyn_xfer & target_id) { AscIsrChipHalted()
6417 if (asc_dvc->pci_fix_asyn_xfer & target_id) { AscIsrChipHalted()
6439 asc_dvc->sdtr_period_tbl[asc_dvc->min_sdtr_index]) AscIsrChipHalted()
6441 asc_dvc->sdtr_period_tbl[asc_dvc-> AscIsrChipHalted()
6445 asc_dvc->sdtr_period_tbl[asc_dvc-> AscIsrChipHalted()
6450 AscCalSDTRData(asc_dvc, ext_msg.xfer_period, AscIsrChipHalted()
6455 asc_dvc->init_sdtr &= ~target_id; AscIsrChipHalted()
6456 asc_dvc->sdtr_done &= ~target_id; AscIsrChipHalted()
6465 asc_dvc->init_sdtr &= ~target_id; AscIsrChipHalted()
6466 asc_dvc->sdtr_done &= ~target_id; AscIsrChipHalted()
6471 asc_dvc->sdtr_done |= target_id; AscIsrChipHalted()
6472 asc_dvc->init_sdtr |= target_id; AscIsrChipHalted()
6473 asc_dvc->pci_fix_asyn_xfer &= AscIsrChipHalted()
6476 AscCalSDTRData(asc_dvc, AscIsrChipHalted()
6485 AscMsgOutSDTR(asc_dvc, AscIsrChipHalted()
6488 asc_dvc->pci_fix_asyn_xfer &= AscIsrChipHalted()
6491 AscCalSDTRData(asc_dvc, AscIsrChipHalted()
6498 asc_dvc->sdtr_done |= target_id; AscIsrChipHalted()
6499 asc_dvc->init_sdtr |= target_id; AscIsrChipHalted()
6544 if ((asc_dvc->init_sdtr & target_id) != 0) { AscIsrChipHalted()
6546 asc_dvc->sdtr_done &= ~target_id; AscIsrChipHalted()
6550 AscMsgOutSDTR(asc_dvc, AscIsrChipHalted()
6551 asc_dvc-> AscIsrChipHalted()
6553 (uchar)(asc_dvc-> AscIsrChipHalted()
6568 if ((asc_dvc->pci_fix_asyn_xfer & target_id) AscIsrChipHalted()
6569 && !(asc_dvc->pci_fix_asyn_xfer_always & target_id) AscIsrChipHalted()
6607 asc_dvc->init_sdtr &= ~target_id; AscIsrChipHalted()
6608 asc_dvc->sdtr_done &= ~target_id; AscIsrChipHalted()
6628 if ((cur_dvc_qng > 0) && (asc_dvc->cur_dvc_qng[tid_no] > 0)) { AscIsrChipHalted()
6635 asc_dvc->queue_full_or_busy |= target_id; AscIsrChipHalted()
6640 asc_dvc->max_dvc_qng[tid_no] = AscIsrChipHalted()
6857 static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) AscIsrQDone() argument
6876 iop_base = asc_dvc->iop_base; AscIsrQDone()
6887 asc_dvc->max_dma_count); AscIsrQDone()
6906 AscSetLibErrorCode(asc_dvc, AscIsrQDone()
6921 if (asc_dvc->queue_full_or_busy & target_id) { AscIsrQDone()
6928 if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) { AscIsrQDone()
6935 asc_dvc->queue_full_or_busy &= ~target_id; AscIsrQDone()
6938 if (asc_dvc->cur_total_qng >= n_q_used) { AscIsrQDone()
6939 asc_dvc->cur_total_qng -= n_q_used; AscIsrQDone()
6940 if (asc_dvc->cur_dvc_qng[tid_no] != 0) { AscIsrQDone()
6941 asc_dvc->cur_dvc_qng[tid_no]--; AscIsrQDone()
6944 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CUR_QNG); AscIsrQDone()
6991 asc_isr_callback(asc_dvc, scsiq); AscIsrQDone()
6997 asc_dvc->unit_not_ready &= ~target_id; AscIsrQDone()
6999 asc_dvc->start_motor &= AscIsrQDone()
7006 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS); AscIsrQDone()
7009 asc_isr_callback(asc_dvc, scsiq); AscIsrQDone()
7017 static int AscISR(ASC_DVC_VAR *asc_dvc) AscISR() argument
7028 iop_base = asc_dvc->iop_base; AscISR()
7034 if ((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0) { AscISR()
7037 if (asc_dvc->in_critical_cnt != 0) { AscISR()
7038 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_ON_CRITICAL); AscISR()
7041 if (asc_dvc->is_in_int) { AscISR()
7042 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_RE_ENTRY); AscISR()
7045 asc_dvc->is_in_int = true; AscISR()
7051 if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) { AscISR()
7054 asc_dvc->sdtr_done = 0; AscISR()
7077 AscIsrChipHalted(asc_dvc); AscISR()
7080 if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) { AscISR()
7082 AscIsrQDone(asc_dvc)) & 0x01) != 0) { AscISR()
7087 AscIsrQDone(asc_dvc)) == 1) { AscISR()
7099 asc_dvc->is_in_int = false; AscISR()
7127 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; advansys_reset() local
7131 status = AscInitAsc1000Driver(asc_dvc); advansys_reset()
7134 if (asc_dvc->err_code || !asc_dvc->overrun_dma) { advansys_reset()
7136 "0x%x, status: 0x%x\n", asc_dvc->err_code, advansys_reset()
7291 static void AscAsyncFix(ASC_DVC_VAR *asc_dvc, struct scsi_device *sdev) AscAsyncFix() argument
7296 if (!(asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN)) AscAsyncFix()
7298 if (asc_dvc->init_sdtr & tid_bits) AscAsyncFix()
7302 asc_dvc->pci_fix_asyn_xfer_always |= tid_bits; AscAsyncFix()
7304 asc_dvc->pci_fix_asyn_xfer |= tid_bits; AscAsyncFix()
7307 asc_dvc->pci_fix_asyn_xfer &= ~tid_bits; AscAsyncFix()
7309 if (asc_dvc->pci_fix_asyn_xfer & tid_bits) AscAsyncFix()
7310 AscSetRunChipSynRegAtID(asc_dvc->iop_base, sdev->id, AscAsyncFix()
7315 advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc) advansys_narrow_slave_configure() argument
7318 ASC_SCSI_BIT_ID_TYPE orig_use_tagged_qng = asc_dvc->use_tagged_qng; advansys_narrow_slave_configure()
7321 ASC_SCSI_BIT_ID_TYPE orig_init_sdtr = asc_dvc->init_sdtr; advansys_narrow_slave_configure()
7322 if ((asc_dvc->cfg->sdtr_enable & tid_bit) && sdev->sdtr) { advansys_narrow_slave_configure()
7323 asc_dvc->init_sdtr |= tid_bit; advansys_narrow_slave_configure()
7325 asc_dvc->init_sdtr &= ~tid_bit; advansys_narrow_slave_configure()
7328 if (orig_init_sdtr != asc_dvc->init_sdtr) advansys_narrow_slave_configure()
7329 AscAsyncFix(asc_dvc, sdev); advansys_narrow_slave_configure()
7333 if (asc_dvc->cfg->cmd_qng_enabled & tid_bit) { advansys_narrow_slave_configure()
7335 asc_dvc->cfg->can_tagged_qng |= tid_bit; advansys_narrow_slave_configure()
7336 asc_dvc->use_tagged_qng |= tid_bit; advansys_narrow_slave_configure()
7339 asc_dvc->max_dvc_qng[sdev->id]); advansys_narrow_slave_configure()
7343 asc_dvc->cfg->can_tagged_qng &= ~tid_bit; advansys_narrow_slave_configure()
7344 asc_dvc->use_tagged_qng &= ~tid_bit; advansys_narrow_slave_configure()
7349 (orig_use_tagged_qng != asc_dvc->use_tagged_qng)) { advansys_narrow_slave_configure()
7350 AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B, advansys_narrow_slave_configure()
7351 asc_dvc->cfg->disc_enable); advansys_narrow_slave_configure()
7352 AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B, advansys_narrow_slave_configure()
7353 asc_dvc->use_tagged_qng); advansys_narrow_slave_configure()
7354 AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B, advansys_narrow_slave_configure()
7355 asc_dvc->cfg->can_tagged_qng); advansys_narrow_slave_configure()
7357 asc_dvc->max_dvc_qng[sdev->id] = advansys_narrow_slave_configure()
7358 asc_dvc->cfg->max_tag_qng[sdev->id]; advansys_narrow_slave_configure()
7359 AscWriteLramByte(asc_dvc->iop_base, advansys_narrow_slave_configure()
7361 asc_dvc->max_dvc_qng[sdev->id]); advansys_narrow_slave_configure()
7518 struct asc_dvc_var *asc_dvc = &boardp->dvc_var.asc_dvc_var; asc_build_req() local
7556 if ((asc_dvc->cur_dvc_qng[scp->device->id] > 0) && asc_build_req()
7872 AscGetNumOfFreeQueue(ASC_DVC_VAR *asc_dvc, uchar target_ix, uchar n_qs) AscGetNumOfFreeQueue() argument
7881 if ((asc_dvc->unit_not_ready & target_id) || AscGetNumOfFreeQueue()
7882 (asc_dvc->queue_full_or_busy & target_id)) { AscGetNumOfFreeQueue()
7886 cur_used_qs = (uint) asc_dvc->cur_total_qng + AscGetNumOfFreeQueue()
7887 (uint) asc_dvc->last_q_shortage + (uint) ASC_MIN_FREE_Q; AscGetNumOfFreeQueue()
7889 cur_used_qs = (uint) asc_dvc->cur_total_qng + AscGetNumOfFreeQueue()
7892 if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) { AscGetNumOfFreeQueue()
7893 cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs; AscGetNumOfFreeQueue()
7894 if (asc_dvc->cur_dvc_qng[tid_no] >= AscGetNumOfFreeQueue()
7895 asc_dvc->max_dvc_qng[tid_no]) { AscGetNumOfFreeQueue()
7901 if ((n_qs > asc_dvc->last_q_shortage) AscGetNumOfFreeQueue()
7902 && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) { AscGetNumOfFreeQueue()
7903 asc_dvc->last_q_shortage = n_qs; AscGetNumOfFreeQueue()
7964 static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no) AscPutReadyQueue() argument
7973 iop_base = asc_dvc->iop_base; AscPutReadyQueue()
7974 if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) && AscPutReadyQueue()
7975 ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) { AscPutReadyQueue()
7979 (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1); AscPutReadyQueue()
7981 AscMsgOutSDTR(asc_dvc, AscPutReadyQueue()
7982 asc_dvc->sdtr_period_tbl[syn_period_ix], AscPutReadyQueue()
7987 if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) { AscPutReadyQueue()
8007 AscPutReadySgListQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no) AscPutReadySgListQueue() argument
8022 iop_base = asc_dvc->iop_base; AscPutReadySgListQueue()
8093 sta = AscPutReadyQueue(asc_dvc, scsiq, q_no); AscPutReadySgListQueue()
8100 AscSendScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar n_q_required) AscSendScsiQueue() argument
8109 iop_base = asc_dvc->iop_base; AscSendScsiQueue()
8118 asc_dvc->last_q_shortage = 0; AscSendScsiQueue()
8121 sta = AscPutReadySgListQueue(asc_dvc, scsiq, AscSendScsiQueue()
8128 sta = AscPutReadyQueue(asc_dvc, scsiq, free_q_head); AscSendScsiQueue()
8133 asc_dvc->cur_total_qng += n_q_required; AscSendScsiQueue()
8134 asc_dvc->cur_dvc_qng[tid_no]++; AscSendScsiQueue()
8159 static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq) AscExeScsiQueue() argument
8178 iop_base = asc_dvc->iop_base; AscExeScsiQueue()
8180 if (asc_dvc->err_code != 0) AscExeScsiQueue()
8191 if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) { AscExeScsiQueue()
8192 asc_dvc->sdtr_done &= ~scsiq->q1.target_id; AscExeScsiQueue()
8194 AscMsgOutSDTR(asc_dvc, AscExeScsiQueue()
8195 asc_dvc-> AscExeScsiQueue()
8197 (uchar)(asc_dvc-> AscExeScsiQueue()
8205 if (asc_dvc->in_critical_cnt != 0) { AscExeScsiQueue()
8206 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CRITICAL_RE_ENTRY); AscExeScsiQueue()
8209 asc_dvc->in_critical_cnt++; AscExeScsiQueue()
8212 asc_dvc->in_critical_cnt--; AscExeScsiQueue()
8216 asc_dvc->in_critical_cnt--; AscExeScsiQueue()
8228 if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) && AscExeScsiQueue()
8229 !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) { AscExeScsiQueue()
8267 if (asc_dvc->bug_fix_cntl) { AscExeScsiQueue()
8268 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { AscExeScsiQueue()
8308 if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, n_q_required) >= AscExeScsiQueue()
8312 AscSendScsiQueue(asc_dvc, scsiq, AscExeScsiQueue()
8314 asc_dvc->in_critical_cnt--; AscExeScsiQueue()
8319 if (asc_dvc->bug_fix_cntl) { AscExeScsiQueue()
8320 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { AscExeScsiQueue()
8353 if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, 1) >= 1) || AscExeScsiQueue()
8355 if ((sta = AscSendScsiQueue(asc_dvc, scsiq, AscExeScsiQueue()
8357 asc_dvc->in_critical_cnt--; AscExeScsiQueue()
8362 asc_dvc->in_critical_cnt--; AscExeScsiQueue()
8387 static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, adv_req_t *reqp) AdvExeScsiQueue() argument
8402 iop_base = asc_dvc->iop_base; AdvExeScsiQueue()
8408 new_carrp = adv_get_next_carrier(asc_dvc); AdvExeScsiQueue()
8414 asc_dvc->carr_pending_cnt++; AdvExeScsiQueue()
8420 scsiq->carr_va = asc_dvc->icq_sp->carr_va; AdvExeScsiQueue()
8421 scsiq->carr_pa = asc_dvc->icq_sp->carr_pa; AdvExeScsiQueue()
8428 asc_dvc->icq_sp->areq_vpa = scsiq->scsiq_rptr; AdvExeScsiQueue()
8435 asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa; AdvExeScsiQueue()
8440 asc_dvc->icq_sp = new_carrp; AdvExeScsiQueue()
8442 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || AdvExeScsiQueue()
8443 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { AdvExeScsiQueue()
8448 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { AdvExeScsiQueue()
8457 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { AdvExeScsiQueue()
8480 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; asc_execute_scsi_cmnd() local
8489 ret = AscExeScsiQueue(asc_dvc, &asc_scsi_q); asc_execute_scsi_cmnd()
8491 err_code = asc_dvc->err_code; asc_execute_scsi_cmnd()
8759 static void AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) AscInitAscDvcVar() argument
8765 iop_base = asc_dvc->iop_base; AscInitAscDvcVar()
8766 asc_dvc->err_code = 0; AscInitAscDvcVar()
8767 if ((asc_dvc->bus_type & AscInitAscDvcVar()
8769 asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE; AscInitAscDvcVar()
8773 asc_dvc->bug_fix_cntl = 0; AscInitAscDvcVar()
8774 asc_dvc->pci_fix_asyn_xfer = 0; AscInitAscDvcVar()
8775 asc_dvc->pci_fix_asyn_xfer_always = 0; AscInitAscDvcVar()
8776 /* asc_dvc->init_state initialized in AscInitGetConfig(). */ AscInitAscDvcVar()
8777 asc_dvc->sdtr_done = 0; AscInitAscDvcVar()
8778 asc_dvc->cur_total_qng = 0; AscInitAscDvcVar()
8779 asc_dvc->is_in_int = false; AscInitAscDvcVar()
8780 asc_dvc->in_critical_cnt = 0; AscInitAscDvcVar()
8781 asc_dvc->last_q_shortage = 0; AscInitAscDvcVar()
8782 asc_dvc->use_tagged_qng = 0; AscInitAscDvcVar()
8783 asc_dvc->no_scam = 0; AscInitAscDvcVar()
8784 asc_dvc->unit_not_ready = 0; AscInitAscDvcVar()
8785 asc_dvc->queue_full_or_busy = 0; AscInitAscDvcVar()
8786 asc_dvc->redo_scam = 0; AscInitAscDvcVar()
8787 asc_dvc->res2 = 0; AscInitAscDvcVar()
8788 asc_dvc->min_sdtr_index = 0; AscInitAscDvcVar()
8789 asc_dvc->cfg->can_tagged_qng = 0; AscInitAscDvcVar()
8790 asc_dvc->cfg->cmd_qng_enabled = 0; AscInitAscDvcVar()
8791 asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL; AscInitAscDvcVar()
8792 asc_dvc->init_sdtr = 0; AscInitAscDvcVar()
8793 asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG; AscInitAscDvcVar()
8794 asc_dvc->scsi_reset_wait = 3; AscInitAscDvcVar()
8795 asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET; AscInitAscDvcVar()
8796 asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type); AscInitAscDvcVar()
8797 asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET; AscInitAscDvcVar()
8798 asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET; AscInitAscDvcVar()
8799 asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID; AscInitAscDvcVar()
8800 chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type); AscInitAscDvcVar()
8801 asc_dvc->cfg->chip_version = chip_version; AscInitAscDvcVar()
8802 asc_dvc->sdtr_period_tbl = asc_syn_xfer_period; AscInitAscDvcVar()
8803 asc_dvc->max_sdtr_index = 7; AscInitAscDvcVar()
8804 if ((asc_dvc->bus_type & ASC_IS_PCI) && AscInitAscDvcVar()
8806 asc_dvc->bus_type = ASC_IS_PCI_ULTRA; AscInitAscDvcVar()
8807 asc_dvc->sdtr_period_tbl = asc_syn_ultra_xfer_period; AscInitAscDvcVar()
8808 asc_dvc->max_sdtr_index = 15; AscInitAscDvcVar()
8818 if (asc_dvc->bus_type == ASC_IS_PCI) { AscInitAscDvcVar()
8823 asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED; AscInitAscDvcVar()
8825 if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) { AscInitAscDvcVar()
8828 asc_dvc->bus_type = ASC_IS_ISAPNP; AscInitAscDvcVar()
8830 asc_dvc->cfg->isa_dma_channel = AscInitAscDvcVar()
8835 asc_dvc->cur_dvc_qng[i] = 0; AscInitAscDvcVar()
8836 asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG; AscInitAscDvcVar()
8837 asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *)0L; AscInitAscDvcVar()
8838 asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *)0L; AscInitAscDvcVar()
8839 asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG; AscInitAscDvcVar()
8925 static int AscTestExternalLram(ASC_DVC_VAR *asc_dvc) AscTestExternalLram() argument
8932 iop_base = asc_dvc->iop_base; AscTestExternalLram()
9106 static int AscInitFromEEP(ASC_DVC_VAR *asc_dvc) AscInitFromEEP() argument
9117 iop_base = asc_dvc->iop_base; AscInitFromEEP()
9123 asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE; AscInitFromEEP()
9124 AscResetChipAndScsiBus(asc_dvc); AscInitFromEEP()
9125 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ AscInitFromEEP()
9128 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; AscInitFromEEP()
9133 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; AscInitFromEEP()
9144 chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type); AscInitFromEEP()
9151 if (asc_dvc->cfg->chip_version == 3) { AscInitFromEEP()
9168 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) == AscInitFromEEP()
9194 asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr; AscInitFromEEP()
9195 asc_dvc->cfg->disc_enable = eep_config->disc_enable; AscInitFromEEP()
9196 asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng; AscInitFromEEP()
9197 asc_dvc->cfg->isa_dma_speed = ASC_EEP_GET_DMA_SPD(eep_config); AscInitFromEEP()
9198 asc_dvc->start_motor = eep_config->start_motor; AscInitFromEEP()
9199 asc_dvc->dvc_cntl = eep_config->cntl; AscInitFromEEP()
9200 asc_dvc->no_scam = eep_config->no_scam; AscInitFromEEP()
9201 asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0]; AscInitFromEEP()
9202 asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1]; AscInitFromEEP()
9203 asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2]; AscInitFromEEP()
9204 asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3]; AscInitFromEEP()
9205 asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4]; AscInitFromEEP()
9206 asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5]; AscInitFromEEP()
9207 if (!AscTestExternalLram(asc_dvc)) { AscInitFromEEP()
9208 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == AscInitFromEEP()
9235 asc_dvc->max_total_qng = eep_config->max_total_qng; AscInitFromEEP()
9243 asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config); AscInitFromEEP()
9244 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) && AscInitFromEEP()
9245 !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) { AscInitFromEEP()
9246 asc_dvc->min_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX; AscInitFromEEP()
9250 asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i]; AscInitFromEEP()
9251 asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng; AscInitFromEEP()
9252 asc_dvc->cfg->sdtr_period_offset[i] = AscInitFromEEP()
9254 (asc_dvc->min_sdtr_index << 4)); AscInitFromEEP()
9259 asc_dvc->bus_type)) != 0) { AscInitFromEEP()
9274 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; AscInitGetConfig() local
9277 asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; AscInitGetConfig()
9278 if (asc_dvc->err_code != 0) AscInitGetConfig()
9279 return asc_dvc->err_code; AscInitGetConfig()
9281 if (AscFindSignature(asc_dvc->iop_base)) { AscInitGetConfig()
9282 AscInitAscDvcVar(asc_dvc); AscInitGetConfig()
9283 warn_code = AscInitFromEEP(asc_dvc); AscInitGetConfig()
9284 asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG; AscInitGetConfig()
9285 if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) AscInitGetConfig()
9286 asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT; AscInitGetConfig()
9288 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; AscInitGetConfig()
9318 if (asc_dvc->err_code != 0) AscInitGetConfig()
9320 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); AscInitGetConfig()
9322 return asc_dvc->err_code; AscInitGetConfig()
9328 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; AscInitSetConfig() local
9329 PortAddr iop_base = asc_dvc->iop_base; AscInitSetConfig()
9333 asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG; AscInitSetConfig()
9334 if (asc_dvc->err_code != 0) AscInitSetConfig()
9335 return asc_dvc->err_code; AscInitSetConfig()
9336 if (!AscFindSignature(asc_dvc->iop_base)) { AscInitSetConfig()
9337 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; AscInitSetConfig()
9338 return asc_dvc->err_code; AscInitSetConfig()
9347 if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) != AscInitSetConfig()
9348 asc_dvc->cfg->cmd_qng_enabled) { AscInitSetConfig()
9349 asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled; AscInitSetConfig()
9356 if (asc_dvc->bus_type & ASC_IS_PCI) { AscInitSetConfig()
9359 if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) { AscInitSetConfig()
9363 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB; AscInitSetConfig()
9364 asc_dvc->bug_fix_cntl |= AscInitSetConfig()
9370 if (asc_dvc->bus_type == ASC_IS_ISAPNP) { AscInitSetConfig()
9371 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) AscInitSetConfig()
9373 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN; AscInitSetConfig()
9376 if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) != AscInitSetConfig()
9377 asc_dvc->cfg->chip_scsi_id) { AscInitSetConfig()
9378 asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID; AscInitSetConfig()
9381 if (asc_dvc->bus_type & ASC_IS_ISA) { AscInitSetConfig()
9382 AscSetIsaDmaChannel(iop_base, asc_dvc->cfg->isa_dma_channel); AscInitSetConfig()
9383 AscSetIsaDmaSpeed(iop_base, asc_dvc->cfg->isa_dma_speed); AscInitSetConfig()
9387 asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG; AscInitSetConfig()
9416 if (asc_dvc->err_code != 0) AscInitSetConfig()
9418 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); AscInitSetConfig()
9420 return asc_dvc->err_code; AscInitSetConfig()
10148 static int AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) AdvInitFrom3550EEP() argument
10154 iop_base = asc_dvc->iop_base; AdvInitFrom3550EEP()
10193 asc_dvc->wdtr_able = eep_config.wdtr_able; AdvInitFrom3550EEP()
10194 asc_dvc->sdtr_able = eep_config.sdtr_able; AdvInitFrom3550EEP()
10195 asc_dvc->ultra_able = eep_config.ultra_able; AdvInitFrom3550EEP()
10196 asc_dvc->tagqng_able = eep_config.tagqng_able; AdvInitFrom3550EEP()
10197 asc_dvc->cfg->disc_enable = eep_config.disc_enable; AdvInitFrom3550EEP()
10198 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom3550EEP()
10199 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom3550EEP()
10200 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); AdvInitFrom3550EEP()
10201 asc_dvc->start_motor = eep_config.start_motor; AdvInitFrom3550EEP()
10202 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; AdvInitFrom3550EEP()
10203 asc_dvc->bios_ctrl = eep_config.bios_ctrl; AdvInitFrom3550EEP()
10204 asc_dvc->no_scam = eep_config.scam_tolerant; AdvInitFrom3550EEP()
10205 asc_dvc->cfg->serial1 = eep_config.serial_number_word1; AdvInitFrom3550EEP()
10206 asc_dvc->cfg->serial2 = eep_config.serial_number_word2; AdvInitFrom3550EEP()
10207 asc_dvc->cfg->serial3 = eep_config.serial_number_word3; AdvInitFrom3550EEP()
10247 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom3550EEP()
10248 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom3550EEP()
10259 asc_dvc->cfg->termination = 0; /* auto termination */ AdvInitFrom3550EEP()
10263 asc_dvc->cfg->termination = TERM_CTL_SEL; AdvInitFrom3550EEP()
10267 asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H; AdvInitFrom3550EEP()
10271 asc_dvc->cfg->termination = AdvInitFrom3550EEP()
10278 asc_dvc->cfg->termination = 0; AdvInitFrom3550EEP()
10298 static int AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) AdvInitFrom38C0800EEP() argument
10306 iop_base = asc_dvc->iop_base; AdvInitFrom38C0800EEP()
10346 asc_dvc->wdtr_able = eep_config.wdtr_able; AdvInitFrom38C0800EEP()
10347 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; AdvInitFrom38C0800EEP()
10348 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; AdvInitFrom38C0800EEP()
10349 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; AdvInitFrom38C0800EEP()
10350 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; AdvInitFrom38C0800EEP()
10351 asc_dvc->tagqng_able = eep_config.tagqng_able; AdvInitFrom38C0800EEP()
10352 asc_dvc->cfg->disc_enable = eep_config.disc_enable; AdvInitFrom38C0800EEP()
10353 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom38C0800EEP()
10354 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom38C0800EEP()
10355 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); AdvInitFrom38C0800EEP()
10356 asc_dvc->start_motor = eep_config.start_motor; AdvInitFrom38C0800EEP()
10357 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; AdvInitFrom38C0800EEP()
10358 asc_dvc->bios_ctrl = eep_config.bios_ctrl; AdvInitFrom38C0800EEP()
10359 asc_dvc->no_scam = eep_config.scam_tolerant; AdvInitFrom38C0800EEP()
10360 asc_dvc->cfg->serial1 = eep_config.serial_number_word1; AdvInitFrom38C0800EEP()
10361 asc_dvc->cfg->serial2 = eep_config.serial_number_word2; AdvInitFrom38C0800EEP()
10362 asc_dvc->cfg->serial3 = eep_config.serial_number_word3; AdvInitFrom38C0800EEP()
10368 asc_dvc->sdtr_able = 0; AdvInitFrom38C0800EEP()
10371 sdtr_speed = asc_dvc->sdtr_speed1; AdvInitFrom38C0800EEP()
10373 sdtr_speed = asc_dvc->sdtr_speed2; AdvInitFrom38C0800EEP()
10375 sdtr_speed = asc_dvc->sdtr_speed3; AdvInitFrom38C0800EEP()
10377 sdtr_speed = asc_dvc->sdtr_speed4; AdvInitFrom38C0800EEP()
10380 asc_dvc->sdtr_able |= (1 << tid); AdvInitFrom38C0800EEP()
10423 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom38C0800EEP()
10424 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom38C0800EEP()
10459 asc_dvc->cfg->termination = termination; /* auto termination for LVD */ AdvInitFrom38C0800EEP()
10463 asc_dvc->cfg->termination = termination; AdvInitFrom38C0800EEP()
10467 asc_dvc->cfg->termination = termination | TERM_LVD_HI; AdvInitFrom38C0800EEP()
10471 asc_dvc->cfg->termination = termination | TERM_LVD; AdvInitFrom38C0800EEP()
10477 asc_dvc->cfg->termination = termination; AdvInitFrom38C0800EEP()
10497 static int AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) AdvInitFrom38C1600EEP() argument
10505 iop_base = asc_dvc->iop_base; AdvInitFrom38C1600EEP()
10516 struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); AdvInitFrom38C1600EEP()
10572 asc_dvc->wdtr_able = eep_config.wdtr_able; AdvInitFrom38C1600EEP()
10573 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; AdvInitFrom38C1600EEP()
10574 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; AdvInitFrom38C1600EEP()
10575 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; AdvInitFrom38C1600EEP()
10576 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; AdvInitFrom38C1600EEP()
10577 asc_dvc->ppr_able = 0; AdvInitFrom38C1600EEP()
10578 asc_dvc->tagqng_able = eep_config.tagqng_able; AdvInitFrom38C1600EEP()
10579 asc_dvc->cfg->disc_enable = eep_config.disc_enable; AdvInitFrom38C1600EEP()
10580 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom38C1600EEP()
10581 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom38C1600EEP()
10582 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID); AdvInitFrom38C1600EEP()
10583 asc_dvc->start_motor = eep_config.start_motor; AdvInitFrom38C1600EEP()
10584 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; AdvInitFrom38C1600EEP()
10585 asc_dvc->bios_ctrl = eep_config.bios_ctrl; AdvInitFrom38C1600EEP()
10586 asc_dvc->no_scam = eep_config.scam_tolerant; AdvInitFrom38C1600EEP()
10592 asc_dvc->sdtr_able = 0; AdvInitFrom38C1600EEP()
10595 sdtr_speed = asc_dvc->sdtr_speed1; AdvInitFrom38C1600EEP()
10597 sdtr_speed = asc_dvc->sdtr_speed2; AdvInitFrom38C1600EEP()
10599 sdtr_speed = asc_dvc->sdtr_speed3; AdvInitFrom38C1600EEP()
10601 sdtr_speed = asc_dvc->sdtr_speed4; AdvInitFrom38C1600EEP()
10604 asc_dvc->sdtr_able |= (1 << tid); AdvInitFrom38C1600EEP()
10647 asc_dvc->max_host_qng = eep_config.max_host_qng; AdvInitFrom38C1600EEP()
10648 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; AdvInitFrom38C1600EEP()
10683 asc_dvc->cfg->termination = termination; /* auto termination for LVD */ AdvInitFrom38C1600EEP()
10687 asc_dvc->cfg->termination = termination; AdvInitFrom38C1600EEP()
10691 asc_dvc->cfg->termination = termination | TERM_LVD_HI; AdvInitFrom38C1600EEP()
10695 asc_dvc->cfg->termination = termination | TERM_LVD; AdvInitFrom38C1600EEP()
10701 asc_dvc->cfg->termination = termination; AdvInitFrom38C1600EEP()
10720 ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var; AdvInitGetConfig() local
10722 AdvPortAddr iop_base = asc_dvc->iop_base; AdvInitGetConfig()
10726 asc_dvc->err_code = 0; AdvInitGetConfig()
10734 asc_dvc->cfg->control_flag = 0; AdvInitGetConfig()
10737 asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR; AdvInitGetConfig()
10739 asc_dvc->cfg->chip_version = AdvInitGetConfig()
10740 AdvGetChipVersion(iop_base, asc_dvc->bus_type); AdvInitGetConfig()
10754 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; AdvInitGetConfig()
10760 if (asc_dvc->chip_type != ADV_CHIP_ASC3550 && AdvInitGetConfig()
10761 asc_dvc->chip_type != ADV_CHIP_ASC38C0800 && AdvInitGetConfig()
10762 asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { AdvInitGetConfig()
10763 asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE; AdvInitGetConfig()
10776 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { AdvInitGetConfig()
10777 status = AdvInitFrom38C1600EEP(asc_dvc); AdvInitGetConfig()
10778 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { AdvInitGetConfig()
10779 status = AdvInitFrom38C0800EEP(asc_dvc); AdvInitGetConfig()
10781 status = AdvInitFrom3550EEP(asc_dvc); AdvInitGetConfig()
10789 if (asc_dvc->err_code) AdvInitGetConfig()
10791 asc_dvc->err_code); AdvInitGetConfig()
10793 return asc_dvc->err_code; AdvInitGetConfig()

Completed in 113 milliseconds