Lines Matching refs:ch
330 struct ata_channel *ch = device_get_softc(dev); in ata_promise_allocate() local
335 ch->hw.status = ata_promise_status; in ata_promise_allocate()
343 struct ata_channel *ch = device_get_softc(dev); in ata_promise_status() local
345 if (ATA_INL(ctlr->r_res1, 0x1c) & (ch->unit ? 0x00004000 : 0x00000400)) { in ata_promise_status()
355 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_promise_dmastart() local
360 ATA_INB(ctlr->r_res1, 0x11) | (ch->unit ? 0x08 : 0x02)); in ata_promise_dmastart()
361 ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20, in ata_promise_dmastart()
362 ((ch->dma->flags & ATA_DMA_READ) ? 0x05000000 : 0x06000000) | in ata_promise_dmastart()
363 (ch->dma->cur_iosize >> 1)); in ata_promise_dmastart()
365 ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) | in ata_promise_dmastart()
367 ATA_IDX_OUTL(ch, ATA_BMDTP_PORT, ch->dma->sg_bus); in ata_promise_dmastart()
368 ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, in ata_promise_dmastart()
369 ((ch->dma->flags & ATA_DMA_READ) ? ATA_BMCMD_WRITE_READ : 0) | in ata_promise_dmastart()
371 ch->flags |= ATA_DMA_ACTIVE; in ata_promise_dmastart()
379 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_promise_dmastop() local
385 ATA_INB(ctlr->r_res1, 0x11) & ~(ch->unit ? 0x08 : 0x02)); in ata_promise_dmastop()
386 ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20, 0); in ata_promise_dmastop()
388 error = ATA_IDX_INB(ch, ATA_BMSTAT_PORT); in ata_promise_dmastop()
389 ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, in ata_promise_dmastop()
390 ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); in ata_promise_dmastop()
391 ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); in ata_promise_dmastop()
392 ch->flags &= ~ATA_DMA_ACTIVE; in ata_promise_dmastop()
399 struct ata_channel *ch = device_get_softc(dev); in ata_promise_dmareset() local
401 ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, in ata_promise_dmareset()
402 ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); in ata_promise_dmareset()
403 ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); in ata_promise_dmareset()
404 ch->flags &= ~ATA_DMA_ACTIVE; in ata_promise_dmareset()
410 struct ata_channel *ch = device_get_softc(dev); in ata_promise_dmainit() local
413 if (ch->dma) { in ata_promise_dmainit()
414 ch->dma->start = ata_promise_dmastart; in ata_promise_dmainit()
415 ch->dma->stop = ata_promise_dmastop; in ata_promise_dmainit()
416 ch->dma->reset = ata_promise_dmareset; in ata_promise_dmainit()
425 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_promise_setmode() local
427 int devno = (ch->unit << 1) + atadev->unit; in ata_promise_setmode()
453 (ch->unit ? 1 << 11 : 1 << 10))) { in ata_promise_setmode()
462 ATA_IDX_OUTB(ch, ATA_BMDEVSPEC_0, 0x0b); in ata_promise_setmode()
464 ATA_IDX_INB(ch, ATA_BMDEVSPEC_1) & 0x04) { in ata_promise_setmode()
474 (ch->unit << 7)) & 0x01000000)) { in ata_promise_setmode()
499 struct ata_channel *ch = device_get_softc(dev); in ata_promise_tx2_allocate() local
504 ch->hw.status = ata_promise_tx2_status; in ata_promise_tx2_allocate()
511 struct ata_channel *ch = device_get_softc(dev); in ata_promise_tx2_status() local
513 ATA_IDX_OUTB(ch, ATA_BMDEVSPEC_0, 0x0b); in ata_promise_tx2_status()
514 if (ATA_IDX_INB(ch, ATA_BMDEVSPEC_1) & 0x20) { in ata_promise_tx2_status()
524 struct ata_channel *ch = device_get_softc(dev); in ata_promise_mio_allocate() local
529 ch->r_io[i].res = ctlr->r_res2; in ata_promise_mio_allocate()
530 ch->r_io[i].offset = offset + 0x0200 + (i << 2) + (ch->unit << 7); in ata_promise_mio_allocate()
532 ch->r_io[ATA_CONTROL].res = ctlr->r_res2; in ata_promise_mio_allocate()
533 ch->r_io[ATA_CONTROL].offset = offset + 0x0238 + (ch->unit << 7); in ata_promise_mio_allocate()
534 ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; in ata_promise_mio_allocate()
537 ((ctlr->chip->cfg2 & (PR_CMBO | PR_CMBO2)) && ch->unit < 2)) { in ata_promise_mio_allocate()
538 ch->r_io[ATA_SSTATUS].res = ctlr->r_res2; in ata_promise_mio_allocate()
539 ch->r_io[ATA_SSTATUS].offset = 0x400 + (ch->unit << 8); in ata_promise_mio_allocate()
540 ch->r_io[ATA_SERROR].res = ctlr->r_res2; in ata_promise_mio_allocate()
541 ch->r_io[ATA_SERROR].offset = 0x404 + (ch->unit << 8); in ata_promise_mio_allocate()
542 ch->r_io[ATA_SCONTROL].res = ctlr->r_res2; in ata_promise_mio_allocate()
543 ch->r_io[ATA_SCONTROL].offset = 0x408 + (ch->unit << 8); in ata_promise_mio_allocate()
544 ch->flags |= ATA_NO_SLAVE; in ata_promise_mio_allocate()
546 ch->flags |= ATA_USE_16BIT; in ata_promise_mio_allocate()
550 ch->hw.command = ata_promise_sx4_command; in ata_promise_mio_allocate()
553 ch->hw.command = ata_promise_mio_command; in ata_promise_mio_allocate()
554 ch->hw.status = ata_promise_mio_status; in ata_promise_mio_allocate()
555 ch->hw.softreset = ata_promise_mio_softreset; in ata_promise_mio_allocate()
564 struct ata_channel *ch; in ata_promise_mio_intr() local
593 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_mio_intr()
594 ctlr->interrupt[unit].function(ch); in ata_promise_mio_intr()
604 struct ata_channel *ch = device_get_softc(dev); in ata_promise_mio_status() local
628 ATA_OUTL(ctlr->r_res2, stat_reg, status & (0x00000011 << ch->unit)); in ata_promise_mio_status()
631 if ((status & (0x00000001 << ch->unit)) && in ata_promise_mio_status()
637 device_printf(ch->dev, "DISCONNECT requested\n"); in ata_promise_mio_status()
639 tp->dev = ch->dev; in ata_promise_mio_status()
645 if ((status & (0x00000010 << ch->unit)) && in ata_promise_mio_status()
651 device_printf(ch->dev, "CONNECT requested\n"); in ata_promise_mio_status()
653 tp->dev = ch->dev; in ata_promise_mio_status()
659 return (vector & (1 << (ch->unit + 1))); in ata_promise_mio_status()
666 struct ata_channel *ch = device_get_softc(request->parent); in ata_promise_mio_command() local
668 u_int32_t *wordp = (u_int32_t *)ch->dma->work; in ata_promise_mio_command()
670 ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); in ata_promise_mio_command()
673 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_command()
675 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); in ata_promise_mio_command()
685 wordp[0] = htole32(0x04 | ((ch->unit + 1) << 16) | (0x00 << 24)); in ata_promise_mio_command()
690 wordp[0] = htole32(0x00 | ((ch->unit + 1) << 16) | (0x00 << 24)); in ata_promise_mio_command()
693 wordp[1] = htole32(ch->dma->sg_bus); in ata_promise_mio_command()
697 ATA_OUTL(ctlr->r_res2, 0x0240 + (ch->unit << 7), ch->dma->work_bus); in ata_promise_mio_command()
705 struct ata_channel *ch = device_get_softc(dev); in ata_promise_mio_reset() local
713 ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1); in ata_promise_mio_reset()
715 ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), in ata_promise_mio_reset()
716 (ATA_INL(ctlr->r_res2, 0xc0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
717 ~0x00003f9f) | (ch->unit + 1)); in ata_promise_mio_reset()
735 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2))) { in ata_promise_mio_reset()
738 ATA_OUTL(ctlr->r_res2, 0x06c, (0x00110000 << ch->unit)); in ata_promise_mio_reset()
742 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), (1 << 11)); in ata_promise_mio_reset()
744 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), in ata_promise_mio_reset()
745 (ATA_INL(ctlr->r_res2, 0x0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
746 ~0x00003f9f) | (ch->unit + 1)); in ata_promise_mio_reset()
749 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2))) { in ata_promise_mio_reset()
755 ATA_OUTL(ctlr->r_res2, 0x06c, (0x00000011 << ch->unit)); in ata_promise_mio_reset()
764 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_reset()
769 ATA_OUTL(ctlr->r_res2, 0x060, (0x00110000 << ch->unit)); in ata_promise_mio_reset()
773 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), (1 << 11)); in ata_promise_mio_reset()
775 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), in ata_promise_mio_reset()
776 (ATA_INL(ctlr->r_res2, 0x0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
777 ~0x00003f9f) | (ch->unit + 1)); in ata_promise_mio_reset()
780 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_reset()
783 ATA_OUTL(ctlr->r_res2, 0x414 + (ch->unit << 8), in ata_promise_mio_reset()
784 (ATA_INL(ctlr->r_res2, 0x414 + (ch->unit << 8)) & in ata_promise_mio_reset()
788 u_int32_t signature = ch->hw.softreset(dev, ATA_PM); in ata_promise_mio_reset()
796 ch->devices = ATA_ATA_MASTER; in ata_promise_mio_reset()
799 ch->devices = ATA_PORTMULTIPLIER; in ata_promise_mio_reset()
800 device_printf(ch->dev, in ata_promise_mio_reset()
802 ch->devices = 0; in ata_promise_mio_reset()
805 ch->devices = ATA_ATAPI_MASTER; in ata_promise_mio_reset()
808 ch->devices = 0; in ata_promise_mio_reset()
812 ch->devices); in ata_promise_mio_reset()
816 ATA_OUTL(ctlr->r_res2, 0x060, (0x00000011 << ch->unit)); in ata_promise_mio_reset()
819 ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x00); in ata_promise_mio_reset()
833 struct ata_channel *ch = device_get_softc(dev); in ata_promise_mio_softreset() local
837 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), port & 0x0f); in ata_promise_mio_softreset()
840 ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER)); in ata_promise_mio_softreset()
842 ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_IDS | ATA_A_RESET); in ata_promise_mio_softreset()
844 ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_IDS); in ata_promise_mio_softreset()
846 ATA_IDX_INB(ch, ATA_ERROR); in ata_promise_mio_softreset()
852 /* err = */ ATA_IDX_INB(ch, ATA_ERROR); in ata_promise_mio_softreset()
853 stat = ATA_IDX_INB(ch, ATA_STATUS); in ata_promise_mio_softreset()
856 return ATA_IDX_INB(ch, ATA_COUNT) | in ata_promise_mio_softreset()
857 (ATA_IDX_INB(ch, ATA_SECTOR) << 8) | in ata_promise_mio_softreset()
858 (ATA_IDX_INB(ch, ATA_CYL_LSB) << 16) | in ata_promise_mio_softreset()
859 (ATA_IDX_INB(ch, ATA_CYL_MSB) << 24); in ata_promise_mio_softreset()
873 struct ata_channel *ch = device_get_softc(dev); in ata_promise_mio_dmainit() local
877 if (ch->dma) in ata_promise_mio_dmainit()
878 ch->dma->setprd = ata_promise_mio_setprd; in ata_promise_mio_dmainit()
916 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_promise_mio_setmode() local
919 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2)) || in ata_promise_mio_setmode()
921 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) in ata_promise_mio_setmode()
931 struct ata_channel *ch; in ata_promise_sx4_intr() local
937 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
938 ctlr->interrupt[unit].function(ch); in ata_promise_sx4_intr()
940 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
942 htole32((ch->unit * ATA_PDC_CHN_OFFSET) + in ata_promise_sx4_intr()
946 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
947 ctlr->interrupt[unit].function(ch); in ata_promise_sx4_intr()
951 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
952 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_intr()
953 htole32((ch->unit * ATA_PDC_CHN_OFFSET) + in ata_promise_sx4_intr()
964 struct ata_channel *ch = device_get_softc(request->parent); in ata_promise_sx4_command() local
965 struct ata_dma_prdentry *prd = ch->dma->sg; in ata_promise_sx4_command()
985 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001); in ata_promise_sx4_command()
994 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET); in ata_promise_sx4_command()
995 wordp[0] = htole32(0x08 | ((ch->unit + 1)<<16) | (0x00 << 24)); in ata_promise_sx4_command()
1000 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001); in ata_promise_sx4_command()
1001 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_command()
1002 htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_APKT_OFFSET)); in ata_promise_sx4_command()
1010 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HSG_OFFSET); in ata_promise_sx4_command()
1019 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_LSG_OFFSET); in ata_promise_sx4_command()
1020 wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE); in ata_promise_sx4_command()
1024 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_ASG_OFFSET); in ata_promise_sx4_command()
1025 wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE); in ata_promise_sx4_command()
1029 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET); in ata_promise_sx4_command()
1031 wordp[0] = htole32(0x14 | ((ch->unit+9)<<16) | ((ch->unit+5)<<24)); in ata_promise_sx4_command()
1033 wordp[0] = htole32(0x00 | ((ch->unit+13)<<16) | (0x00<<24)); in ata_promise_sx4_command()
1034 wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_HSG_OFFSET); in ata_promise_sx4_command()
1035 wordp[2] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_LSG_OFFSET); in ata_promise_sx4_command()
1039 (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET); in ata_promise_sx4_command()
1041 wordp[0] = htole32(0x04 | ((ch->unit+5)<<16) | (0x00<<24)); in ata_promise_sx4_command()
1043 wordp[0] = htole32(0x10 | ((ch->unit+1)<<16) | ((ch->unit+13)<<24)); in ata_promise_sx4_command()
1044 wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_ASG_OFFSET); in ata_promise_sx4_command()
1050 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+5)<<2), 0x00000001); in ata_promise_sx4_command()
1051 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+9)<<2), 0x00000001); in ata_promise_sx4_command()
1052 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_command()
1053 htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET)); in ata_promise_sx4_command()
1056 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+1)<<2), 0x00000001); in ata_promise_sx4_command()
1057 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+13)<<2), 0x00000001); in ata_promise_sx4_command()
1059 htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET)); in ata_promise_sx4_command()