Lines Matching refs:c

44 static void send_s870(struct atp_unit *dev,unsigned char c);
45 static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip,
123 unsigned char i, j, c, target_id, lun,cmdp; in atp870u_intr_handle() local
133 for (c = 0; c < 2; c++) { in atp870u_intr_handle()
134 j = atp_readb_io(dev, c, 0x1f); in atp870u_intr_handle()
137 dev->in_int[c] = 0; in atp870u_intr_handle()
144 dev->in_int[c] = 1; in atp870u_intr_handle()
145 cmdp = atp_readb_io(dev, c, 0x10); in atp870u_intr_handle()
146 if (dev->working[c] != 0) { in atp870u_intr_handle()
148 if ((atp_readb_io(dev, c, 0x16) & 0x80) == 0) in atp870u_intr_handle()
149 atp_writeb_io(dev, c, 0x16, in atp870u_intr_handle()
150 (atp_readb_io(dev, c, 0x16) | 0x80)); in atp870u_intr_handle()
152 if ((atp_readb_pci(dev, c, 0x00) & 0x08) != 0) in atp870u_intr_handle()
155 if ((atp_readb_pci(dev, c, 2) & 0x08) == 0) in atp870u_intr_handle()
157 if ((atp_readb_pci(dev, c, 2) & 0x01) == 0) in atp870u_intr_handle()
161 atp_writeb_pci(dev, c, 0, 0x00); in atp870u_intr_handle()
163 i = atp_readb_io(dev, c, 0x17); in atp870u_intr_handle()
166 atp_writeb_pci(dev, c, 2, 0x06); in atp870u_intr_handle()
168 target_id = atp_readb_io(dev, c, 0x15); 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()
198 atp_readb_io(dev, c, 0x12); in atp870u_intr_handle()
200 atp_readb_io(dev, c, 0x13); in atp870u_intr_handle()
202 atp_readb_io(dev, c, 0x14); 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()
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()
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()
221 atp_writeb_io(dev, c, 0x1b, 0x01); in atp870u_intr_handle()
222 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != 0x01) in atp870u_intr_handle()
223 atp_writeb_io(dev, c, 0x1b, 0x01); 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()
235 send_s870(dev,c); 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()
260 atp_readb_io(dev, c, 0x12); in atp870u_intr_handle()
262 atp_readb_io(dev, c, 0x13); in atp870u_intr_handle()
264 atp_readb_io(dev, c, 0x14); in atp870u_intr_handle()
265 k = dev->id[c][target_id].last_len; 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()
269 atp_writeb_io(dev, c, 0x10, 0x41); in atp870u_intr_handle()
270 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
271 dev->in_int[c] = 0; in atp870u_intr_handle()
289 lun = atp_readb_io(dev, c, 0x1d) & 0x07; 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()
300 atp_readb_io(dev, c, 0x12); in atp870u_intr_handle()
302 atp_readb_io(dev, c, 0x13); in atp870u_intr_handle()
304 atp_readb_io(dev, c, 0x14); in atp870u_intr_handle()
305 k = dev->id[c][target_id].last_len; 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()
309 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
310 dev->in_int[c] = 0; in atp870u_intr_handle()
316 atp_writeb_io(dev, c, 0x10, 0x46); in atp870u_intr_handle()
317 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
318 atp_writeb_io(dev, c, 0x12, 0x00); in atp870u_intr_handle()
319 atp_writeb_io(dev, c, 0x13, 0x00); in atp870u_intr_handle()
320 atp_writeb_io(dev, c, 0x14, 0x00); in atp870u_intr_handle()
321 atp_writeb_io(dev, c, 0x18, 0x08); 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()
333 atp_writeb_io(dev, c, 0x10, 0x45); in atp870u_intr_handle()
335 target_id = atp_readb_io(dev, c, 0x16); in atp870u_intr_handle()
345 atp_writeb_io(dev, c, 0x10, 0x45); in atp870u_intr_handle()
346 workreq = dev->id[c][target_id].curr_req; in atp870u_intr_handle()
354 atp_writeb_io(dev, c, 0x0f, lun); 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()
364 atp_readb_io(dev, c, 0x14), in atp870u_intr_handle()
365 atp_readb_io(dev, c, 0x13), in atp870u_intr_handle()
366 atp_readb_io(dev, c, 0x12)); 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()
376 atp_writeb_io(dev, c, 0x16, 0x80); in atp870u_intr_handle()
380 i = atp_readb_pci(dev, c, 1) & 0xf3; in atp870u_intr_handle()
388 atp_writeb_pci(dev, c, 1, i); in atp870u_intr_handle()
416 if ((id & dev->wide_id[c]) != 0) { 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()
423 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
424 dev->in_int[c] = 0; in atp870u_intr_handle()
433 prd = dev->id[c][target_id].prd_pos; in atp870u_intr_handle()
446 dev->id[c][target_id].prd_pos = prd; 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()
459 c, target_id, dev->id[c][target_id].prdaddr); in atp870u_intr_handle()
462 atp_writeb_pci(dev, c, 2, 0x06); in atp870u_intr_handle()
463 atp_writeb_pci(dev, c, 2, 0x00); in atp870u_intr_handle()
468 if (dev->id[c][target_id].dirct != 0) { in atp870u_intr_handle()
469 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
470 atp_writeb_pci(dev, c, 0, 0x01); in atp870u_intr_handle()
471 dev->in_int[c] = 0; in atp870u_intr_handle()
477 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
478 atp_writeb_pci(dev, c, 0, 0x09); 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()
522 dev->id[c][target_id].curr_req = NULL; in atp870u_intr_handle()
523 dev->working[c]--; in atp870u_intr_handle()
528 if (dev->wide_id[c] != 0) { in atp870u_intr_handle()
529 atp_writeb_io(dev, c, 0x1b, 0x01); in atp870u_intr_handle()
530 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != 0x01) in atp870u_intr_handle()
531 atp_writeb_io(dev, c, 0x1b, 0x01); 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()
543 send_s870(dev,c); 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()
558 atp_writeb_pci(dev, c, 2, 0x06); in atp870u_intr_handle()
559 atp_writeb_pci(dev, c, 2, 0x00); in atp870u_intr_handle()
560 atp_writeb_io(dev, c, 0x10, 0x41); in atp870u_intr_handle()
562 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
563 atp_writeb_io(dev, c, 0x12, in atp870u_intr_handle()
565 atp_writeb_io(dev, c, 0x13, in atp870u_intr_handle()
567 atp_writeb_io(dev, c, 0x14, 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()
573 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
574 atp_writeb_pci(dev, c, 0, 0x09); 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()
580 atp_writeb_pci(dev, c, 2, 0x06); in atp870u_intr_handle()
581 atp_writeb_pci(dev, c, 2, 0x00); in atp870u_intr_handle()
582 atp_writeb_io(dev, c, 0x10, 0x41); in atp870u_intr_handle()
584 k = dev->id[c][target_id].last_len; in atp870u_intr_handle()
585 atp_writeb_io(dev, c, 0x12, in atp870u_intr_handle()
587 atp_writeb_io(dev, c, 0x13, in atp870u_intr_handle()
589 atp_writeb_io(dev, c, 0x14, in atp870u_intr_handle()
592 atp_writeb_io(dev, c, 0x15, in atp870u_intr_handle()
593 atp_readb_io(dev, c, 0x15) | 0x20); in atp870u_intr_handle()
594 dev->id[c][target_id].dirct = 0x20; in atp870u_intr_handle()
595 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
596 atp_writeb_pci(dev, c, 0, 0x01); in atp870u_intr_handle()
597 dev->in_int[c] = 0; in atp870u_intr_handle()
601 atp_writeb_io(dev, c, 0x10, 0x30); in atp870u_intr_handle()
603 atp_writeb_io(dev, c, 0x10, 0x46); in atp870u_intr_handle()
604 dev->id[c][target_id].dirct = 0x00; in atp870u_intr_handle()
605 atp_writeb_io(dev, c, 0x12, 0x00); in atp870u_intr_handle()
606 atp_writeb_io(dev, c, 0x13, 0x00); in atp870u_intr_handle()
607 atp_writeb_io(dev, c, 0x14, 0x00); in atp870u_intr_handle()
608 atp_writeb_io(dev, c, 0x18, 0x08); in atp870u_intr_handle()
610 dev->in_int[c] = 0; in atp870u_intr_handle()
623 unsigned char c; in atp870u_queuecommand_lck() local
628 c = scmd_channel(req_p); in atp870u_queuecommand_lck()
650 if ((m & dev->active_id[c]) == 0) { 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()
674 dev->quend[c]--; in atp870u_queuecommand_lck()
679 dev->quereq[c][dev->quend[c]] = req_p; 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()
686 if ((atp_readb_io(dev, c, 0x1c) == 0) && in atp870u_queuecommand_lck()
687 (dev->in_int[c] == 0) && in atp870u_queuecommand_lck()
688 (dev->in_snd[c] == 0)) { in atp870u_queuecommand_lck()
692 send_s870(dev,c); in atp870u_queuecommand_lck()
710 static void send_s870(struct atp_unit *dev, unsigned char c) 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()
761 if ((atp_readb_io(dev, c, 0x1f) & 0xb0) != 0 || in DEF_SCSI_QCMD()
762 atp_readb_io(dev, c, 0x1c) != 0) { in DEF_SCSI_QCMD()
766 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
767 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
783 dev->r1f[c][scmd_id(workreq)] = 0; in DEF_SCSI_QCMD()
802 if ((w & dev->wide_id[c]) != 0) { 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()
817 atp_writeb_io(dev, c, 0x01, 0x2c); in DEF_SCSI_QCMD()
819 atp_writeb_io(dev, c, 0x02, 0x7f); in DEF_SCSI_QCMD()
821 atp_writeb_io(dev, c, 0x02, 0xcf); 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()
838 atp_writeb_io(dev, c, 0x12, ((unsigned char *) (&l))[2]); in DEF_SCSI_QCMD()
839 atp_writeb_io(dev, c, 0x13, ((unsigned char *) (&l))[1]); in DEF_SCSI_QCMD()
840 atp_writeb_io(dev, c, 0x14, ((unsigned char *) (&l))[0]); 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()
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()
860 atp_writeb_io(dev, c, 0x16, atp_readb_io(dev, c, 0x16) | 0x80); in DEF_SCSI_QCMD()
861 atp_writeb_io(dev, c, 0x16, 0x80); in DEF_SCSI_QCMD()
862 dev->id[c][target_id].dirct = 0; in DEF_SCSI_QCMD()
864 if (atp_readb_io(dev, c, 0x1c) == 0) { in DEF_SCSI_QCMD()
868 atp_writeb_io(dev, c, 0x18, 0x08); 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()
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()
920 atp_writeb_pci(dev, c, 2, 0x06); in DEF_SCSI_QCMD()
921 atp_writeb_pci(dev, c, 2, 0x00); in DEF_SCSI_QCMD()
923 j = atp_readb_pci(dev, c, 1) & 0xf3; in DEF_SCSI_QCMD()
930 atp_writeb_pci(dev, c, 1, j); in DEF_SCSI_QCMD()
954 dev->id[c][target_id].dirct = 0x20; in DEF_SCSI_QCMD()
955 if (atp_readb_io(dev, c, 0x1c) == 0) { in DEF_SCSI_QCMD()
956 atp_writeb_io(dev, c, 0x18, 0x08); in DEF_SCSI_QCMD()
957 atp_writeb_pci(dev, c, 0, 0x01); in DEF_SCSI_QCMD()
962 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
964 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
967 if (atp_readb_io(dev, c, 0x1c) == 0) { in DEF_SCSI_QCMD()
968 atp_writeb_io(dev, c, 0x18, 0x08); in DEF_SCSI_QCMD()
969 atp_writeb_pci(dev, c, 0, 0x09); in DEF_SCSI_QCMD()
974 dev->last_cmd[c] |= 0x40; in DEF_SCSI_QCMD()
976 dev->in_snd[c] = 0; in DEF_SCSI_QCMD()
1255 int c,k; in atp870u_init_tables() local
1256 for(c=0;c < 2;c++) { in atp870u_init_tables()
1258 atp_dev->id[c][k].prd_table = 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()
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()
1293 static void atp_set_host_id(struct atp_unit *atp, u8 c, u8 host_id) in atp_set_host_id() argument
1295 atp_writeb_io(atp, c, 0, host_id | 0x08); in atp_set_host_id()
1296 atp_writeb_io(atp, c, 0x18, 0); in atp_set_host_id()
1297 while ((atp_readb_io(atp, c, 0x1f) & 0x80) == 0) in atp_set_host_id()
1299 atp_readb_io(atp, c, 0x17); in atp_set_host_id()
1300 atp_writeb_io(atp, c, 1, 8); in atp_set_host_id()
1301 atp_writeb_io(atp, c, 2, 0x7f); in atp_set_host_id()
1302 atp_writeb_io(atp, c, 0x11, 0x20); in atp_set_host_id()
1447 unsigned char k, m, c; in atp885_init() local
1460 c = atp_readb_base(atpdev, 0x29); in atp885_init()
1461 atp_writeb_base(atpdev, 0x29, c | 0x04); in atp885_init()
1483 c = atp_readb_base(atpdev, 0x29); in atp885_init()
1484 atp_writeb_base(atpdev, 0x29, c & 0xfb); in atp885_init()
1485 for (c = 0; c < 2; c++) { 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()
1499 k = setupdata[c][1]; in atp885_init()
1501 atpdev->global_map[c] |= 0x20; in atp885_init()
1503 atpdev->global_map[c] |= k; in atp885_init()
1504 if ((setupdata[c][2] & 0x04) != 0) in atp885_init()
1505 atpdev->global_map[c] |= 0x08; in atp885_init()
1506 atpdev->host_id[c] = setupdata[c][0] & 0x07; in atp885_init()
1645 unsigned char j, k, c; in atp870u_abort() local
1652 c = scmd_channel(SCpnt); in atp870u_abort()
1653 printk(" atp870u: abort Channel = %x \n", c); 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()
1657 printk(" r%2x=%2x", j, atp_readb_io(dev, c, j)); in atp870u_abort()
1659 printk(" r1c=%2x", atp_readb_io(dev, c, 0x1c)); in atp870u_abort()
1660 printk(" r1f=%2x in_snd=%2x ", atp_readb_io(dev, c, 0x1f), dev->in_snd[c]); in atp870u_abort()
1661 printk(" d00=%2x", atp_readb_pci(dev, c, 0x00)); in atp870u_abort()
1662 printk(" d02=%2x", atp_readb_pci(dev, c, 0x02)); 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()
1670 printk(" last_lenu= %x ",(unsigned int)dev->id[c][j].last_len); in atp870u_abort()
1769 static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, in atp_is() argument
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()
1797 atp_writeb_io(dev, c, 0x1b, wide_chip ? 0x01 : 0x00); in atp_is()
1798 atp_writeb_io(dev, c, 1, 0x08); in atp_is()
1799 atp_writeb_io(dev, c, 2, 0x7f); in atp_is()
1800 atp_writeb_io(dev, c, 3, satn[0]); in atp_is()
1801 atp_writeb_io(dev, c, 4, satn[1]); in atp_is()
1802 atp_writeb_io(dev, c, 5, satn[2]); in atp_is()
1803 atp_writeb_io(dev, c, 6, satn[3]); in atp_is()
1804 atp_writeb_io(dev, c, 7, satn[4]); in atp_is()
1805 atp_writeb_io(dev, c, 8, satn[5]); in atp_is()
1806 atp_writeb_io(dev, c, 0x0f, 0); in atp_is()
1807 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1808 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
1809 atp_writeb_io(dev, c, 0x13, satn[6]); in atp_is()
1810 atp_writeb_io(dev, c, 0x14, satn[7]); in atp_is()
1815 atp_writeb_io(dev, c, 0x15, j); in atp_is()
1816 atp_writeb_io(dev, c, 0x18, satn[8]); in atp_is()
1818 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
1821 if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1824 while (atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1827 dev->active_id[c] |= m; in atp_is()
1829 atp_writeb_io(dev, c, 0x10, 0x30); in atp_is()
1831 atp_writeb_io(dev, c, 0x14, 0x00); in atp_is()
1833 atp_writeb_io(dev, c, 0x04, 0x00); in atp_is()
1836 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
1838 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
1841 j = atp_readb_io(dev, c, 0x17); in atp_is()
1843 atp_writeb_io(dev, c, 0x10, 0x41); in atp_is()
1847 atp_writeb_io(dev, c, 3, inqd[0]); in atp_is()
1848 atp_writeb_io(dev, c, 4, inqd[1]); in atp_is()
1849 atp_writeb_io(dev, c, 5, inqd[2]); in atp_is()
1850 atp_writeb_io(dev, c, 6, inqd[3]); in atp_is()
1851 atp_writeb_io(dev, c, 7, inqd[4]); in atp_is()
1852 atp_writeb_io(dev, c, 8, inqd[5]); in atp_is()
1853 atp_writeb_io(dev, c, 0x0f, 0); in atp_is()
1854 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1855 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
1856 atp_writeb_io(dev, c, 0x13, inqd[6]); in atp_is()
1857 atp_writeb_io(dev, c, 0x14, inqd[7]); in atp_is()
1858 atp_writeb_io(dev, c, 0x18, inqd[8]); in atp_is()
1860 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
1863 if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1866 while (atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1870 atp_writeb_io(dev, c, 0x1b, 0x00); in atp_is()
1872 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
1875 k = atp_readb_io(dev, c, 0x1f); in atp_is()
1877 mbuf[j++] = atp_readb_io(dev, c, 0x19); in atp_is()
1883 j = atp_readb_io(dev, c, 0x17); in atp_is()
1887 atp_writeb_io(dev, c, 0x10, 0x46); in atp_is()
1888 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
1889 atp_writeb_io(dev, c, 0x13, 0); in atp_is()
1890 atp_writeb_io(dev, c, 0x14, 0); in atp_is()
1891 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
1893 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
1896 if (atp_readb_io(dev, c, 0x17) != 0x16) 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()
1914 if ((dev->global_map[c] & 0x20) == 0) in atp_is()
1920 if (dev->sp[c][i] != 0x04) // force u2 in atp_is()
1925 atp_writeb_io(dev, c, 0x1b, 0x01); in atp_is()
1926 atp_writeb_io(dev, c, 3, satn[0]); in atp_is()
1927 atp_writeb_io(dev, c, 4, satn[1]); in atp_is()
1928 atp_writeb_io(dev, c, 5, satn[2]); in atp_is()
1929 atp_writeb_io(dev, c, 6, satn[3]); in atp_is()
1930 atp_writeb_io(dev, c, 7, satn[4]); in atp_is()
1931 atp_writeb_io(dev, c, 8, satn[5]); in atp_is()
1932 atp_writeb_io(dev, c, 0x0f, 0); in atp_is()
1933 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
1934 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
1935 atp_writeb_io(dev, c, 0x13, satn[6]); in atp_is()
1936 atp_writeb_io(dev, c, 0x14, satn[7]); in atp_is()
1937 atp_writeb_io(dev, c, 0x18, satn[8]); in atp_is()
1939 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
1942 if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1945 while (atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
1950 atp_writeb_io(dev, c, 0x14, 0x09); in atp_is()
1951 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
1953 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0) { in atp_is()
1954 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0) in atp_is()
1955 atp_writeb_io(dev, c, 0x19, u3[j++]); in atp_is()
1959 while ((atp_readb_io(dev, c, 0x17) & 0x80) == 0x00) in atp_is()
1962 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
1974 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
1975 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0) { in atp_is()
1976 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0) in atp_is()
1977 atp_writeb_io(dev, c, 0x19, 0); in atp_is()
1980 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
1992 atp_writeb_io(dev, c, 0x14, 0x09); in atp_is()
1993 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
1996 j = atp_readb_io(dev, c, 0x1f); in atp_is()
1998 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2004 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2016 atp_writeb_io(dev, c, 0x10, 0x30); in atp_is()
2017 atp_writeb_io(dev, c, 0x14, 0x00); in atp_is()
2018 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
2020 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00); in atp_is()
2022 j = atp_readb_io(dev, c, 0x17); in atp_is()
2041 dev->wide_id[c] |= m; in atp_is()
2042 dev->id[c][i].devsp = 0xce; in atp_is()
2045 c, i, dev->id[c][i].devsp); in atp_is()
2050 atp_writeb_io(dev, c, 0x1b, 0x01); in atp_is()
2051 atp_writeb_io(dev, c, 3, satn[0]); in atp_is()
2052 atp_writeb_io(dev, c, 4, satn[1]); in atp_is()
2053 atp_writeb_io(dev, c, 5, satn[2]); in atp_is()
2054 atp_writeb_io(dev, c, 6, satn[3]); in atp_is()
2055 atp_writeb_io(dev, c, 7, satn[4]); in atp_is()
2056 atp_writeb_io(dev, c, 8, satn[5]); in atp_is()
2057 atp_writeb_io(dev, c, 0x0f, 0); in atp_is()
2058 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2059 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
2060 atp_writeb_io(dev, c, 0x13, satn[6]); in atp_is()
2061 atp_writeb_io(dev, c, 0x14, satn[7]); in atp_is()
2062 atp_writeb_io(dev, c, 0x18, satn[8]); in atp_is()
2064 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
2067 if (atp_readb_io(dev, c, 0x17) != 0x11 && in atp_is()
2068 atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
2071 while (atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
2076 atp_writeb_io(dev, c, 0x14, 0x05); in atp_is()
2077 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2079 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0) { in atp_is()
2080 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0) in atp_is()
2081 atp_writeb_io(dev, c, 0x19, wide[j++]); in atp_is()
2085 while ((atp_readb_io(dev, c, 0x17) & 0x80) == 0x00) in atp_is()
2088 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2100 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2101 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0) { in atp_is()
2102 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0) in atp_is()
2103 atp_writeb_io(dev, c, 0x19, 0); in atp_is()
2106 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2118 atp_writeb_io(dev, c, 0x14, 0xff); in atp_is()
2119 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2122 j = atp_readb_io(dev, c, 0x1f); in atp_is()
2124 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2130 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2142 atp_writeb_io(dev, c, 0x10, 0x30); in atp_is()
2143 atp_writeb_io(dev, c, 0x14, 0x00); in atp_is()
2144 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
2146 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
2149 j = atp_readb_io(dev, c, 0x17); 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()
2196 atp_writeb_io(dev, c, 0x1b, j); in atp_is()
2197 atp_writeb_io(dev, c, 3, satn[0]); in atp_is()
2198 atp_writeb_io(dev, c, 4, satn[1]); in atp_is()
2199 atp_writeb_io(dev, c, 5, satn[2]); in atp_is()
2200 atp_writeb_io(dev, c, 6, satn[3]); in atp_is()
2201 atp_writeb_io(dev, c, 7, satn[4]); in atp_is()
2202 atp_writeb_io(dev, c, 8, satn[5]); in atp_is()
2203 atp_writeb_io(dev, c, 0x0f, 0); in atp_is()
2204 atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp); in atp_is()
2205 atp_writeb_io(dev, c, 0x12, 0); in atp_is()
2206 atp_writeb_io(dev, c, 0x13, satn[6]); in atp_is()
2207 atp_writeb_io(dev, c, 0x14, satn[7]); in atp_is()
2208 atp_writeb_io(dev, c, 0x18, satn[8]); in atp_is()
2210 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
2213 if (atp_readb_io(dev, c, 0x17) != 0x11 && in atp_is()
2214 atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
2217 while (atp_readb_io(dev, c, 0x17) != 0x8e) in atp_is()
2222 atp_writeb_io(dev, c, 0x14, 0x06); in atp_is()
2223 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2225 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0) { in atp_is()
2226 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0) { 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()
2230 atp_writeb_io(dev, c, 0x19, synuw[j++]); in atp_is()
2232 atp_writeb_io(dev, c, 0x19, synw[j++]); in atp_is()
2235 atp_writeb_io(dev, c, 0x19, synw_870[j++]); in atp_is()
2237 if ((m & dev->ultra_map[c]) != 0) { in atp_is()
2238 atp_writeb_io(dev, c, 0x19, synu[j++]); in atp_is()
2240 atp_writeb_io(dev, c, 0x19, synn[j++]); in atp_is()
2246 while ((atp_readb_io(dev, c, 0x17) & 0x80) == 0x00) in atp_is()
2249 j = atp_readb_io(dev, c, 0x17) & 0x0f; in atp_is()
2261 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2262 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) { in atp_is()
2263 if ((atp_readb_io(dev, c, 0x1f) & 0x01) != 0x00) in atp_is()
2264 atp_writeb_io(dev, c, 0x19, 0x00); in atp_is()
2267 j = atp_readb_io(dev, c, 0x17); in atp_is()
2284 atp_writeb_io(dev, c, 0x14, 0x06); in atp_is()
2286 atp_writeb_io(dev, c, 0x14, 0xff); in atp_is()
2287 atp_writeb_io(dev, c, 0x18, 0x20); in atp_is()
2290 j = atp_readb_io(dev, c, 0x1f); in atp_is()
2292 mbuf[k++] = atp_readb_io(dev, c, 0x19); in atp_is()
2299 while ((atp_readb_io(dev, c, 0x17) & 0x80) == 0x00); in atp_is()
2301 j = atp_readb_io(dev, c, 0x17); in atp_is()
2317 atp_writeb_io(dev, c, 0x10, 0x30); in atp_is()
2319 atp_writeb_io(dev, c, 0x14, 0x00); in atp_is()
2320 atp_writeb_io(dev, c, 0x18, 0x08); in atp_is()
2322 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) in atp_is()
2325 j = atp_readb_io(dev, c, 0x17); 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()
2377 c,i,dev->id[c][i].devsp); in atp_is()