Lines Matching defs:asc_dvc
1984 #define AdvAbortQueue(asc_dvc, srb_tag) \
1985 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_ABORT, \
1999 #define AdvResetDevice(asc_dvc, target_id) \
2000 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_DEVICE_RESET, \
2293 #define asc_dvc_to_board(asc_dvc) container_of(asc_dvc, struct asc_board, \
3716 static bool AscResetChipAndScsiBus(ASC_DVC_VAR *asc_dvc)
3721 iop_base = asc_dvc->iop_base;
3911 static void AscInitLram(ASC_DVC_VAR *asc_dvc)
3917 iop_base = asc_dvc->iop_base;
3919 (ushort)(((int)(asc_dvc->max_total_qng + 2 + 1) *
3926 (uchar)(asc_dvc->max_total_qng));
3931 for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) {
3942 (uchar)(asc_dvc->max_total_qng - 1));
3944 (uchar)asc_dvc->max_total_qng);
3947 for (; i <= (uchar)(asc_dvc->max_total_qng + 3);
3985 static void AscInitQLinkVar(ASC_DVC_VAR *asc_dvc)
3991 iop_base = asc_dvc->iop_base;
3993 AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng);
3995 AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng);
3997 (uchar)((int)asc_dvc->max_total_qng + 1));
3999 (uchar)((int)asc_dvc->max_total_qng + 2));
4001 asc_dvc->max_total_qng);
4014 static int AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
4021 struct asc_board *board = asc_dvc_to_board(asc_dvc);
4023 iop_base = asc_dvc->iop_base;
4027 asc_dvc->cfg->sdtr_period_offset[i]);
4030 AscInitQLinkVar(asc_dvc);
4032 asc_dvc->cfg->disc_enable);
4034 ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id));
4037 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7);
4038 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf,
4040 if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) {
4044 phy_addr = cpu_to_le32(asc_dvc->overrun_dma);
4051 asc_dvc->cfg->mcode_date =
4053 asc_dvc->cfg->mcode_version =
4058 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
4063 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
4071 dma_unmap_single(board->dev, asc_dvc->overrun_dma,
4074 asc_dvc->overrun_dma = 0;
4078 static int AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
4087 iop_base = asc_dvc->iop_base;
4089 if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) &&
4090 !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) {
4091 AscResetChipAndScsiBus(asc_dvc);
4092 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */
4094 asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC;
4095 if (asc_dvc->err_code != 0)
4097 if (!AscFindSignature(asc_dvc->iop_base)) {
4098 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
4102 AscInitLram(asc_dvc);
4104 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev);
4108 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
4115 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
4123 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
4128 warn_code |= AscInitMicroCodeVar(asc_dvc);
4129 if (!asc_dvc->overrun_dma)
4131 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
4291 AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc,
4297 iop_base = asc_dvc->iop_base;
4320 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
4354 static int AdvResetSB(ADV_DVC_VAR *asc_dvc)
4362 status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_START, 0L);
4379 status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_END, 0L);
4384 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */
4399 static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc)
4419 if (asc_dvc->err_code != 0)
4425 if (asc_dvc->chip_type != ADV_CHIP_ASC3550) {
4426 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
4431 iop_base = asc_dvc->iop_base;
4470 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev);
4474 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
4481 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
4486 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4],
4490 if (asc_dvc->err_code)
4518 asc_dvc->cfg->mcode_date);
4520 asc_dvc->cfg->mcode_version);
4533 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
4558 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
4560 asc_dvc->wdtr_able);
4562 asc_dvc->sdtr_able);
4589 if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able) {
4615 asc_dvc->cfg->disc_enable);
4625 asc_dvc->chip_scsi_id);
4642 asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION;
4652 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
4661 asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE;
4673 if (asc_dvc->cfg->termination == 0) {
4678 asc_dvc->cfg->termination |= TERM_CTL_SEL;
4688 asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L);
4697 asc_dvc->cfg->termination |= TERM_CTL_H;
4718 scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL));
4753 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
4755 AdvBuildCarrierFreelist(asc_dvc);
4761 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc);
4762 if (!asc_dvc->icq_sp) {
4763 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
4770 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
4775 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc);
4776 if (!asc_dvc->irq_sp) {
4777 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
4784 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
4785 asc_dvc->carr_pending_cnt = 0;
4802 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
4823 if (AdvResetSB(asc_dvc) != ADV_TRUE) {
4842 static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc)
4863 if (asc_dvc->err_code != 0)
4869 if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800) {
4870 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
4875 iop_base = asc_dvc->iop_base;
4936 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST;
4944 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST;
4962 asc_dvc->bist_err_code = byte; /* for BIOS display message */
4963 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST;
4970 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev);
4974 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
4981 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
4986 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4],
4990 if (asc_dvc->err_code)
5018 asc_dvc->cfg->mcode_date);
5020 asc_dvc->cfg->mcode_version);
5045 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
5075 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
5077 asc_dvc->wdtr_able);
5079 asc_dvc->sdtr_able);
5092 asc_dvc->cfg->disc_enable);
5093 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
5094 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
5095 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
5096 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
5106 asc_dvc->chip_scsi_id);
5124 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
5140 asc_dvc->err_code = ASC_IERR_HVD_DEVICE;
5152 if ((asc_dvc->cfg->termination & TERM_SE) == 0) {
5159 asc_dvc->cfg->termination |= TERM_SE;
5164 asc_dvc->cfg->termination |= TERM_SE_HI;
5169 if ((asc_dvc->cfg->termination & TERM_LVD) == 0) {
5176 asc_dvc->cfg->termination |= TERM_LVD;
5193 scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0);
5234 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
5236 AdvBuildCarrierFreelist(asc_dvc);
5242 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc);
5243 if (!asc_dvc->icq_sp) {
5245 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
5253 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
5258 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc);
5259 if (!asc_dvc->irq_sp) {
5261 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
5270 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
5271 asc_dvc->carr_pending_cnt = 0;
5288 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
5309 if (AdvResetSB(asc_dvc) != ADV_TRUE) {
5328 static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
5349 if (asc_dvc->err_code != 0) {
5356 if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600) {
5357 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
5362 iop_base = asc_dvc->iop_base;
5424 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST;
5432 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST;
5450 asc_dvc->bist_err_code = byte; /* for BIOS display message */
5451 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST;
5458 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev);
5462 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
5469 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM;
5474 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4],
5478 if (asc_dvc->err_code)
5506 asc_dvc->cfg->mcode_date);
5508 asc_dvc->cfg->mcode_version);
5533 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
5545 if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0) {
5570 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
5572 asc_dvc->wdtr_able);
5574 asc_dvc->sdtr_able);
5587 asc_dvc->cfg->disc_enable);
5588 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
5589 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
5590 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
5591 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
5601 asc_dvc->chip_scsi_id);
5620 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
5633 asc_dvc->err_code |= ASC_IERR_HVD_DEVICE;
5650 if ((asc_dvc->cfg->termination & TERM_SE) == 0) {
5651 struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc);
5658 asc_dvc->cfg->termination |= TERM_SE;
5666 asc_dvc->cfg->termination |= TERM_SE_HI;
5680 scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE);
5731 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
5733 AdvBuildCarrierFreelist(asc_dvc);
5738 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc);
5739 if (!asc_dvc->icq_sp) {
5740 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
5749 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
5751 le32_to_cpu(asc_dvc->icq_sp->carr_pa));
5756 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc);
5757 if (!asc_dvc->irq_sp) {
5758 asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
5765 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
5766 asc_dvc->carr_pending_cnt = 0;
5782 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
5803 if (AdvResetSB(asc_dvc) != ADV_TRUE) {
5819 static int AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc)
5828 iop_base = asc_dvc->iop_base;
5835 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
5866 asc_dvc->err_code = 0;
5867 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
5868 status = AdvInitAsc38C1600Driver(asc_dvc);
5869 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
5870 status = AdvInitAsc38C0800Driver(asc_dvc);
5872 status = AdvInitAsc3550Driver(asc_dvc);
5892 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
6110 static int AdvISR(ADV_DVC_VAR *asc_dvc)
6120 iop_base = asc_dvc->iop_base;
6140 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
6141 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
6143 asc_dvc->carr_pending_cnt != 0) {
6146 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
6154 adv_async_callback(asc_dvc, intrb_code);
6161 le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ADV_RQ_DONE) != 0) {
6171 u32 pa_offset = le32_to_cpu(asc_dvc->irq_sp->areq_vpa);
6173 asc_dvc->irq_sp, pa_offset);
6174 reqp = adv_get_reqp(asc_dvc, pa_offset);
6193 free_carrp = asc_dvc->irq_sp;
6194 asc_dvc->irq_sp = adv_get_carrier(asc_dvc,
6197 free_carrp->next_vpa = asc_dvc->carr_freelist->carr_va;
6198 asc_dvc->carr_freelist = free_carrp;
6199 asc_dvc->carr_pending_cnt--;
6212 adv_isr_callback(asc_dvc, scsiq);
6224 static int AscSetLibErrorCode(ASC_DVC_VAR *asc_dvc, ushort err_code)
6226 if (asc_dvc->err_code == 0) {
6227 asc_dvc->err_code = err_code;
6228 AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W,
6263 static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time)
6270 period_table = asc_dvc->sdtr_period_tbl;
6271 max_index = (int)asc_dvc->max_sdtr_index;
6272 min_index = (int)asc_dvc->min_sdtr_index;
6286 AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset)
6288 PortAddr iop_base = asc_dvc->iop_base;
6289 uchar sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
6299 if (sdtr_period_index <= asc_dvc->max_sdtr_index) {
6314 AscCalSDTRData(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar syn_offset)
6319 sdtr_period_ix = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
6320 if (sdtr_period_ix > asc_dvc->max_sdtr_index)
6361 static void AscIsrChipHalted(ASC_DVC_VAR *asc_dvc)
6382 BUG_ON(!asc_dvc->drv_ptr);
6383 boardp = asc_dvc->drv_ptr;
6385 iop_base = asc_dvc->iop_base;
6397 if (asc_dvc->pci_fix_asyn_xfer & target_id) {
6403 if (asc_dvc->pci_fix_asyn_xfer & target_id) {
6410 if (asc_dvc->pci_fix_asyn_xfer & target_id) {
6432 asc_dvc->sdtr_period_tbl[asc_dvc->min_sdtr_index])
6434 asc_dvc->sdtr_period_tbl[asc_dvc->
6438 asc_dvc->sdtr_period_tbl[asc_dvc->
6443 AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
6448 asc_dvc->init_sdtr &= ~target_id;
6449 asc_dvc->sdtr_done &= ~target_id;
6458 asc_dvc->init_sdtr &= ~target_id;
6459 asc_dvc->sdtr_done &= ~target_id;
6464 asc_dvc->sdtr_done |= target_id;
6465 asc_dvc->init_sdtr |= target_id;
6466 asc_dvc->pci_fix_asyn_xfer &=
6469 AscCalSDTRData(asc_dvc,
6478 AscMsgOutSDTR(asc_dvc,
6481 asc_dvc->pci_fix_asyn_xfer &=
6484 AscCalSDTRData(asc_dvc,
6491 asc_dvc->sdtr_done |= target_id;
6492 asc_dvc->init_sdtr |= target_id;
6537 if ((asc_dvc->init_sdtr & target_id) != 0) {
6539 asc_dvc->sdtr_done &= ~target_id;
6543 AscMsgOutSDTR(asc_dvc,
6544 asc_dvc->
6546 (uchar)(asc_dvc->
6561 if ((asc_dvc->pci_fix_asyn_xfer & target_id)
6562 && !(asc_dvc->pci_fix_asyn_xfer_always & target_id)
6600 asc_dvc->init_sdtr &= ~target_id;
6601 asc_dvc->sdtr_done &= ~target_id;
6621 if ((cur_dvc_qng > 0) && (asc_dvc->cur_dvc_qng[tid_no] > 0)) {
6628 asc_dvc->queue_full_or_busy |= target_id;
6633 asc_dvc->max_dvc_qng[tid_no] =
6850 static int AscIsrQDone(ASC_DVC_VAR *asc_dvc)
6869 iop_base = asc_dvc->iop_base;
6880 asc_dvc->max_dma_count);
6899 AscSetLibErrorCode(asc_dvc,
6914 if (asc_dvc->queue_full_or_busy & target_id) {
6921 if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) {
6928 asc_dvc->queue_full_or_busy &= ~target_id;
6931 if (asc_dvc->cur_total_qng >= n_q_used) {
6932 asc_dvc->cur_total_qng -= n_q_used;
6933 if (asc_dvc->cur_dvc_qng[tid_no] != 0) {
6934 asc_dvc->cur_dvc_qng[tid_no]--;
6937 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CUR_QNG);
6984 asc_isr_callback(asc_dvc, scsiq);
6990 asc_dvc->unit_not_ready &= ~target_id;
6992 asc_dvc->start_motor &=
6999 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS);
7002 asc_isr_callback(asc_dvc, scsiq);
7010 static int AscISR(ASC_DVC_VAR *asc_dvc)
7021 iop_base = asc_dvc->iop_base;
7027 if ((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0) {
7030 if (asc_dvc->in_critical_cnt != 0) {
7031 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_ON_CRITICAL);
7034 if (asc_dvc->is_in_int) {
7035 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_RE_ENTRY);
7038 asc_dvc->is_in_int = true;
7044 if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) {
7047 asc_dvc->sdtr_done = 0;
7070 AscIsrChipHalted(asc_dvc);
7073 if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) {
7075 AscIsrQDone(asc_dvc)) & 0x01) != 0) {
7080 AscIsrQDone(asc_dvc)) == 1) {
7092 asc_dvc->is_in_int = false;
7120 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
7124 status = AscInitAsc1000Driver(asc_dvc);
7127 if (asc_dvc->err_code || !asc_dvc->overrun_dma) {
7129 "0x%x, status: 0x%x\n", asc_dvc->err_code,
7284 static void AscAsyncFix(ASC_DVC_VAR *asc_dvc, struct scsi_device *sdev)
7289 if (!(asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN))
7291 if (asc_dvc->init_sdtr & tid_bits)
7295 asc_dvc->pci_fix_asyn_xfer_always |= tid_bits;
7297 asc_dvc->pci_fix_asyn_xfer |= tid_bits;
7300 asc_dvc->pci_fix_asyn_xfer &= ~tid_bits;
7302 if (asc_dvc->pci_fix_asyn_xfer & tid_bits)
7303 AscSetRunChipSynRegAtID(asc_dvc->iop_base, sdev->id,
7308 advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
7311 ASC_SCSI_BIT_ID_TYPE orig_use_tagged_qng = asc_dvc->use_tagged_qng;
7314 ASC_SCSI_BIT_ID_TYPE orig_init_sdtr = asc_dvc->init_sdtr;
7315 if ((asc_dvc->cfg->sdtr_enable & tid_bit) && sdev->sdtr) {
7316 asc_dvc->init_sdtr |= tid_bit;
7318 asc_dvc->init_sdtr &= ~tid_bit;
7321 if (orig_init_sdtr != asc_dvc->init_sdtr)
7322 AscAsyncFix(asc_dvc, sdev);
7326 if (asc_dvc->cfg->cmd_qng_enabled & tid_bit) {
7328 asc_dvc->cfg->can_tagged_qng |= tid_bit;
7329 asc_dvc->use_tagged_qng |= tid_bit;
7332 asc_dvc->max_dvc_qng[sdev->id]);
7336 asc_dvc->cfg->can_tagged_qng &= ~tid_bit;
7337 asc_dvc->use_tagged_qng &= ~tid_bit;
7342 (orig_use_tagged_qng != asc_dvc->use_tagged_qng)) {
7343 AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B,
7344 asc_dvc->cfg->disc_enable);
7345 AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B,
7346 asc_dvc->use_tagged_qng);
7347 AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B,
7348 asc_dvc->cfg->can_tagged_qng);
7350 asc_dvc->max_dvc_qng[sdev->id] =
7351 asc_dvc->cfg->max_tag_qng[sdev->id];
7352 AscWriteLramByte(asc_dvc->iop_base,
7354 asc_dvc->max_dvc_qng[sdev->id]);
7511 struct asc_dvc_var *asc_dvc = &boardp->dvc_var.asc_dvc_var;
7549 if ((asc_dvc->cur_dvc_qng[scp->device->id] > 0) &&
7865 AscGetNumOfFreeQueue(ASC_DVC_VAR *asc_dvc, uchar target_ix, uchar n_qs)
7874 if ((asc_dvc->unit_not_ready & target_id) ||
7875 (asc_dvc->queue_full_or_busy & target_id)) {
7879 cur_used_qs = (uint) asc_dvc->cur_total_qng +
7880 (uint) asc_dvc->last_q_shortage + (uint) ASC_MIN_FREE_Q;
7882 cur_used_qs = (uint) asc_dvc->cur_total_qng +
7885 if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) {
7886 cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs;
7887 if (asc_dvc->cur_dvc_qng[tid_no] >=
7888 asc_dvc->max_dvc_qng[tid_no]) {
7894 if ((n_qs > asc_dvc->last_q_shortage)
7895 && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) {
7896 asc_dvc->last_q_shortage = n_qs;
7957 static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no)
7966 iop_base = asc_dvc->iop_base;
7967 if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) &&
7968 ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) {
7972 (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1);
7974 AscMsgOutSDTR(asc_dvc,
7975 asc_dvc->sdtr_period_tbl[syn_period_ix],
7980 if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) {
8000 AscPutReadySgListQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no)
8015 iop_base = asc_dvc->iop_base;
8086 sta = AscPutReadyQueue(asc_dvc, scsiq, q_no);
8093 AscSendScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar n_q_required)
8102 iop_base = asc_dvc->iop_base;
8111 asc_dvc->last_q_shortage = 0;
8114 sta = AscPutReadySgListQueue(asc_dvc, scsiq,
8121 sta = AscPutReadyQueue(asc_dvc, scsiq, free_q_head);
8126 asc_dvc->cur_total_qng += n_q_required;
8127 asc_dvc->cur_dvc_qng[tid_no]++;
8152 static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq)
8171 iop_base = asc_dvc->iop_base;
8173 if (asc_dvc->err_code != 0)
8184 if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) {
8185 asc_dvc->sdtr_done &= ~scsiq->q1.target_id;
8187 AscMsgOutSDTR(asc_dvc,
8188 asc_dvc->
8190 (uchar)(asc_dvc->
8198 if (asc_dvc->in_critical_cnt != 0) {
8199 AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CRITICAL_RE_ENTRY);
8202 asc_dvc->in_critical_cnt++;
8205 asc_dvc->in_critical_cnt--;
8209 asc_dvc->in_critical_cnt--;
8221 if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) &&
8222 !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) {
8260 if (asc_dvc->bug_fix_cntl) {
8261 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
8301 if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, n_q_required) >=
8305 AscSendScsiQueue(asc_dvc, scsiq,
8307 asc_dvc->in_critical_cnt--;
8312 if (asc_dvc->bug_fix_cntl) {
8313 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
8346 if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, 1) >= 1) ||
8348 if ((sta = AscSendScsiQueue(asc_dvc, scsiq,
8350 asc_dvc->in_critical_cnt--;
8355 asc_dvc->in_critical_cnt--;
8380 static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, adv_req_t *reqp)
8395 iop_base = asc_dvc->iop_base;
8401 new_carrp = adv_get_next_carrier(asc_dvc);
8407 asc_dvc->carr_pending_cnt++;
8413 scsiq->carr_va = asc_dvc->icq_sp->carr_va;
8414 scsiq->carr_pa = asc_dvc->icq_sp->carr_pa;
8421 asc_dvc->icq_sp->areq_vpa = scsiq->scsiq_rptr;
8428 asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa;
8433 asc_dvc->icq_sp = new_carrp;
8435 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
8436 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
8441 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
8450 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
8473 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
8482 ret = AscExeScsiQueue(asc_dvc, &asc_scsi_q);
8484 err_code = asc_dvc->err_code;
8752 static void AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc)
8758 iop_base = asc_dvc->iop_base;
8759 asc_dvc->err_code = 0;
8760 if ((asc_dvc->bus_type &
8762 asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE;
8766 asc_dvc->bug_fix_cntl = 0;
8767 asc_dvc->pci_fix_asyn_xfer = 0;
8768 asc_dvc->pci_fix_asyn_xfer_always = 0;
8769 /* asc_dvc->init_state initialized in AscInitGetConfig(). */
8770 asc_dvc->sdtr_done = 0;
8771 asc_dvc->cur_total_qng = 0;
8772 asc_dvc->is_in_int = false;
8773 asc_dvc->in_critical_cnt = 0;
8774 asc_dvc->last_q_shortage = 0;
8775 asc_dvc->use_tagged_qng = 0;
8776 asc_dvc->no_scam = 0;
8777 asc_dvc->unit_not_ready = 0;
8778 asc_dvc->queue_full_or_busy = 0;
8779 asc_dvc->redo_scam = 0;
8780 asc_dvc->res2 = 0;
8781 asc_dvc->min_sdtr_index = 0;
8782 asc_dvc->cfg->can_tagged_qng = 0;
8783 asc_dvc->cfg->cmd_qng_enabled = 0;
8784 asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL;
8785 asc_dvc->init_sdtr = 0;
8786 asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG;
8787 asc_dvc->scsi_reset_wait = 3;
8788 asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET;
8789 asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type);
8790 asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET;
8791 asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET;
8792 asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID;
8793 chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type);
8794 asc_dvc->cfg->chip_version = chip_version;
8795 asc_dvc->sdtr_period_tbl = asc_syn_xfer_period;
8796 asc_dvc->max_sdtr_index = 7;
8797 if ((asc_dvc->bus_type & ASC_IS_PCI) &&
8799 asc_dvc->bus_type = ASC_IS_PCI_ULTRA;
8800 asc_dvc->sdtr_period_tbl = asc_syn_ultra_xfer_period;
8801 asc_dvc->max_sdtr_index = 15;
8811 if (asc_dvc->bus_type == ASC_IS_PCI) {
8816 asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED;
8818 if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) {
8821 asc_dvc->bus_type = ASC_IS_ISAPNP;
8823 asc_dvc->cfg->isa_dma_channel =
8828 asc_dvc->cur_dvc_qng[i] = 0;
8829 asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG;
8830 asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *)0L;
8831 asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *)0L;
8832 asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG;
8918 static int AscTestExternalLram(ASC_DVC_VAR *asc_dvc)
8925 iop_base = asc_dvc->iop_base;
9099 static int AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
9110 iop_base = asc_dvc->iop_base;
9116 asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE;
9117 AscResetChipAndScsiBus(asc_dvc);
9118 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */
9121 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
9126 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
9137 chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type);
9144 if (asc_dvc->cfg->chip_version == 3) {
9161 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) ==
9187 asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr;
9188 asc_dvc->cfg->disc_enable = eep_config->disc_enable;
9189 asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng;
9190 asc_dvc->cfg->isa_dma_speed = ASC_EEP_GET_DMA_SPD(eep_config);
9191 asc_dvc->start_motor = eep_config->start_motor;
9192 asc_dvc->dvc_cntl = eep_config->cntl;
9193 asc_dvc->no_scam = eep_config->no_scam;
9194 asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0];
9195 asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1];
9196 asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2];
9197 asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3];
9198 asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4];
9199 asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5];
9200 if (!AscTestExternalLram(asc_dvc)) {
9201 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) ==
9228 asc_dvc->max_total_qng = eep_config->max_total_qng;
9236 asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config);
9237 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) &&
9238 !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) {
9239 asc_dvc->min_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX;
9243 asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i];
9244 asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng;
9245 asc_dvc->cfg->sdtr_period_offset[i] =
9247 (asc_dvc->min_sdtr_index << 4));
9252 asc_dvc->bus_type)) != 0) {
9267 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
9270 asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG;
9271 if (asc_dvc->err_code != 0)
9272 return asc_dvc->err_code;
9274 if (AscFindSignature(asc_dvc->iop_base)) {
9275 AscInitAscDvcVar(asc_dvc);
9276 warn_code = AscInitFromEEP(asc_dvc);
9277 asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG;
9278 if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT)
9279 asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT;
9281 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
9311 if (asc_dvc->err_code != 0)
9313 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state);
9315 return asc_dvc->err_code;
9321 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
9322 PortAddr iop_base = asc_dvc->iop_base;
9326 asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG;
9327 if (asc_dvc->err_code != 0)
9328 return asc_dvc->err_code;
9329 if (!AscFindSignature(asc_dvc->iop_base)) {
9330 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
9331 return asc_dvc->err_code;
9340 if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) !=
9341 asc_dvc->cfg->cmd_qng_enabled) {
9342 asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled;
9349 if (asc_dvc->bus_type & ASC_IS_PCI) {
9352 if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) {
9356 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB;
9357 asc_dvc->bug_fix_cntl |=
9363 if (asc_dvc->bus_type == ASC_IS_ISAPNP) {
9364 if (AscGetChipVersion(iop_base, asc_dvc->bus_type)
9366 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN;
9369 if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) !=
9370 asc_dvc->cfg->chip_scsi_id) {
9371 asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID;
9374 if (asc_dvc->bus_type & ASC_IS_ISA) {
9375 AscSetIsaDmaChannel(iop_base, asc_dvc->cfg->isa_dma_channel);
9376 AscSetIsaDmaSpeed(iop_base, asc_dvc->cfg->isa_dma_speed);
9380 asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG;
9409 if (asc_dvc->err_code != 0)
9411 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state);
9413 return asc_dvc->err_code;
10141 static int AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc)
10147 iop_base = asc_dvc->iop_base;
10186 asc_dvc->wdtr_able = eep_config.wdtr_able;
10187 asc_dvc->sdtr_able = eep_config.sdtr_able;
10188 asc_dvc->ultra_able = eep_config.ultra_able;
10189 asc_dvc->tagqng_able = eep_config.tagqng_able;
10190 asc_dvc->cfg->disc_enable = eep_config.disc_enable;
10191 asc_dvc->max_host_qng = eep_config.max_host_qng;
10192 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10193 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
10194 asc_dvc->start_motor = eep_config.start_motor;
10195 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
10196 asc_dvc->bios_ctrl = eep_config.bios_ctrl;
10197 asc_dvc->no_scam = eep_config.scam_tolerant;
10198 asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
10199 asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
10200 asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
10240 asc_dvc->max_host_qng = eep_config.max_host_qng;
10241 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10252 asc_dvc->cfg->termination = 0; /* auto termination */
10256 asc_dvc->cfg->termination = TERM_CTL_SEL;
10260 asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H;
10264 asc_dvc->cfg->termination =
10271 asc_dvc->cfg->termination = 0;
10291 static int AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc)
10299 iop_base = asc_dvc->iop_base;
10339 asc_dvc->wdtr_able = eep_config.wdtr_able;
10340 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
10341 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
10342 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
10343 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
10344 asc_dvc->tagqng_able = eep_config.tagqng_able;
10345 asc_dvc->cfg->disc_enable = eep_config.disc_enable;
10346 asc_dvc->max_host_qng = eep_config.max_host_qng;
10347 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10348 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
10349 asc_dvc->start_motor = eep_config.start_motor;
10350 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
10351 asc_dvc->bios_ctrl = eep_config.bios_ctrl;
10352 asc_dvc->no_scam = eep_config.scam_tolerant;
10353 asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
10354 asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
10355 asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
10361 asc_dvc->sdtr_able = 0;
10364 sdtr_speed = asc_dvc->sdtr_speed1;
10366 sdtr_speed = asc_dvc->sdtr_speed2;
10368 sdtr_speed = asc_dvc->sdtr_speed3;
10370 sdtr_speed = asc_dvc->sdtr_speed4;
10373 asc_dvc->sdtr_able |= (1 << tid);
10416 asc_dvc->max_host_qng = eep_config.max_host_qng;
10417 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10452 asc_dvc->cfg->termination = termination; /* auto termination for LVD */
10456 asc_dvc->cfg->termination = termination;
10460 asc_dvc->cfg->termination = termination | TERM_LVD_HI;
10464 asc_dvc->cfg->termination = termination | TERM_LVD;
10470 asc_dvc->cfg->termination = termination;
10490 static int AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
10498 iop_base = asc_dvc->iop_base;
10509 struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc);
10565 asc_dvc->wdtr_able = eep_config.wdtr_able;
10566 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
10567 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
10568 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
10569 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
10570 asc_dvc->ppr_able = 0;
10571 asc_dvc->tagqng_able = eep_config.tagqng_able;
10572 asc_dvc->cfg->disc_enable = eep_config.disc_enable;
10573 asc_dvc->max_host_qng = eep_config.max_host_qng;
10574 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10575 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID);
10576 asc_dvc->start_motor = eep_config.start_motor;
10577 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
10578 asc_dvc->bios_ctrl = eep_config.bios_ctrl;
10579 asc_dvc->no_scam = eep_config.scam_tolerant;
10585 asc_dvc->sdtr_able = 0;
10588 sdtr_speed = asc_dvc->sdtr_speed1;
10590 sdtr_speed = asc_dvc->sdtr_speed2;
10592 sdtr_speed = asc_dvc->sdtr_speed3;
10594 sdtr_speed = asc_dvc->sdtr_speed4;
10597 asc_dvc->sdtr_able |= (1 << tid);
10640 asc_dvc->max_host_qng = eep_config.max_host_qng;
10641 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
10676 asc_dvc->cfg->termination = termination; /* auto termination for LVD */
10680 asc_dvc->cfg->termination = termination;
10684 asc_dvc->cfg->termination = termination | TERM_LVD_HI;
10688 asc_dvc->cfg->termination = termination | TERM_LVD;
10694 asc_dvc->cfg->termination = termination;
10713 ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var;
10715 AdvPortAddr iop_base = asc_dvc->iop_base;
10719 asc_dvc->err_code = 0;
10727 asc_dvc->cfg->control_flag = 0;
10730 asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR;
10732 asc_dvc->cfg->chip_version =
10733 AdvGetChipVersion(iop_base, asc_dvc->bus_type);
10747 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
10753 if (asc_dvc->chip_type != ADV_CHIP_ASC3550 &&
10754 asc_dvc->chip_type != ADV_CHIP_ASC38C0800 &&
10755 asc_dvc->chip_type != ADV_CHIP_ASC38C1600) {
10756 asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE;
10769 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
10770 status = AdvInitFrom38C1600EEP(asc_dvc);
10771 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
10772 status = AdvInitFrom38C0800EEP(asc_dvc);
10774 status = AdvInitFrom3550EEP(asc_dvc);
10782 if (asc_dvc->err_code)
10784 asc_dvc->err_code);
10786 return asc_dvc->err_code;