Lines Matching +full:db4 +full:- +full:db7

1 // SPDX-License-Identifier: GPL-2.0-only
32 #include <linux/dma-mapping.h>
50 outb(val, atp->baseport + reg); in atp_writeb_base()
55 outw(val, atp->baseport + reg); in atp_writew_base()
60 outb(val, atp->ioport[channel] + reg); in atp_writeb_io()
65 outw(val, atp->ioport[channel] + reg); in atp_writew_io()
70 outb(val, atp->pciport[channel] + reg); in atp_writeb_pci()
75 outl(val, atp->pciport[channel] + reg); in atp_writel_pci()
80 return inb(atp->baseport + reg); in atp_readb_base()
85 return inw(atp->baseport + reg); in atp_readw_base()
90 return inl(atp->baseport + reg); in atp_readl_base()
95 return inb(atp->ioport[channel] + reg); in atp_readb_io()
100 return inw(atp->ioport[channel] + reg); in atp_readw_io()
105 return inb(atp->pciport[channel] + reg); in atp_readb_pci()
110 return atp->pdev->device == ATP880_DEVID1 || in is880()
111 atp->pdev->device == ATP880_DEVID2; in is880()
116 return atp->pdev->device == ATP885_DEVID; in is885()
131 struct atp_unit *dev = (struct atp_unit *)&host->hostdata; in atp870u_intr_handle()
137 dev->in_int[c] = 0; in atp870u_intr_handle()
144 dev->in_int[c] = 1; in atp870u_intr_handle()
146 if (dev->working[c] != 0) { in atp870u_intr_handle()
181 if (dev->last_cmd[c] == 0xff) { in atp870u_intr_handle()
182 dev->last_cmd[c] = target_id; in atp870u_intr_handle()
184 dev->last_cmd[c] |= 0x40; in atp870u_intr_handle()
187 dev->r1f[c][target_id] |= j; in atp870u_intr_handle()
192 if ((dev->last_cmd[c] & 0xf0) != 0x40) { in atp870u_intr_handle()
193 dev->last_cmd[c] = 0xff; in atp870u_intr_handle()
203 if (dev->id[c][target_id].last_len != adrcnt) { in atp870u_intr_handle()
204 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
205 k -= adrcnt; in atp870u_intr_handle()
206 dev->id[c][target_id].tran_len = k; in atp870u_intr_handle()
207 dev->id[c][target_id].last_len = adrcnt; in atp870u_intr_handle()
210 printk("dev->id[c][target_id].last_len = %d " in atp870u_intr_handle()
211 "dev->id[c][target_id].tran_len = %d\n", in atp870u_intr_handle()
212 dev->id[c][target_id].last_len, in atp870u_intr_handle()
213 dev->id[c][target_id].tran_len); in atp870u_intr_handle()
220 if (dev->wide_id[c] != 0) { in atp870u_intr_handle()
228 spin_lock_irqsave(dev->host->host_lock, flags); in atp870u_intr_handle()
229 if (((dev->quhd[c] != dev->quend[c]) || in atp870u_intr_handle()
230 (dev->last_cmd[c] != 0xff)) && in atp870u_intr_handle()
231 (dev->in_snd[c] == 0)) { in atp870u_intr_handle()
237 spin_unlock_irqrestore(dev->host->host_lock, flags); in atp870u_intr_handle()
241 dev->in_int[c] = 0; in atp870u_intr_handle()
249 dev->last_cmd[c] |= 0x40; in atp870u_intr_handle()
250 dev->in_int[c] = 0; in atp870u_intr_handle()
255 if ((dev->last_cmd[c] & 0xf0) != 0x40) { in atp870u_intr_handle()
256 dev->last_cmd[c] = 0xff; in atp870u_intr_handle()
265 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
266 k -= adrcnt; in atp870u_intr_handle()
267 dev->id[c][target_id].tran_len = k; in atp870u_intr_handle()
268 dev->id[c][target_id].last_len = adrcnt; in atp870u_intr_handle()
271 dev->in_int[c] = 0; in atp870u_intr_handle()
291 if ((dev->last_cmd[c] & 0xf0) != 0x40) { in atp870u_intr_handle()
292 dev->last_cmd[c] = 0xff; in atp870u_intr_handle()
305 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
306 k -= adrcnt; in atp870u_intr_handle()
307 dev->id[c][target_id].tran_len = k; in atp870u_intr_handle()
308 dev->id[c][target_id].last_len = adrcnt; in atp870u_intr_handle()
310 dev->in_int[c] = 0; in atp870u_intr_handle()
317 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
322 dev->in_int[c] = 0; in atp870u_intr_handle()
326 if (dev->last_cmd[c] != 0xff) { in atp870u_intr_handle()
327 dev->last_cmd[c] |= 0x40; in atp870u_intr_handle()
346 workreq = dev->id[c][target_id].curr_req; in atp870u_intr_handle()
349 for (l = 0; l < workreq->cmd_len; l++) in atp870u_intr_handle()
350 printk(KERN_DEBUG " %x",workreq->cmnd[l]); in atp870u_intr_handle()
355 atp_writeb_io(dev, c, 0x11, dev->id[c][target_id].devsp); in atp870u_intr_handle()
356 adrcnt = dev->id[c][target_id].tran_len; in atp870u_intr_handle()
357 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
374 j |= dev->id[c][target_id].dirct; in atp870u_intr_handle()
381 //j=workreq->cmnd[0]; in atp870u_intr_handle()
382 if ((workreq->cmnd[0] == READ_6) || in atp870u_intr_handle()
383 (workreq->cmnd[0] == READ_10) || in atp870u_intr_handle()
384 (workreq->cmnd[0] == WRITE_6) || in atp870u_intr_handle()
385 (workreq->cmnd[0] == WRITE_10)) { in atp870u_intr_handle()
390 if ((workreq->cmnd[0] == READ_6) || in atp870u_intr_handle()
391 (workreq->cmnd[0] == READ_10) || in atp870u_intr_handle()
392 (workreq->cmnd[0] == WRITE_6) || in atp870u_intr_handle()
393 (workreq->cmnd[0] == WRITE_10)) in atp870u_intr_handle()
400 if ((workreq->cmnd[0] == READ_6) || in atp870u_intr_handle()
401 (workreq->cmnd[0] == READ_10) || in atp870u_intr_handle()
402 (workreq->cmnd[0] == WRITE_6) || in atp870u_intr_handle()
403 (workreq->cmnd[0] == WRITE_10)) in atp870u_intr_handle()
416 if ((id & dev->wide_id[c]) != 0) { in atp870u_intr_handle()
422 if (dev->id[c][target_id].last_len == 0) { in atp870u_intr_handle()
424 dev->in_int[c] = 0; in atp870u_intr_handle()
426 printk("dev->id[c][target_id].last_len = 0\n"); in atp870u_intr_handle()
433 prd = dev->id[c][target_id].prd_pos; in atp870u_intr_handle()
443 (unsigned short int)(k - adrcnt); in atp870u_intr_handle()
446 dev->id[c][target_id].prd_pos = prd; in atp870u_intr_handle()
448 adrcnt -= k; in atp870u_intr_handle()
449 dev->id[c][target_id].prdaddr += 0x08; in atp870u_intr_handle()
452 dev->id[c][target_id].prd_pos = prd; in atp870u_intr_handle()
456 atp_writel_pci(dev, c, 0x04, dev->id[c][target_id].prdaddr); in atp870u_intr_handle()
458 printk("dev->id[%d][%d].prdaddr 0x%8x\n", in atp870u_intr_handle()
459 c, target_id, dev->id[c][target_id].prdaddr); in atp870u_intr_handle()
468 if (dev->id[c][target_id].dirct != 0) { in atp870u_intr_handle()
471 dev->in_int[c] = 0; in atp870u_intr_handle()
479 dev->in_int[c] = 0; in atp870u_intr_handle()
490 workreq = dev->id[c][target_id].curr_req; in atp870u_intr_handle()
493 if ((dev->last_cmd[c] & 0xf0) != 0x40) { in atp870u_intr_handle()
494 dev->last_cmd[c] = 0xff; in atp870u_intr_handle()
497 workreq->result = atp_readb_io(dev, c, 0x0f); in atp870u_intr_handle()
498 if (((dev->r1f[c][target_id] & 0x10) != 0) && is885(dev)) { in atp870u_intr_handle()
500 workreq->result = SAM_STAT_CHECK_CONDITION; in atp870u_intr_handle()
503 workreq->result = SAM_STAT_CHECK_CONDITION; in atp870u_intr_handle()
514 spin_lock_irqsave(dev->host->host_lock, flags); in atp870u_intr_handle()
517 printk("workreq->scsi_done\n"); in atp870u_intr_handle()
522 dev->id[c][target_id].curr_req = NULL; in atp870u_intr_handle()
523 dev->working[c]--; in atp870u_intr_handle()
524 spin_unlock_irqrestore(dev->host->host_lock, flags); in atp870u_intr_handle()
528 if (dev->wide_id[c] != 0) { in atp870u_intr_handle()
536 spin_lock_irqsave(dev->host->host_lock, flags); in atp870u_intr_handle()
537 if (((dev->last_cmd[c] != 0xff) || in atp870u_intr_handle()
538 (dev->quhd[c] != dev->quend[c])) && in atp870u_intr_handle()
539 (dev->in_snd[c] == 0)) { in atp870u_intr_handle()
545 spin_unlock_irqrestore(dev->host->host_lock, flags); in atp870u_intr_handle()
546 dev->in_int[c] = 0; in atp870u_intr_handle()
549 if ((dev->last_cmd[c] & 0xf0) != 0x40) { in atp870u_intr_handle()
550 dev->last_cmd[c] = 0xff; in atp870u_intr_handle()
557 atp_writel_pci(dev, c, 4, dev->id[c][target_id].prdaddr); in atp870u_intr_handle()
562 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
569 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
571 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
575 dev->in_int[c] = 0; in atp870u_intr_handle()
579 atp_writel_pci(dev, c, 4, dev->id[c][target_id].prdaddr); in atp870u_intr_handle()
584 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
594 dev->id[c][target_id].dirct = 0x20; in atp870u_intr_handle()
597 dev->in_int[c] = 0; in atp870u_intr_handle()
604 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
610 dev->in_int[c] = 0; in atp870u_intr_handle()
615 * atp870u_queuecommand_lck - Queue SCSI command
629 req_p->sense_buffer[0]=0; in atp870u_queuecommand_lck()
632 req_p->result = DID_BAD_TARGET << 16; in atp870u_queuecommand_lck()
635 printk("atp870u_queuecommand : req_p->device->channel > 1\n"); in atp870u_queuecommand_lck()
640 host = req_p->device->host; in atp870u_queuecommand_lck()
641 dev = (struct atp_unit *)&host->hostdata; in atp870u_queuecommand_lck()
650 if ((m & dev->active_id[c]) == 0) { in atp870u_queuecommand_lck()
651 req_p->result = DID_BAD_TARGET << 16; in atp870u_queuecommand_lck()
659 dev->quend[c]++; in atp870u_queuecommand_lck()
660 if (dev->quend[c] >= qcnt) { in atp870u_queuecommand_lck()
661 dev->quend[c] = 0; in atp870u_queuecommand_lck()
667 if (dev->quhd[c] == dev->quend[c]) { in atp870u_queuecommand_lck()
668 if (dev->quend[c] == 0) { in atp870u_queuecommand_lck()
669 dev->quend[c] = qcnt; in atp870u_queuecommand_lck()
672 printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n"); in atp870u_queuecommand_lck()
674 dev->quend[c]--; in atp870u_queuecommand_lck()
675 req_p->result = DID_BUS_BUSY << 16; in atp870u_queuecommand_lck()
679 dev->quereq[c][dev->quend[c]] = req_p; in atp870u_queuecommand_lck()
681 printk("dev->ioport[c] = %x atp_readb_io(dev, c, 0x1c) = %x " in atp870u_queuecommand_lck()
682 "dev->in_int[%d] = %d dev->in_snd[%d] = %d\n", in atp870u_queuecommand_lck()
683 dev->ioport[c], atp_readb_io(dev, c, 0x1c), c, in atp870u_queuecommand_lck()
684 dev->in_int[c],c,dev->in_snd[c]); in atp870u_queuecommand_lck()
687 (dev->in_int[c] == 0) && in atp870u_queuecommand_lck()
688 (dev->in_snd[c] == 0)) { in atp870u_queuecommand_lck()
703 * send_s870 - send a command to the controller in DEF_SCSI_QCMD()
720 if (dev->in_snd[c] != 0) { in DEF_SCSI_QCMD()
729 dev->in_snd[c] = 1; in DEF_SCSI_QCMD()
730 if ((dev->last_cmd[c] != 0xff) && ((dev->last_cmd[c] & 0x40) != 0)) { in DEF_SCSI_QCMD()
731 dev->last_cmd[c] &= 0x0f; in DEF_SCSI_QCMD()
732 workreq = dev->id[c][dev->last_cmd[c]].curr_req; in DEF_SCSI_QCMD()
734 dev->last_cmd[c] = 0xff; in DEF_SCSI_QCMD()
735 if (dev->quhd[c] == dev->quend[c]) { in DEF_SCSI_QCMD()
736 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
742 if ((dev->last_cmd[c] != 0xff) && (dev->working[c] != 0)) { in DEF_SCSI_QCMD()
743 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
746 dev->working[c]++; in DEF_SCSI_QCMD()
747 j = dev->quhd[c]; in DEF_SCSI_QCMD()
748 dev->quhd[c]++; in DEF_SCSI_QCMD()
749 if (dev->quhd[c] >= qcnt) in DEF_SCSI_QCMD()
750 dev->quhd[c] = 0; in DEF_SCSI_QCMD()
751 workreq = dev->quereq[c][dev->quhd[c]]; in DEF_SCSI_QCMD()
752 if (dev->id[c][scmd_id(workreq)].curr_req != NULL) { in DEF_SCSI_QCMD()
753 dev->quhd[c] = j; in DEF_SCSI_QCMD()
754 dev->working[c]--; in DEF_SCSI_QCMD()
755 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
758 dev->id[c][scmd_id(workreq)].curr_req = workreq; in DEF_SCSI_QCMD()
759 dev->last_cmd[c] = scmd_id(workreq); in DEF_SCSI_QCMD()
766 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
767 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
773 for(i=0;i<workreq->cmd_len;i++) { in DEF_SCSI_QCMD()
774 printk(" %x",workreq->cmnd[i]); in DEF_SCSI_QCMD()
783 dev->r1f[c][scmd_id(workreq)] = 0; in DEF_SCSI_QCMD()
786 if (workreq->cmnd[0] == READ_CAPACITY) { in DEF_SCSI_QCMD()
790 if (workreq->cmnd[0] == TEST_UNIT_READY) { in DEF_SCSI_QCMD()
802 if ((w & dev->wide_id[c]) != 0) { in DEF_SCSI_QCMD()
816 atp_writeb_io(dev, c, 0x00, workreq->cmd_len); in DEF_SCSI_QCMD()
822 for (i = 0; i < workreq->cmd_len; i++) in DEF_SCSI_QCMD()
823 atp_writeb_io(dev, c, 0x03 + i, workreq->cmnd[i]); in DEF_SCSI_QCMD()
824 atp_writeb_io(dev, c, 0x0f, workreq->device->lun); in DEF_SCSI_QCMD()
828 atp_writeb_io(dev, c, 0x11, dev->id[c][target_id].devsp); in DEF_SCSI_QCMD()
830 printk("dev->id[%d][%d].devsp = %2x\n",c,target_id, in DEF_SCSI_QCMD()
831 dev->id[c][target_id].devsp); in DEF_SCSI_QCMD()
842 dev->id[c][j].last_len = l; in DEF_SCSI_QCMD()
843 dev->id[c][j].tran_len = 0; in DEF_SCSI_QCMD()
845 printk("dev->id[%2d][%2d].last_len = %d\n",c,j,dev->id[c][j].last_len); in DEF_SCSI_QCMD()
856 if (workreq->sc_data_direction == DMA_TO_DEVICE) in DEF_SCSI_QCMD()
862 dev->id[c][target_id].dirct = 0; in DEF_SCSI_QCMD()
870 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
871 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
874 prd = dev->id[c][target_id].prd_table; in DEF_SCSI_QCMD()
875 dev->id[c][target_id].prd_pos = prd; in DEF_SCSI_QCMD()
895 l -= 0x10000; in DEF_SCSI_QCMD()
904 (((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000); in DEF_SCSI_QCMD()
916 dev->id[c][target_id].prdaddr,target_id); in DEF_SCSI_QCMD()
918 dev->id[c][target_id].prdaddr = dev->id[c][target_id].prd_bus; in DEF_SCSI_QCMD()
919 atp_writel_pci(dev, c, 4, dev->id[c][target_id].prdaddr); in DEF_SCSI_QCMD()
924 if ((workreq->cmnd[0] == READ_6) || in DEF_SCSI_QCMD()
925 (workreq->cmnd[0] == READ_10) || in DEF_SCSI_QCMD()
926 (workreq->cmnd[0] == WRITE_6) || in DEF_SCSI_QCMD()
927 (workreq->cmnd[0] == WRITE_10)) { in DEF_SCSI_QCMD()
932 if ((workreq->cmnd[0] == READ_6) || in DEF_SCSI_QCMD()
933 (workreq->cmnd[0] == READ_10) || in DEF_SCSI_QCMD()
934 (workreq->cmnd[0] == WRITE_6) || in DEF_SCSI_QCMD()
935 (workreq->cmnd[0] == WRITE_10)) in DEF_SCSI_QCMD()
942 if ((workreq->cmnd[0] == READ_6) || in DEF_SCSI_QCMD()
943 (workreq->cmnd[0] == READ_10) || in DEF_SCSI_QCMD()
944 (workreq->cmnd[0] == WRITE_6) || in DEF_SCSI_QCMD()
945 (workreq->cmnd[0] == WRITE_10)) in DEF_SCSI_QCMD()
953 if(workreq->sc_data_direction == DMA_TO_DEVICE) { in DEF_SCSI_QCMD()
954 dev->id[c][target_id].dirct = 0x20; in DEF_SCSI_QCMD()
962 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
964 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
974 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
976 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
990 if ((k & 0x8000) != 0) /* DB7 all release? */ in fun_scam()
1001 *val |= 0x8000; /* no DB4-0, assert DB7 */ in fun_scam()
1021 struct atp_unit *dev = (struct atp_unit *)&host->hostdata; in tscam()
1041 m <<= dev->host_id[0]; in tscam()
1120 val |= 0x8003; /* io,cd,db7 */ in tscam()
1173 i--; in tscam()
1196 k--; in tscam()
1209 k--; in tscam()
1238 struct atp_unit *atp_dev = (struct atp_unit *)&host->hostdata; in atp870u_free_tables()
1242 if (!atp_dev->id[j][k].prd_table) in atp870u_free_tables()
1244 dma_free_coherent(&atp_dev->pdev->dev, 1024, in atp870u_free_tables()
1245 atp_dev->id[j][k].prd_table, in atp870u_free_tables()
1246 atp_dev->id[j][k].prd_bus); in atp870u_free_tables()
1247 atp_dev->id[j][k].prd_table = NULL; in atp870u_free_tables()
1254 struct atp_unit *atp_dev = (struct atp_unit *)&host->hostdata; in atp870u_init_tables()
1258 atp_dev->id[c][k].prd_table = in atp870u_init_tables()
1259 dma_alloc_coherent(&atp_dev->pdev->dev, 1024, in atp870u_init_tables()
1260 &(atp_dev->id[c][k].prd_bus), in atp870u_init_tables()
1262 if (!atp_dev->id[c][k].prd_table) { in atp870u_init_tables()
1265 return -ENOMEM; in atp870u_init_tables()
1267 atp_dev->id[c][k].prdaddr = atp_dev->id[c][k].prd_bus; in atp870u_init_tables()
1268 atp_dev->id[c][k].devsp=0x20; in atp870u_init_tables()
1269 atp_dev->id[c][k].devtype = 0x7f; in atp870u_init_tables()
1270 atp_dev->id[c][k].curr_req = NULL; in atp870u_init_tables()
1273 atp_dev->active_id[c] = 0; in atp870u_init_tables()
1274 atp_dev->wide_id[c] = 0; in atp870u_init_tables()
1275 atp_dev->host_id[c] = 0x07; in atp870u_init_tables()
1276 atp_dev->quhd[c] = 0; in atp870u_init_tables()
1277 atp_dev->quend[c] = 0; in atp870u_init_tables()
1278 atp_dev->last_cmd[c] = 0xff; in atp870u_init_tables()
1279 atp_dev->in_snd[c] = 0; in atp870u_init_tables()
1280 atp_dev->in_int[c] = 0; in atp870u_init_tables()
1283 atp_dev->quereq[c][k] = NULL; in atp870u_init_tables()
1286 atp_dev->id[c][k].curr_req = NULL; in atp870u_init_tables()
1287 atp_dev->sp[c][k] = 0x04; in atp870u_init_tables()
1308 struct pci_dev *pdev = atpdev->pdev; in atp870_init()
1312 (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7610 && in atp870_init()
1313 pdev->revision == 4) || in atp870_init()
1314 (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) || in atp870_init()
1315 (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW); in atp870_init()
1319 dev_info(&pdev->dev, "ACARD AEC-671X PCI Ultra/W SCSI-2/3 " in atp870_init()
1321 shpnt->io_port, shpnt->irq); in atp870_init()
1323 atpdev->ioport[0] = shpnt->io_port; in atp870_init()
1324 atpdev->pciport[0] = shpnt->io_port + 0x20; in atp870_init()
1326 atpdev->host_id[0] = host_id; in atp870_init()
1328 atpdev->global_map[0] = atp_readb_base(atpdev, 0x2d); in atp870_init()
1329 atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x2e); in atp870_init()
1331 if (atpdev->ultra_map[0] == 0) { in atp870_init()
1333 atpdev->global_map[0] = 0x20; in atp870_init()
1334 atpdev->ultra_map[0] = 0xffff; in atp870_init()
1337 if (pdev->revision > 0x07) /* check if atp876 chip */ in atp870_init()
1353 shpnt->max_id = wide_chip ? 16 : 8; in atp870_init()
1354 shpnt->this_id = host_id; in atp870_init()
1360 struct pci_dev *pdev = atpdev->pdev; in atp880_init()
1366 atpdev->ioport[0] = shpnt->io_port + 0x40; in atp880_init()
1367 atpdev->pciport[0] = shpnt->io_port + 0x28; in atp880_init()
1371 dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD " in atp880_init()
1373 shpnt->io_port, shpnt->irq); in atp880_init()
1374 atpdev->host_id[0] = host_id; in atp880_init()
1376 atpdev->global_map[0] = atp_readb_base(atpdev, 0x35); in atp880_init()
1377 atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x3c); in atp880_init()
1387 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); in atp880_init()
1388 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); in atp880_init()
1389 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); in atp880_init()
1390 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); in atp880_init()
1393 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); in atp880_init()
1394 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); in atp880_init()
1395 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); in atp880_init()
1396 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); in atp880_init()
1399 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); in atp880_init()
1400 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); in atp880_init()
1401 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); in atp880_init()
1402 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); in atp880_init()
1405 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); in atp880_init()
1406 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); in atp880_init()
1407 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); in atp880_init()
1408 atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); in atp880_init()
1412 atpdev->ultra_map[0] = 0; in atp880_init()
1413 atpdev->async[0] = 0; in atp880_init()
1416 if (atpdev->sp[0][k] > 1) in atp880_init()
1417 atpdev->ultra_map[0] |= n; in atp880_init()
1419 if (atpdev->sp[0][k] == 0) in atp880_init()
1420 atpdev->async[0] |= n; in atp880_init()
1422 atpdev->async[0] = ~(atpdev->async[0]); in atp880_init()
1423 atp_writeb_base(atpdev, 0x35, atpdev->global_map[0]); in atp880_init()
1439 shpnt->max_id = 16; in atp880_init()
1440 shpnt->this_id = host_id; in atp880_init()
1446 struct pci_dev *pdev = atpdev->pdev; in atp885_init()
1451 dev_info(&pdev->dev, "ACARD AEC-67162 PCI Ultra3 LVD " in atp885_init()
1453 shpnt->io_port, shpnt->irq); in atp885_init()
1455 atpdev->ioport[0] = shpnt->io_port + 0x80; in atp885_init()
1456 atpdev->ioport[1] = shpnt->io_port + 0xc0; in atp885_init()
1457 atpdev->pciport[0] = shpnt->io_port + 0x40; in atp885_init()
1458 atpdev->pciport[1] = shpnt->io_port + 0x50; in atp885_init()
1469 atpdev->global_map[m] = 0; in atp885_init()
1477 ((u32 *)&atpdev->sp[m][0])[k] = in atp885_init()
1486 atpdev->ultra_map[c] = 0; in atp885_init()
1487 atpdev->async[c] = 0; in atp885_init()
1490 if (atpdev->sp[c][k] > 1) in atp885_init()
1491 atpdev->ultra_map[c] |= n; in atp885_init()
1493 if (atpdev->sp[c][k] == 0) in atp885_init()
1494 atpdev->async[c] |= n; in atp885_init()
1496 atpdev->async[c] = ~(atpdev->async[c]); in atp885_init()
1498 if (atpdev->global_map[c] == 0) { in atp885_init()
1501 atpdev->global_map[c] |= 0x20; in atp885_init()
1503 atpdev->global_map[c] |= k; in atp885_init()
1505 atpdev->global_map[c] |= 0x08; in atp885_init()
1506 atpdev->host_id[c] = setupdata[c][0] & 0x07; in atp885_init()
1524 k = atpdev->host_id[0]; in atp885_init()
1529 k = atpdev->host_id[1]; in atp885_init()
1535 dev_info(&pdev->dev, "Scanning Channel A SCSI Device ...\n"); in atp885_init()
1538 dev_info(&pdev->dev, "Scanning Channel B SCSI Device ...\n"); in atp885_init()
1548 shpnt->max_id = 16; in atp885_init()
1549 shpnt->max_lun = (atpdev->global_map[0] & 0x07) + 1; in atp885_init()
1550 shpnt->max_channel = 1; in atp885_init()
1551 shpnt->this_id = atpdev->host_id[0]; in atp885_init()
1554 /* return non-zero on detection */
1561 if (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 && pdev->revision < 2) { in atp870u_probe()
1562 dev_err(&pdev->dev, "ATP850S chips (AEC6710L/F cards) are not supported.\n"); in atp870u_probe()
1563 return -ENODEV; in atp870u_probe()
1570 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { in atp870u_probe()
1572 err = -EIO; in atp870u_probe()
1581 err = -ENOMEM; in atp870u_probe()
1588 atpdev->host = shpnt; in atp870u_probe()
1589 atpdev->pdev = pdev; in atp870u_probe()
1592 shpnt->io_port = pci_resource_start(pdev, 0); in atp870u_probe()
1593 shpnt->io_port &= 0xfffffff8; in atp870u_probe()
1594 shpnt->n_io_port = pci_resource_len(pdev, 0); in atp870u_probe()
1595 atpdev->baseport = shpnt->io_port; in atp870u_probe()
1596 shpnt->unique_id = shpnt->io_port; in atp870u_probe()
1597 shpnt->irq = pdev->irq; in atp870u_probe()
1601 dev_err(&pdev->dev, "Unable to allocate tables for Acard controller\n"); in atp870u_probe()
1612 err = request_irq(shpnt->irq, atp870u_intr_handle, IRQF_SHARED, "atp870u", shpnt); in atp870u_probe()
1614 dev_err(&pdev->dev, "Unable to allocate IRQ %d.\n", shpnt->irq); in atp870u_probe()
1618 err = scsi_add_host(shpnt, &pdev->dev); in atp870u_probe()
1626 free_irq(shpnt->irq, shpnt); in atp870u_probe()
1649 host = SCpnt->device->host; in atp870u_abort()
1651 dev = (struct atp_unit *)&host->hostdata; in atp870u_abort()
1654 printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]); in atp870u_abort()
1655 printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]); in atp870u_abort()
1660 printk(" r1f=%2x in_snd=%2x ", atp_readb_io(dev, c, 0x1f), dev->in_snd[c]); in atp870u_abort()
1664 if (dev->id[c][j].curr_req != NULL) { in atp870u_abort()
1665 workrequ = dev->id[c][j].curr_req; in atp870u_abort()
1667 for (k=0; k < workrequ->cmd_len; k++) { in atp870u_abort()
1668 printk(" %2x ",workrequ->cmnd[k]); in atp870u_abort()
1670 printk(" last_lenu= %x ",(unsigned int)dev->id[c][j].last_len); in atp870u_abort()
1680 strcpy(buffer, "ACARD AEC-6710/6712/67160 PCI Ultra/W/LVD SCSI-3 Adapter Driver V2.6+ac "); in atp870u_info()
1687 seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n\n" in atp870u_show_info()
1689 seq_printf(m, " Base IO: %#.4lx\n", HBAptr->io_port); in atp870u_show_info()
1690 seq_printf(m, " IRQ: %d\n", HBAptr->irq); in atp870u_show_info()
1718 struct Scsi_Host *pshost = devext->host; in atp870u_remove()
1721 free_irq(pshost->irq, pshost); in atp870u_remove()
1790 if ((m & dev->active_id[c]) != 0) { in atp_is()
1793 if (i == dev->host_id[c]) { in atp_is()
1794 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); in atp_is()
1807 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1827 dev->active_id[c] |= m; in atp_is()
1832 else /* result of is870() merge - is this a bug? */ in atp_is()
1854 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1902 dev->id[c][i].devtype = mbuf[0]; in atp_is()
1911 if ((i < 8) && ((dev->global_map[c] & 0x20) == 0)) in atp_is()
1913 } else { /* result of is870() merge - is this a bug? */ in atp_is()
1914 if ((dev->global_map[c] & 0x20) == 0) in atp_is()
1920 if (dev->sp[c][i] != 0x04) // force u2 in atp_is()
1933 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2041 dev->wide_id[c] |= m; in atp_is()
2042 dev->id[c][i].devsp = 0xce; in atp_is()
2044 printk("dev->id[%2d][%2d].devsp = %2x\n", in atp_is()
2045 c, i, dev->id[c][i].devsp); in atp_is()
2058 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2170 dev->wide_id[c] |= m; in atp_is()
2172 if ((dev->id[c][i].devtype == 0x00) || in atp_is()
2173 (dev->id[c][i].devtype == 0x07) || in atp_is()
2174 ((dev->id[c][i].devtype == 0x05) && ((n & 0x10) != 0))) { in atp_is()
2177 if ((dev->async[c] & m) != 0) { in atp_is()
2183 if ((!is885(dev) && !is880(dev)) || (dev->sp[c][i] == 0x02)) { in atp_is()
2187 if (dev->sp[c][i] >= 0x03) { in atp_is()
2193 if ((m & dev->wide_id[c]) != 0) { in atp_is()
2204 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2227 if ((m & dev->wide_id[c]) != 0) { in atp_is()
2229 if ((m & dev->ultra_map[c]) != 0) { in atp_is()
2237 if ((m & dev->ultra_map[c]) != 0) { in atp_is()
2350 dev->id[c][i].devsp = mbuf[4]; in atp_is()
2374 dev->id[c][i].devsp = (dev->id[c][i].devsp & 0x0f) | j; in atp_is()
2376 printk("dev->id[%2d][%2d].devsp = %2x\n", in atp_is()
2377 c,i,dev->id[c][i].devsp); in atp_is()