Lines Matching +full:j +full:- +full:to +full:- +full:k
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()
123 unsigned char i, j, c, target_id, lun,cmdp; in atp870u_intr_handle() local
126 unsigned long adrcnt, k; in atp870u_intr_handle() local
131 struct atp_unit *dev = (struct atp_unit *)&host->hostdata; in atp870u_intr_handle()
134 j = atp_readb_io(dev, c, 0x1f); in atp870u_intr_handle()
135 if ((j & 0x80) != 0) in atp870u_intr_handle()
137 dev->in_int[c] = 0; in atp870u_intr_handle()
139 if ((j & 0x80) == 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()
154 for (k=0; k < 1000; k++) { in atp870u_intr_handle()
180 if ((j & 0x40) != 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()
330 j = atp_readb_base(dev, 0x29) & 0xfe; in atp870u_intr_handle()
331 atp_writeb_base(dev, 0x29, j); 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()
359 atp_writeb_io(dev, c, 0x12, ((unsigned char *) &k)[2]); in atp870u_intr_handle()
360 atp_writeb_io(dev, c, 0x13, ((unsigned char *) &k)[1]); in atp870u_intr_handle()
361 atp_writeb_io(dev, c, 0x14, ((unsigned char *) &k)[0]); in atp870u_intr_handle()
363 printk("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n", k, in atp870u_intr_handle()
369 j = target_id; in atp870u_intr_handle()
371 j = (j & 0x07) | 0x40; in atp870u_intr_handle()
374 j |= dev->id[c][target_id].dirct; in atp870u_intr_handle()
375 atp_writeb_io(dev, c, 0x15, j); 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()
410 j = 0; in atp870u_intr_handle()
416 if ((id & dev->wide_id[c]) != 0) { in atp870u_intr_handle()
417 j |= 0x01; in atp870u_intr_handle()
419 atp_writeb_io(dev, c, 0x1b, j); in atp870u_intr_handle()
420 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != j) in atp870u_intr_handle()
421 atp_writeb_io(dev, c, 0x1b, j); 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()
437 k = 0x10000; in atp870u_intr_handle()
439 k = id; in atp870u_intr_handle()
441 if (k > adrcnt) { 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()
506 j = atp_readb_base(dev, 0x29) | 0x01; in atp870u_intr_handle()
507 atp_writeb_base(dev, 0x29, j); 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()
534 * If there is stuff to send and nothing going then send it 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()
564 ((unsigned char *) (&k))[2]); in atp870u_intr_handle()
566 ((unsigned char *) (&k))[1]); in atp870u_intr_handle()
568 ((unsigned char *) (&k))[0]); 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()
586 ((unsigned char *) (&k))[2]); in atp870u_intr_handle()
588 ((unsigned char *) (&k))[1]); in atp870u_intr_handle()
590 ((unsigned char *) (&k))[0]); 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
618 * Queue a command to the ATP queue. Called with the host lock held.
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()
705 * On entry there is work queued to be done. We move some of that work to the in DEF_SCSI_QCMD()
713 unsigned int i;//,k; in DEF_SCSI_QCMD()
714 unsigned char j, target_id; in DEF_SCSI_QCMD() local
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()
764 printk("Abort to Send\n"); in DEF_SCSI_QCMD()
766 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
767 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
771 printk("OK to Send\n"); 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()
781 j = atp_readb_base(dev, 0x29) & 0xfe; in DEF_SCSI_QCMD()
782 atp_writeb_base(dev, 0x29, j); 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()
794 j = 0; in DEF_SCSI_QCMD()
802 if ((w & dev->wide_id[c]) != 0) { in DEF_SCSI_QCMD()
803 j |= 0x01; in DEF_SCSI_QCMD()
805 atp_writeb_io(dev, c, 0x1b, j); in DEF_SCSI_QCMD()
806 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != j) { in DEF_SCSI_QCMD()
807 atp_writeb_pci(dev, c, 0x1b, j); 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()
841 j = target_id; 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()
850 if ((j & 0x08) != 0) { in DEF_SCSI_QCMD()
851 j = (j & 0x07) | 0x40; in DEF_SCSI_QCMD()
856 if (workreq->sc_data_direction == DMA_TO_DEVICE) in DEF_SCSI_QCMD()
857 atp_writeb_io(dev, c, 0x15, j | 0x20); in DEF_SCSI_QCMD()
859 atp_writeb_io(dev, c, 0x15, j); 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()
885 scsi_for_each_sg(workreq, sgpnt, sg_count, j) { 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()
923 j = atp_readb_pci(dev, c, 1) & 0xf3; 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()
928 j |= 0x0c; in DEF_SCSI_QCMD()
930 atp_writeb_pci(dev, c, 1, j); 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()
959 printk( "start DMA(to target)\n"); in DEF_SCSI_QCMD()
962 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
964 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
971 printk( "start DMA(to host)\n"); in DEF_SCSI_QCMD()
974 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
976 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
983 unsigned short int i, k; in fun_scam() local
984 unsigned char j; in fun_scam() local
988 k = atp_readw_io(dev, 0, 0x1c); in fun_scam()
989 j = (unsigned char) (k >> 8); in fun_scam()
990 if ((k & 0x8000) != 0) /* DB7 all release? */ in fun_scam()
1001 *val |= 0x8000; /* no DB4-0, assert DB7 */ in fun_scam()
1011 return j; in fun_scam()
1017 unsigned char i, j, k; in tscam() local
1021 struct atp_unit *dev = (struct atp_unit *)&host->hostdata; in tscam()
1041 m <<= dev->host_id[0]; in tscam()
1042 j = 16; in tscam()
1045 j = 8; in tscam()
1056 for (i = 0; i < j; i++) { in tscam()
1067 k = (i & 0x07) | 0x40; in tscam()
1069 k = i; in tscam()
1071 atp_writeb_io(dev, 0, 0x15, k); in tscam()
1081 k = atp_readb_io(dev, 0, 0x17); in tscam()
1082 if ((k == 0x85) || (k == 0x42)) in tscam()
1084 if (k != 0x16) in tscam()
1086 } while (k != 0x16); in tscam()
1087 if ((k == 0x85) || (k == 0x42)) in tscam()
1130 * The funny division into multiple delays is to accomodate in tscam()
1132 * a large number to initialize a loop counter. To avoid in tscam()
1135 * XXX it would be more polite to find a way to use msleep() in tscam()
1158 j = 0; in tscam()
1166 k = fun_scam(dev, &val); in tscam()
1167 if ((k & 0x03) == 0) in tscam()
1169 mbuf[j] <<= 0x01; in tscam()
1170 mbuf[j] &= 0xfe; in tscam()
1171 if ((k & 0x02) != 0) in tscam()
1172 mbuf[j] |= 0x01; in tscam()
1173 i--; in tscam()
1176 j++; in tscam()
1184 j = mbuf[0]; in tscam()
1185 if ((j & 0x20) != 0) { /* bit5=1:ID up to 7 */ in tscam()
1188 if ((j & 0x06) != 0) { /* IDvalid? */ in tscam()
1189 k = mbuf[1]; in tscam()
1192 m <<= k; in tscam()
1195 if (k > 0) in tscam()
1196 k--; in tscam()
1202 k = i; /* max acceptable ID# */ in tscam()
1205 m <<= k; in tscam()
1208 if (k > 0) in tscam()
1209 k--; in tscam()
1214 /* k=binID#, */ in tscam()
1216 if (k < 8) { in tscam()
1221 k &= 0x07; in tscam()
1222 quintet[1] = g2q_tab[k]; in tscam()
1238 struct atp_unit *atp_dev = (struct atp_unit *)&host->hostdata; in atp870u_free_tables()
1239 int j, k; in atp870u_free_tables() local
1240 for (j=0; j < 2; j++) { in atp870u_free_tables()
1241 for (k = 0; k < 16; k++) { 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()
1255 int c,k; in atp870u_init_tables() local
1257 for(k=0;k<16;k++) { 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()
1282 for (k = 0; k < qcnt; k++) { in atp870u_init_tables()
1283 atp_dev->quereq[c][k] = NULL; in atp870u_init_tables()
1285 for (k = 0; k < 16; k++) { 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()
1309 unsigned char k, host_id; in atp870_init() local
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()
1340 k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; in atp870_init()
1341 atp_writeb_base(atpdev, 0x3a, k); in atp870_init()
1342 atp_writeb_base(atpdev, 0x3a, k & 0xdf); in atp870_init()
1344 atp_writeb_base(atpdev, 0x3a, k); 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()
1361 unsigned char k, m, host_id; in atp880_init() local
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()
1414 for (k = 0; k < 16; k++) { in atp880_init()
1415 n = 1 << k; 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()
1425 k = atp_readb_base(atpdev, 0x38) & 0x80; in atp880_init()
1426 atp_writeb_base(atpdev, 0x38, k); 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()
1447 unsigned char k, m, c; in atp885_init() local
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()
1470 for (k = 0; k < 4; k++) { in atp885_init()
1472 ((u32 *)&setupdata[m][0])[k] = in atp885_init()
1475 for (k = 0; k < 4; k++) { 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()
1488 for (k = 0; k < 16; k++) { in atp885_init()
1489 n = 1 << k; 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()
1499 k = setupdata[c][1]; in atp885_init()
1500 if ((k & 0x40) != 0) in atp885_init()
1501 atpdev->global_map[c] |= 0x20; in atp885_init()
1502 k &= 0x07; 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()
1510 k = atp_readb_base(atpdev, 0x28) & 0x8f; in atp885_init()
1511 k |= 0x10; in atp885_init()
1512 atp_writeb_base(atpdev, 0x28, k); in atp885_init()
1524 k = atpdev->host_id[0]; in atp885_init()
1525 if (k > 7) in atp885_init()
1526 k = (k & 0x07) | 0x40; in atp885_init()
1527 atp_set_host_id(atpdev, 0, k); in atp885_init()
1529 k = atpdev->host_id[1]; in atp885_init()
1530 if (k > 7) in atp885_init()
1531 k = (k & 0x07) | 0x40; in atp885_init()
1532 atp_set_host_id(atpdev, 1, k); in atp885_init()
1534 msleep(600); /* this delay used to be called tscam_885() */ 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()
1541 k = atp_readb_base(atpdev, 0x28) & 0xcf; in atp885_init()
1542 k |= 0xc0; in atp885_init()
1543 atp_writeb_base(atpdev, 0x28, k); in atp885_init()
1544 k = atp_readb_base(atpdev, 0x1f) | 0x80; in atp885_init()
1545 atp_writeb_base(atpdev, 0x1f, k); in atp885_init()
1546 k = atp_readb_base(atpdev, 0x29) | 0x01; in atp885_init()
1547 atp_writeb_base(atpdev, 0x29, k); 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()
1640 it is available to be used again. Until this gets worked out, we will
1645 unsigned char j, k, c; in atp870u_abort() local
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()
1656 for (j = 0; j < 0x18; j++) { in atp870u_abort()
1657 printk(" r%2x=%2x", j, atp_readb_io(dev, c, j)); in atp870u_abort()
1660 printk(" r1f=%2x in_snd=%2x ", atp_readb_io(dev, c, 0x1f), dev->in_snd[c]); in atp870u_abort()
1663 for(j=0;j<16;j++) { 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()
1774 unsigned char i, j, k, rmb, n; in atp_is() local
1792 if ((m & dev->active_id[c]) != 0) { in atp_is()
1795 if (i == dev->host_id[c]) { in atp_is()
1796 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); in atp_is()
1809 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1813 j = i; in atp_is()
1814 if ((j & 0x08) != 0) { in atp_is()
1815 j = (j & 0x07) | 0x40; in atp_is()
1817 atp_writeb_io(dev, c, 0x15, j); in atp_is()
1829 dev->active_id[c] |= m; in atp_is()
1834 else /* result of is870() merge - is this a bug? */ in atp_is()
1843 j = atp_readb_io(dev, c, 0x17); in atp_is()
1844 if (j != 0x16) { in atp_is()
1856 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1875 j = 0; in atp_is()
1877 k = atp_readb_io(dev, c, 0x1f); in atp_is()
1878 if ((k & 0x01) != 0) { in atp_is()
1879 mbuf[j++] = atp_readb_io(dev, c, 0x19); in atp_is()
1882 if ((k & 0x80) == 0) { in atp_is()
1885 j = atp_readb_io(dev, c, 0x17); in atp_is()
1886 if (j == 0x16) { in atp_is()
1904 dev->id[c][i].devtype = mbuf[0]; in atp_is()
1913 if ((i < 8) && ((dev->global_map[c] & 0x20) == 0)) in atp_is()
1915 } else { /* result of is870() merge - is this a bug? */ in atp_is()
1916 if ((dev->global_map[c] & 0x20) == 0) in atp_is()
1922 if (dev->sp[c][i] != 0x04) // force u2 in atp_is()
1935 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1951 j = 0; in atp_is()
1957 atp_writeb_io(dev, c, 0x19, u3[j++]); in atp_is()
1964 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
1965 if (j == 0x0f) { in atp_is()
1968 if (j == 0x0a) { in atp_is()
1971 if (j == 0x0e) { in atp_is()
1982 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
1983 if (j == 0x0f) { in atp_is()
1986 if (j == 0x0a) { in atp_is()
1989 if (j == 0x0e) { in atp_is()
1996 k = 0; in atp_is()
1998 j = atp_readb_io(dev, c, 0x1f); in atp_is()
1999 if ((j & 0x01) != 0) { in atp_is()
2000 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2003 if ((j & 0x80) == 0x00) { in atp_is()
2006 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2007 if (j == 0x0f) { in atp_is()
2010 if (j == 0x0a) { in atp_is()
2013 if (j == 0x0e) { in atp_is()
2024 j = atp_readb_io(dev, c, 0x17); in atp_is()
2025 if (j != 0x16) { in atp_is()
2026 if (j == 0x4e) { in atp_is()
2043 dev->wide_id[c] |= m; in atp_is()
2044 dev->id[c][i].devsp = 0xce; in atp_is()
2046 printk("dev->id[%2d][%2d].devsp = %2x\n", in atp_is()
2047 c, i, dev->id[c][i].devsp); in atp_is()
2060 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2077 j = 0; in atp_is()
2083 atp_writeb_io(dev, c, 0x19, wide[j++]); in atp_is()
2090 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2091 if (j == 0x0f) { in atp_is()
2094 if (j == 0x0a) { in atp_is()
2097 if (j == 0x0e) { in atp_is()
2108 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2109 if (j == 0x0f) { in atp_is()
2112 if (j == 0x0a) { in atp_is()
2115 if (j == 0x0e) { in atp_is()
2122 k = 0; in atp_is()
2124 j = atp_readb_io(dev, c, 0x1f); in atp_is()
2125 if ((j & 0x01) != 0) { in atp_is()
2126 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2129 if ((j & 0x80) == 0x00) { in atp_is()
2132 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2133 if (j == 0x0f) { in atp_is()
2136 if (j == 0x0a) { in atp_is()
2139 if (j == 0x0e) { in atp_is()
2151 j = atp_readb_io(dev, c, 0x17); in atp_is()
2152 if (j != 0x16) { in atp_is()
2153 if (j == 0x4e) { in atp_is()
2172 dev->wide_id[c] |= m; in atp_is()
2174 if ((dev->id[c][i].devtype == 0x00) || in atp_is()
2175 (dev->id[c][i].devtype == 0x07) || in atp_is()
2176 ((dev->id[c][i].devtype == 0x05) && ((n & 0x10) != 0))) { in atp_is()
2179 if ((dev->async[c] & m) != 0) { in atp_is()
2185 if ((!is885(dev) && !is880(dev)) || (dev->sp[c][i] == 0x02)) { in atp_is()
2189 if (dev->sp[c][i] >= 0x03) { in atp_is()
2194 j = 0; in atp_is()
2195 if ((m & dev->wide_id[c]) != 0) { in atp_is()
2196 j |= 0x01; in atp_is()
2198 atp_writeb_io(dev, c, 0x1b, j); in atp_is()
2206 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2223 j = 0; in atp_is()
2229 if ((m & dev->wide_id[c]) != 0) { in atp_is()
2231 if ((m & dev->ultra_map[c]) != 0) { in atp_is()
2232 atp_writeb_io(dev, c, 0x19, synuw[j++]); in atp_is()
2234 atp_writeb_io(dev, c, 0x19, synw[j++]); in atp_is()
2237 atp_writeb_io(dev, c, 0x19, synw_870[j++]); in atp_is()
2239 if ((m & dev->ultra_map[c]) != 0) { in atp_is()
2240 atp_writeb_io(dev, c, 0x19, synu[j++]); in atp_is()
2242 atp_writeb_io(dev, c, 0x19, synn[j++]); in atp_is()
2251 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2252 if (j == 0x0f) { in atp_is()
2255 if (j == 0x0a) { in atp_is()
2258 if (j == 0x0e) { in atp_is()
2269 j = atp_readb_io(dev, c, 0x17); in atp_is()
2270 if (j == 0x85) { in atp_is()
2273 j &= 0x0f; in atp_is()
2274 if (j == 0x0f) { in atp_is()
2277 if (j == 0x0a) { in atp_is()
2280 if (j == 0x0e) { in atp_is()
2290 k = 0; in atp_is()
2292 j = atp_readb_io(dev, c, 0x1f); in atp_is()
2293 if ((j & 0x01) != 0x00) { in atp_is()
2294 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2297 if ((j & 0x80) == 0x00) { in atp_is()
2303 j = atp_readb_io(dev, c, 0x17); in atp_is()
2304 if (j == 0x85) { in atp_is()
2307 j &= 0x0f; in atp_is()
2308 if (j == 0x0f) { in atp_is()
2311 if (j == 0x0a) { in atp_is()
2314 if (j == 0x0e) { in atp_is()
2327 j = atp_readb_io(dev, c, 0x17); in atp_is()
2328 if (j != 0x16) { in atp_is()
2352 dev->id[c][i].devsp = mbuf[4]; in atp_is()
2355 j = 0xb0; in atp_is()
2359 j = 0xa0; in atp_is()
2363 j = 0x20; in atp_is()
2367 j = 0x40; in atp_is()
2371 j = 0x50; in atp_is()
2374 j = 0x60; in atp_is()
2376 dev->id[c][i].devsp = (dev->id[c][i].devsp & 0x0f) | j; in atp_is()
2378 printk("dev->id[%2d][%2d].devsp = %2x\n", in atp_is()
2379 c,i,dev->id[c][i].devsp); in atp_is()