Lines Matching full:ctlr
78 static void ata_promise_queue_hpkt(struct ata_pci_controller *ctlr, u_int32_t hpkt);
79 static void ata_promise_next_hpkt(struct ata_pci_controller *ctlr);
129 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_promise_probe() local
207 ctlr->chip = idx; in ata_promise_probe()
208 ctlr->chipinit = ata_promise_chipinit; in ata_promise_probe()
215 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_promise_chipinit() local
221 switch (ctlr->chip->cfg1) { in ata_promise_chipinit()
224 ATA_OUTB(ctlr->r_res1, 0x11, ATA_INB(ctlr->r_res1, 0x11) | 0x0a); in ata_promise_chipinit()
229 ATA_OUTB(ctlr->r_res1, 0x1f, ATA_INB(ctlr->r_res1, 0x1f) | 0x01); in ata_promise_chipinit()
230 ctlr->ch_attach = ata_promise_ch_attach; in ata_promise_chipinit()
231 ctlr->ch_detach = ata_pci_ch_detach; in ata_promise_chipinit()
232 ctlr->setmode = ata_promise_setmode; in ata_promise_chipinit()
236 ctlr->ch_attach = ata_promise_tx2_ch_attach; in ata_promise_chipinit()
237 ctlr->ch_detach = ata_pci_ch_detach; in ata_promise_chipinit()
238 ctlr->setmode = ata_promise_setmode; in ata_promise_chipinit()
242 ctlr->r_type1 = SYS_RES_MEMORY; in ata_promise_chipinit()
243 ctlr->r_rid1 = PCIR_BAR(4); in ata_promise_chipinit()
244 if (!(ctlr->r_res1 = bus_alloc_resource_any(dev, ctlr->r_type1, in ata_promise_chipinit()
245 &ctlr->r_rid1, RF_ACTIVE))) in ata_promise_chipinit()
248 ctlr->r_type2 = SYS_RES_MEMORY; in ata_promise_chipinit()
249 ctlr->r_rid2 = PCIR_BAR(3); in ata_promise_chipinit()
250 if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, in ata_promise_chipinit()
251 &ctlr->r_rid2, RF_ACTIVE))) in ata_promise_chipinit()
254 if (ctlr->chip->cfg2 == PR_SX4X) { in ata_promise_chipinit()
256 u_int32_t dimm = ATA_INL(ctlr->r_res2, 0x000c0080); in ata_promise_chipinit()
258 if (bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle) || in ata_promise_chipinit()
259 bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, NULL, in ata_promise_chipinit()
260 ata_promise_sx4_intr, ctlr, &ctlr->handle)) { in ata_promise_chipinit()
269 ATA_INL(ctlr->r_res2, 0x000c0088) & (1<<16) ? in ata_promise_chipinit()
273 ATA_OUTL(ctlr->r_res2, 0x000c000c, in ata_promise_chipinit()
274 (ATA_INL(ctlr->r_res2, 0x000c000c) & 0xffff0000)); in ata_promise_chipinit()
286 ctlr->chipset_data = hpkt; in ata_promise_chipinit()
287 ctlr->ch_attach = ata_promise_mio_ch_attach; in ata_promise_chipinit()
288 ctlr->ch_detach = ata_promise_mio_ch_detach; in ata_promise_chipinit()
289 ctlr->reset = ata_promise_mio_reset; in ata_promise_chipinit()
290 ctlr->setmode = ata_promise_setmode; in ata_promise_chipinit()
291 ctlr->channels = 4; in ata_promise_chipinit()
296 if (bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle) || in ata_promise_chipinit()
297 bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, NULL, in ata_promise_chipinit()
298 ata_promise_mio_intr, ctlr, &ctlr->handle)) { in ata_promise_chipinit()
303 switch (ctlr->chip->cfg2) { in ata_promise_chipinit()
305 ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x01) > 0) + in ata_promise_chipinit()
306 ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 2; in ata_promise_chipinit()
309 ctlr->channels = 3; in ata_promise_chipinit()
312 ctlr->channels = 4; in ata_promise_chipinit()
318 ctlr->channels = 3; in ata_promise_chipinit()
322 ctlr->channels = 4; in ata_promise_chipinit()
329 ctlr->chipset_data = (void *)(uintptr_t)0xffffffff; in ata_promise_chipinit()
332 ATA_OUTL(ctlr->r_res2, stat_reg, 0x000000ff); in ata_promise_chipinit()
335 if ((ctlr->chip->cfg2 == PR_SATA2) || (ctlr->chip->cfg2 == PR_CMBO2)) in ata_promise_chipinit()
336 ATA_OUTL(ctlr->r_res2, 0x44, ATA_INL(ctlr->r_res2, 0x44) | 0x2000); in ata_promise_chipinit()
338 ctlr->ch_attach = ata_promise_mio_ch_attach; in ata_promise_chipinit()
339 ctlr->ch_detach = ata_promise_mio_ch_detach; in ata_promise_chipinit()
340 ctlr->reset = ata_promise_mio_reset; in ata_promise_chipinit()
341 ctlr->setmode = ata_promise_mio_setmode; in ata_promise_chipinit()
342 ctlr->getrev = ata_promise_mio_getrev; in ata_promise_chipinit()
348 if (ctlr->r_res2) in ata_promise_chipinit()
349 bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); in ata_promise_chipinit()
350 if (ctlr->r_res1) in ata_promise_chipinit()
351 bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1); in ata_promise_chipinit()
358 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_ch_attach() local
364 if (ctlr->chip->cfg1 == PR_NEW) { in ata_promise_ch_attach()
379 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_status() local
382 if (ATA_INL(ctlr->r_res1, 0x1c) & (ch->unit ? 0x00004000 : 0x00000400)) { in ata_promise_status()
391 struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent)); in ata_promise_dmastart() local
395 ATA_OUTB(ctlr->r_res1, 0x11, in ata_promise_dmastart()
396 ATA_INB(ctlr->r_res1, 0x11) | (ch->unit ? 0x08 : 0x02)); in ata_promise_dmastart()
397 ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20, in ata_promise_dmastart()
414 struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent)); in ata_promise_dmastop() local
419 ATA_OUTB(ctlr->r_res1, 0x11, in ata_promise_dmastop()
420 ATA_INB(ctlr->r_res1, 0x11) & ~(ch->unit ? 0x08 : 0x02)); in ata_promise_dmastop()
421 ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20, 0); in ata_promise_dmastop()
446 struct ata_pci_controller *ctlr = device_get_softc(parent); in ata_promise_setmode() local
467 mode = min(mode, ctlr->chip->max_dma); in ata_promise_setmode()
469 switch (ctlr->chip->cfg1) { in ata_promise_setmode()
491 (ATA_INL(ctlr->r_res2, in ata_promise_setmode()
492 (ctlr->chip->cfg2 & PR_SX4X ? 0x000c0260 : 0x0260) + in ata_promise_setmode()
500 if (ctlr->chip->cfg1 < PR_TX) in ata_promise_setmode()
502 timings[ata_mode2idx(mode)][ctlr->chip->cfg1], 4); in ata_promise_setmode()
534 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_ch_attach() local
536 int offset = (ctlr->chip->cfg2 & PR_SX4X) ? 0x000c0000 : 0; in ata_promise_mio_ch_attach()
542 ch->r_io[i].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
545 ch->r_io[ATA_CONTROL].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
547 ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
549 if ((ctlr->chip->cfg2 & (PR_SATA | PR_SATA2)) || in ata_promise_mio_ch_attach()
550 ((ctlr->chip->cfg2 & (PR_CMBO | PR_CMBO2)) && ch->unit < 2)) { in ata_promise_mio_ch_attach()
551 ch->r_io[ATA_SSTATUS].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
553 ch->r_io[ATA_SERROR].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
555 ch->r_io[ATA_SCONTROL].res = ctlr->r_res2; in ata_promise_mio_ch_attach()
564 if (ctlr->chip->cfg2 & PR_SX4X) { in ata_promise_mio_ch_attach()
588 struct ata_pci_controller *ctlr = data; in ata_promise_mio_intr() local
598 vector = ATA_INL(ctlr->r_res2, 0x040); in ata_promise_mio_intr()
599 ATA_OUTL(ctlr->r_res2, 0x040, vector); in ata_promise_mio_intr()
600 ctlr->chipset_data = (void *)(uintptr_t)vector; in ata_promise_mio_intr()
602 for (unit = 0; unit < ctlr->channels; unit++) { in ata_promise_mio_intr()
603 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_mio_intr()
604 ctlr->interrupt[unit].function(ch); in ata_promise_mio_intr()
607 ctlr->chipset_data = (void *)(uintptr_t)0xffffffff; in ata_promise_mio_intr()
613 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_status() local
617 switch (ctlr->chip->cfg2) { in ata_promise_mio_status()
631 vector = (uint32_t)(uintptr_t)ctlr->chipset_data; in ata_promise_mio_status()
634 status = ATA_INL(ctlr->r_res2, stat_reg); in ata_promise_mio_status()
635 ATA_OUTL(ctlr->r_res2, stat_reg, status & (0x00000011 << ch->unit)); in ata_promise_mio_status()
658 struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent)); in ata_promise_mio_command() local
663 ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); in ata_promise_mio_command()
665 if ((ctlr->chip->cfg2 == PR_SATA2) || in ata_promise_mio_command()
666 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_command()
668 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), request->unit & 0x0f); in ata_promise_mio_command()
690 ATA_OUTL(ctlr->r_res2, 0x0240 + (ch->unit << 7), ch->dma.work_bus); in ata_promise_mio_command()
697 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_reset() local
701 switch (ctlr->chip->cfg2) { in ata_promise_mio_reset()
705 hpktp = ctlr->chipset_data; in ata_promise_mio_reset()
706 ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1); in ata_promise_mio_reset()
708 ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), in ata_promise_mio_reset()
709 (ATA_INL(ctlr->r_res2, 0xc0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
714 ATA_OUTL(ctlr->r_res2, 0xc012c, in ata_promise_mio_reset()
715 (ATA_INL(ctlr->r_res2, 0xc012c) & ~0x00000f9f) | (1 << 11)); in ata_promise_mio_reset()
717 ATA_OUTL(ctlr->r_res2, 0xc012c, in ata_promise_mio_reset()
718 (ATA_INL(ctlr->r_res2, 0xc012c) & ~0x00000f9f)); in ata_promise_mio_reset()
727 if ((ctlr->chip->cfg2 == PR_SATA) || in ata_promise_mio_reset()
728 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2))) { in ata_promise_mio_reset()
730 ATA_OUTL(ctlr->r_res2, 0x06c, (0x00110000 << ch->unit)); in ata_promise_mio_reset()
734 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), (1 << 11)); in ata_promise_mio_reset()
736 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), in ata_promise_mio_reset()
737 (ATA_INL(ctlr->r_res2, 0x0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
740 if ((ctlr->chip->cfg2 == PR_SATA) || in ata_promise_mio_reset()
741 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2))) { in ata_promise_mio_reset()
748 ATA_OUTL(ctlr->r_res2, 0x06c, (0x00000011 << ch->unit)); in ata_promise_mio_reset()
756 if ((ctlr->chip->cfg2 == PR_SATA2) || in ata_promise_mio_reset()
757 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_reset()
759 //ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); in ata_promise_mio_reset()
762 ATA_OUTL(ctlr->r_res2, 0x060, (0x00110000 << ch->unit)); in ata_promise_mio_reset()
766 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), (1 << 11)); in ata_promise_mio_reset()
768 ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), in ata_promise_mio_reset()
769 (ATA_INL(ctlr->r_res2, 0x0260 + (ch->unit << 7)) & in ata_promise_mio_reset()
772 if ((ctlr->chip->cfg2 == PR_SATA2) || in ata_promise_mio_reset()
773 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { in ata_promise_mio_reset()
775 ATA_OUTL(ctlr->r_res2, 0x414 + (ch->unit << 8), in ata_promise_mio_reset()
776 (ATA_INL(ctlr->r_res2, 0x414 + (ch->unit << 8)) & in ata_promise_mio_reset()
810 ATA_OUTL(ctlr->r_res2, 0x060, (0x00000011 << ch->unit)); in ata_promise_mio_reset()
813 ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x00); in ata_promise_mio_reset()
824 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_pm_read() local
848 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); in ata_promise_mio_pm_read()
875 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_pm_write() local
899 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); in ata_promise_mio_pm_write()
927 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_softreset() local
932 ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), port & 0x0f); in ata_promise_mio_softreset()
1015 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_setmode() local
1018 if ( (ctlr->chip->cfg2 == PR_SATA) || in ata_promise_mio_setmode()
1019 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2)) || in ata_promise_mio_setmode()
1020 (ctlr->chip->cfg2 == PR_SATA2) || in ata_promise_mio_setmode()
1021 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) in ata_promise_mio_setmode()
1031 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_promise_mio_getrev() local
1034 if ( (ctlr->chip->cfg2 == PR_SATA) || in ata_promise_mio_getrev()
1035 ((ctlr->chip->cfg2 == PR_CMBO) && (ch->unit < 2)) || in ata_promise_mio_getrev()
1036 (ctlr->chip->cfg2 == PR_SATA2) || in ata_promise_mio_getrev()
1037 ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) in ata_promise_mio_getrev()
1046 struct ata_pci_controller *ctlr = data; in ata_promise_sx4_intr() local
1048 u_int32_t vector = ATA_INL(ctlr->r_res2, 0x000c0480); in ata_promise_sx4_intr()
1051 for (unit = 0; unit < ctlr->channels; unit++) { in ata_promise_sx4_intr()
1053 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
1054 ctlr->interrupt[unit].function(ch); in ata_promise_sx4_intr()
1056 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
1057 ata_promise_queue_hpkt(ctlr, in ata_promise_sx4_intr()
1061 ata_promise_next_hpkt(ctlr); in ata_promise_sx4_intr()
1062 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
1063 ctlr->interrupt[unit].function(ch); in ata_promise_sx4_intr()
1066 ata_promise_next_hpkt(ctlr); in ata_promise_sx4_intr()
1067 if ((ch = ctlr->interrupt[unit].argument)) in ata_promise_sx4_intr()
1068 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_intr()
1079 struct ata_pci_controller *ctlr = device_get_softc(gparent); in ata_promise_sx4_command() local
1082 caddr_t window = rman_get_virtual(ctlr->r_res1); in ata_promise_sx4_command()
1101 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001); in ata_promise_sx4_command()
1115 ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001); in ata_promise_sx4_command()
1116 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001); in ata_promise_sx4_command()
1117 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_command()
1163 ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001); in ata_promise_sx4_command()
1166 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+5)<<2), 0x00000001); in ata_promise_sx4_command()
1167 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+9)<<2), 0x00000001); in ata_promise_sx4_command()
1168 ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7), in ata_promise_sx4_command()
1172 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+1)<<2), 0x00000001); in ata_promise_sx4_command()
1173 ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+13)<<2), 0x00000001); in ata_promise_sx4_command()
1174 ata_promise_queue_hpkt(ctlr, in ata_promise_sx4_command()
1231 ata_promise_queue_hpkt(struct ata_pci_controller *ctlr, u_int32_t hpkt) in ata_promise_queue_hpkt() argument
1233 struct ata_promise_sx4 *hpktp = ctlr->chipset_data; in ata_promise_queue_hpkt()
1244 ATA_OUTL(ctlr->r_res2, 0x000c0100, hpkt); in ata_promise_queue_hpkt()
1250 ata_promise_next_hpkt(struct ata_pci_controller *ctlr) in ata_promise_next_hpkt() argument
1252 struct ata_promise_sx4 *hpktp = ctlr->chipset_data; in ata_promise_next_hpkt()
1258 ATA_OUTL(ctlr->r_res2, 0x000c0100, hp->addr); in ata_promise_next_hpkt()