• Home
  • Raw
  • Download

Lines Matching refs:ap

64 u8 ata_sff_check_status(struct ata_port *ap)  in ata_sff_check_status()  argument
66 return ioread8(ap->ioaddr.status_addr); in ata_sff_check_status()
83 static u8 ata_sff_altstatus(struct ata_port *ap) in ata_sff_altstatus() argument
85 if (ap->ops->sff_check_altstatus) in ata_sff_altstatus()
86 return ap->ops->sff_check_altstatus(ap); in ata_sff_altstatus()
88 return ioread8(ap->ioaddr.altstatus_addr); in ata_sff_altstatus()
103 static u8 ata_sff_irq_status(struct ata_port *ap) in ata_sff_irq_status() argument
107 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { in ata_sff_irq_status()
108 status = ata_sff_altstatus(ap); in ata_sff_irq_status()
114 status = ap->ops->sff_check_status(ap); in ata_sff_irq_status()
130 static void ata_sff_sync(struct ata_port *ap) in ata_sff_sync() argument
132 if (ap->ops->sff_check_altstatus) in ata_sff_sync()
133 ap->ops->sff_check_altstatus(ap); in ata_sff_sync()
134 else if (ap->ioaddr.altstatus_addr) in ata_sff_sync()
135 ioread8(ap->ioaddr.altstatus_addr); in ata_sff_sync()
150 void ata_sff_pause(struct ata_port *ap) in ata_sff_pause() argument
152 ata_sff_sync(ap); in ata_sff_pause()
165 void ata_sff_dma_pause(struct ata_port *ap) in ata_sff_dma_pause() argument
167 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { in ata_sff_dma_pause()
170 ata_sff_altstatus(ap); in ata_sff_dma_pause()
195 int ata_sff_busy_sleep(struct ata_port *ap, in ata_sff_busy_sleep() argument
201 status = ata_sff_busy_wait(ap, ATA_BUSY, 300); in ata_sff_busy_sleep()
206 ata_msleep(ap, 50); in ata_sff_busy_sleep()
207 status = ata_sff_busy_wait(ap, ATA_BUSY, 3); in ata_sff_busy_sleep()
211 ata_port_warn(ap, in ata_sff_busy_sleep()
218 ata_msleep(ap, 50); in ata_sff_busy_sleep()
219 status = ap->ops->sff_check_status(ap); in ata_sff_busy_sleep()
226 ata_port_err(ap, in ata_sff_busy_sleep()
238 u8 status = link->ap->ops->sff_check_status(link->ap); in ata_sff_check_ready()
276 static void ata_sff_set_devctl(struct ata_port *ap, u8 ctl) in ata_sff_set_devctl() argument
278 if (ap->ops->sff_set_devctl) in ata_sff_set_devctl()
279 ap->ops->sff_set_devctl(ap, ctl); in ata_sff_set_devctl()
281 iowrite8(ctl, ap->ioaddr.ctl_addr); in ata_sff_set_devctl()
298 void ata_sff_dev_select(struct ata_port *ap, unsigned int device) in ata_sff_dev_select() argument
307 iowrite8(tmp, ap->ioaddr.device_addr); in ata_sff_dev_select()
308 ata_sff_pause(ap); /* needed; also flushes, for mmio */ in ata_sff_dev_select()
330 static void ata_dev_select(struct ata_port *ap, unsigned int device, in ata_dev_select() argument
333 if (ata_msg_probe(ap)) in ata_dev_select()
334 ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n", in ata_dev_select()
338 ata_wait_idle(ap); in ata_dev_select()
340 ap->ops->sff_dev_select(ap, device); in ata_dev_select()
343 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) in ata_dev_select()
344 ata_msleep(ap, 150); in ata_dev_select()
345 ata_wait_idle(ap); in ata_dev_select()
362 void ata_sff_irq_on(struct ata_port *ap) in ata_sff_irq_on() argument
364 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_irq_on()
366 if (ap->ops->sff_irq_on) { in ata_sff_irq_on()
367 ap->ops->sff_irq_on(ap); in ata_sff_irq_on()
371 ap->ctl &= ~ATA_NIEN; in ata_sff_irq_on()
372 ap->last_ctl = ap->ctl; in ata_sff_irq_on()
374 if (ap->ops->sff_set_devctl || ioaddr->ctl_addr) in ata_sff_irq_on()
375 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_irq_on()
376 ata_wait_idle(ap); in ata_sff_irq_on()
378 if (ap->ops->sff_irq_clear) in ata_sff_irq_on()
379 ap->ops->sff_irq_clear(ap); in ata_sff_irq_on()
393 void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_tf_load() argument
395 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_load()
398 if (tf->ctl != ap->last_ctl) { in ata_sff_tf_load()
401 ap->last_ctl = tf->ctl; in ata_sff_tf_load()
402 ata_wait_idle(ap); in ata_sff_tf_load()
439 ata_wait_idle(ap); in ata_sff_tf_load()
456 void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf) in ata_sff_tf_read() argument
458 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_read()
460 tf->command = ata_sff_check_status(ap); in ata_sff_tf_read()
477 ap->last_ctl = tf->ctl; in ata_sff_tf_read()
495 void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_exec_command() argument
497 DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); in ata_sff_exec_command()
499 iowrite8(tf->command, ap->ioaddr.command_addr); in ata_sff_exec_command()
500 ata_sff_pause(ap); in ata_sff_exec_command()
516 static inline void ata_tf_to_host(struct ata_port *ap, in ata_tf_to_host() argument
519 ap->ops->sff_tf_load(ap, tf); in ata_tf_to_host()
520 ap->ops->sff_exec_command(ap, tf); in ata_tf_to_host()
541 struct ata_port *ap = qc->dev->link->ap; in ata_sff_data_xfer() local
542 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer()
597 struct ata_port *ap = dev->link->ap; in ata_sff_data_xfer32() local
598 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer32()
602 if (!(ap->pflags & ATA_PFLAG_PIO32)) in ata_sff_data_xfer32()
647 qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); in ata_pio_xfer()
665 struct ata_port *ap = qc->ap; in ata_pio_sector() local
674 ap->hsm_task_state = HSM_ST_LAST; in ata_pio_sector()
706 ap->hsm_task_state = HSM_ST_LAST; in ata_pio_sector()
736 ata_sff_sync(qc->ap); /* flush */ in ata_pio_sectors()
750 static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) in atapi_send_cdb() argument
756 ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1); in atapi_send_cdb()
757 ata_sff_sync(ap); in atapi_send_cdb()
762 ap->hsm_task_state = HSM_ST; in atapi_send_cdb()
765 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
769 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
771 ap->ops->bmdma_start(qc); in atapi_send_cdb()
793 struct ata_port *ap = qc->ap; in __atapi_pio_bytes() local
827 consumed = ap->ops->sff_data_xfer(qc, buf + offset, count, rw); in __atapi_pio_bytes()
861 struct ata_port *ap = qc->ap; in atapi_pio_bytes() local
873 ap->ops->sff_tf_read(ap, &qc->result_tf); in atapi_pio_bytes()
891 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); in atapi_pio_bytes()
895 ata_sff_sync(ap); /* flush */ in atapi_pio_bytes()
904 ap->hsm_task_state = HSM_ST_ERR; in atapi_pio_bytes()
915 static inline int ata_hsm_ok_in_wq(struct ata_port *ap, in ata_hsm_ok_in_wq() argument
921 if (ap->hsm_task_state == HSM_ST_FIRST) { in ata_hsm_ok_in_wq()
947 struct ata_port *ap = qc->ap; in ata_hsm_qc_complete() local
949 if (ap->ops->error_handler) { in ata_hsm_qc_complete()
954 qc = ata_qc_from_tag(ap, qc->tag); in ata_hsm_qc_complete()
957 ata_sff_irq_on(ap); in ata_hsm_qc_complete()
960 ata_port_freeze(ap); in ata_hsm_qc_complete()
966 ata_port_freeze(ap); in ata_hsm_qc_complete()
970 ata_sff_irq_on(ap); in ata_hsm_qc_complete()
987 int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, in ata_sff_hsm_move() argument
994 lockdep_assert_held(ap->lock); in ata_sff_hsm_move()
1002 WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc)); in ata_sff_hsm_move()
1006 ap->print_id, qc->tf.protocol, ap->hsm_task_state, status); in ata_sff_hsm_move()
1008 switch (ap->hsm_task_state) { in ata_sff_hsm_move()
1031 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1052 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1066 ap->hsm_task_state = HSM_ST; in ata_sff_hsm_move()
1070 atapi_send_cdb(ap, qc); in ata_sff_hsm_move()
1085 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_hsm_move()
1100 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1106 if (unlikely(ap->hsm_task_state == HSM_ST_ERR)) in ata_sff_hsm_move()
1138 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1158 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1182 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1188 if (ap->hsm_task_state == HSM_ST_LAST && in ata_sff_hsm_move()
1191 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1202 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1208 ap->print_id, qc->dev->devno, status); in ata_sff_hsm_move()
1212 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1221 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1231 ap->print_id, ap->hsm_task_state); in ata_sff_hsm_move()
1252 struct ata_port *ap = link->ap; in ata_sff_queue_pio_task() local
1254 WARN_ON((ap->sff_pio_task_link != NULL) && in ata_sff_queue_pio_task()
1255 (ap->sff_pio_task_link != link)); in ata_sff_queue_pio_task()
1256 ap->sff_pio_task_link = link; in ata_sff_queue_pio_task()
1259 ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay)); in ata_sff_queue_pio_task()
1263 void ata_sff_flush_pio_task(struct ata_port *ap) in ata_sff_flush_pio_task() argument
1267 cancel_delayed_work_sync(&ap->sff_pio_task); in ata_sff_flush_pio_task()
1277 spin_lock_irq(ap->lock); in ata_sff_flush_pio_task()
1278 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_flush_pio_task()
1279 spin_unlock_irq(ap->lock); in ata_sff_flush_pio_task()
1281 ap->sff_pio_task_link = NULL; in ata_sff_flush_pio_task()
1283 if (ata_msg_ctl(ap)) in ata_sff_flush_pio_task()
1284 ata_port_dbg(ap, "%s: EXIT\n", __func__); in ata_sff_flush_pio_task()
1289 struct ata_port *ap = in ata_sff_pio_task() local
1291 struct ata_link *link = ap->sff_pio_task_link; in ata_sff_pio_task()
1296 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1298 BUG_ON(ap->sff_pio_task_link == NULL); in ata_sff_pio_task()
1300 qc = ata_qc_from_tag(ap, link->active_tag); in ata_sff_pio_task()
1302 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1307 WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); in ata_sff_pio_task()
1316 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); in ata_sff_pio_task()
1318 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1319 ata_msleep(ap, 2); in ata_sff_pio_task()
1320 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1322 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); in ata_sff_pio_task()
1333 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1335 poll_next = ata_sff_hsm_move(ap, qc, status, 1); in ata_sff_pio_task()
1343 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1361 struct ata_port *ap = qc->ap; in ata_sff_qc_issue() local
1367 if (ap->flags & ATA_FLAG_PIO_POLLING) in ata_sff_qc_issue()
1371 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_sff_qc_issue()
1379 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1380 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_qc_issue()
1391 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1395 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1403 ap->hsm_task_state = HSM_ST; in ata_sff_qc_issue()
1421 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1423 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1454 qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); in ata_sff_qc_fill_rtf()
1459 static unsigned int ata_sff_idle_irq(struct ata_port *ap) in ata_sff_idle_irq() argument
1461 ap->stats.idle_irq++; in ata_sff_idle_irq()
1464 if ((ap->stats.idle_irq % 1000) == 0) { in ata_sff_idle_irq()
1465 ap->ops->sff_check_status(ap); in ata_sff_idle_irq()
1466 if (ap->ops->sff_irq_clear) in ata_sff_idle_irq()
1467 ap->ops->sff_irq_clear(ap); in ata_sff_idle_irq()
1468 ata_port_warn(ap, "irq trap\n"); in ata_sff_idle_irq()
1475 static unsigned int __ata_sff_port_intr(struct ata_port *ap, in __ata_sff_port_intr() argument
1482 ap->print_id, qc->tf.protocol, ap->hsm_task_state); in __ata_sff_port_intr()
1485 switch (ap->hsm_task_state) { in __ata_sff_port_intr()
1496 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1499 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1505 status = ata_sff_irq_status(ap); in __ata_sff_port_intr()
1510 ap->hsm_task_state = HSM_ST_ERR; in __ata_sff_port_intr()
1512 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1516 if (ap->ops->sff_irq_clear) in __ata_sff_port_intr()
1517 ap->ops->sff_irq_clear(ap); in __ata_sff_port_intr()
1519 ata_sff_hsm_move(ap, qc, status, 0); in __ata_sff_port_intr()
1537 unsigned int ata_sff_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_sff_port_intr() argument
1539 return __ata_sff_port_intr(ap, qc, false); in ata_sff_port_intr()
1558 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1561 qc = ata_qc_from_tag(ap, ap->link.active_tag); in __ata_sff_interrupt()
1564 handled |= port_intr(ap, qc); in __ata_sff_interrupt()
1580 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1585 if (!ap->ops->sff_irq_check || in __ata_sff_interrupt()
1586 !ap->ops->sff_irq_check(ap)) in __ata_sff_interrupt()
1590 ap->ops->sff_check_status(ap); in __ata_sff_interrupt()
1591 if (ap->ops->sff_irq_clear) in __ata_sff_interrupt()
1592 ap->ops->sff_irq_clear(ap); in __ata_sff_interrupt()
1595 if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) in __ata_sff_interrupt()
1648 void ata_sff_lost_interrupt(struct ata_port *ap) in ata_sff_lost_interrupt() argument
1654 qc = ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_lost_interrupt()
1660 status = ata_sff_altstatus(ap); in ata_sff_lost_interrupt()
1666 ata_port_warn(ap, "lost interrupt (Status 0x%x)\n", in ata_sff_lost_interrupt()
1670 ata_sff_port_intr(ap, qc); in ata_sff_lost_interrupt()
1683 void ata_sff_freeze(struct ata_port *ap) in ata_sff_freeze() argument
1685 ap->ctl |= ATA_NIEN; in ata_sff_freeze()
1686 ap->last_ctl = ap->ctl; in ata_sff_freeze()
1688 if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) in ata_sff_freeze()
1689 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_freeze()
1695 ap->ops->sff_check_status(ap); in ata_sff_freeze()
1697 if (ap->ops->sff_irq_clear) in ata_sff_freeze()
1698 ap->ops->sff_irq_clear(ap); in ata_sff_freeze()
1711 void ata_sff_thaw(struct ata_port *ap) in ata_sff_thaw() argument
1714 ap->ops->sff_check_status(ap); in ata_sff_thaw()
1715 if (ap->ops->sff_irq_clear) in ata_sff_thaw()
1716 ap->ops->sff_irq_clear(ap); in ata_sff_thaw()
1717 ata_sff_irq_on(ap); in ata_sff_thaw()
1781 static unsigned int ata_devchk(struct ata_port *ap, unsigned int device) in ata_devchk() argument
1783 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_devchk()
1786 ap->ops->sff_dev_select(ap, device); in ata_devchk()
1830 struct ata_port *ap = dev->link->ap; in ata_sff_dev_classify() local
1835 ap->ops->sff_dev_select(ap, dev->devno); in ata_sff_dev_classify()
1839 ap->ops->sff_tf_read(ap, &tf); in ata_sff_dev_classify()
1870 (ap->ops->sff_check_status(ap) == 0)) in ata_sff_dev_classify()
1897 struct ata_port *ap = link->ap; in ata_sff_wait_after_reset() local
1898 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_wait_after_reset()
1903 ata_msleep(ap, ATA_WAIT_AFTER_RESET); in ata_sff_wait_after_reset()
1919 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1932 ata_msleep(ap, 50); /* give drive a breather */ in ata_sff_wait_after_reset()
1944 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
1946 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1948 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
1954 static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, in ata_bus_softreset() argument
1957 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_bus_softreset()
1959 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); in ata_bus_softreset()
1961 if (ap->ioaddr.ctl_addr) { in ata_bus_softreset()
1963 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
1965 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); in ata_bus_softreset()
1967 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
1968 ap->last_ctl = ap->ctl; in ata_bus_softreset()
1972 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); in ata_bus_softreset()
1992 struct ata_port *ap = link->ap; in ata_sff_softreset() local
1993 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; in ata_sff_softreset()
2001 if (ata_devchk(ap, 0)) in ata_sff_softreset()
2003 if (slave_possible && ata_devchk(ap, 1)) in ata_sff_softreset()
2007 ap->ops->sff_dev_select(ap, 0); in ata_sff_softreset()
2011 rc = ata_bus_softreset(ap, devmask, deadline); in ata_sff_softreset()
2077 struct ata_port *ap = link->ap; in ata_sff_postreset() local
2083 ap->ops->sff_dev_select(ap, 1); in ata_sff_postreset()
2085 ap->ops->sff_dev_select(ap, 0); in ata_sff_postreset()
2094 if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) { in ata_sff_postreset()
2095 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_postreset()
2096 ap->last_ctl = ap->ctl; in ata_sff_postreset()
2114 struct ata_port *ap; in ata_sff_drain_fifo() local
2120 ap = qc->ap; in ata_sff_drain_fifo()
2122 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) in ata_sff_drain_fifo()
2124 ioread16(ap->ioaddr.data_addr); in ata_sff_drain_fifo()
2128 ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count); in ata_sff_drain_fifo()
2145 void ata_sff_error_handler(struct ata_port *ap) in ata_sff_error_handler() argument
2147 ata_reset_fn_t softreset = ap->ops->softreset; in ata_sff_error_handler()
2148 ata_reset_fn_t hardreset = ap->ops->hardreset; in ata_sff_error_handler()
2152 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_error_handler()
2156 spin_lock_irqsave(ap->lock, flags); in ata_sff_error_handler()
2165 if (ap->ops->sff_drain_fifo) in ata_sff_error_handler()
2166 ap->ops->sff_drain_fifo(qc); in ata_sff_error_handler()
2168 spin_unlock_irqrestore(ap->lock, flags); in ata_sff_error_handler()
2172 hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) in ata_sff_error_handler()
2175 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, in ata_sff_error_handler()
2176 ap->ops->postreset); in ata_sff_error_handler()
2250 struct ata_port *ap = host->ports[i]; in ata_pci_sff_init_host() local
2254 if (ata_port_is_dummy(ap)) in ata_pci_sff_init_host()
2262 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2274 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2279 ap->ioaddr.cmd_addr = iomap[base]; in ata_pci_sff_init_host()
2280 ap->ioaddr.altstatus_addr = in ata_pci_sff_init_host()
2281 ap->ioaddr.ctl_addr = (void __iomem *) in ata_pci_sff_init_host()
2283 ata_sff_std_ports(&ap->ioaddr); in ata_pci_sff_init_host()
2285 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx", in ata_pci_sff_init_host()
2592 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg() local
2593 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg()
2643 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg_dumb() local
2644 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg_dumb()
2744 struct ata_port *ap = qc->ap; in ata_bmdma_qc_issue() local
2752 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_bmdma_qc_issue()
2759 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2760 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2761 ap->ops->bmdma_start(qc); /* initiate bmdma */ in ata_bmdma_qc_issue()
2762 ap->hsm_task_state = HSM_ST_LAST; in ata_bmdma_qc_issue()
2768 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2769 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2770 ap->hsm_task_state = HSM_ST_FIRST; in ata_bmdma_qc_issue()
2799 unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_bmdma_port_intr() argument
2801 struct ata_eh_info *ehi = &ap->link.eh_info; in ata_bmdma_port_intr()
2806 if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) { in ata_bmdma_port_intr()
2808 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_port_intr()
2809 VPRINTK("ata%u: host_stat 0x%X\n", ap->print_id, host_stat); in ata_bmdma_port_intr()
2813 return ata_sff_idle_irq(ap); in ata_bmdma_port_intr()
2816 ap->ops->bmdma_stop(qc); in ata_bmdma_port_intr()
2822 ap->hsm_task_state = HSM_ST_ERR; in ata_bmdma_port_intr()
2826 handled = __ata_sff_port_intr(ap, qc, bmdma_stopped); in ata_bmdma_port_intr()
2867 void ata_bmdma_error_handler(struct ata_port *ap) in ata_bmdma_error_handler() argument
2873 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_bmdma_error_handler()
2878 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_error_handler()
2883 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_error_handler()
2895 ap->ops->bmdma_stop(qc); in ata_bmdma_error_handler()
2899 ap->ops->sff_check_status(ap); in ata_bmdma_error_handler()
2900 if (ap->ops->sff_irq_clear) in ata_bmdma_error_handler()
2901 ap->ops->sff_irq_clear(ap); in ata_bmdma_error_handler()
2905 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_error_handler()
2908 ata_eh_thaw_port(ap); in ata_bmdma_error_handler()
2910 ata_sff_error_handler(ap); in ata_bmdma_error_handler()
2923 struct ata_port *ap = qc->ap; in ata_bmdma_post_internal_cmd() local
2927 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2928 ap->ops->bmdma_stop(qc); in ata_bmdma_post_internal_cmd()
2929 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2945 void ata_bmdma_irq_clear(struct ata_port *ap) in ata_bmdma_irq_clear() argument
2947 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_irq_clear()
2965 struct ata_port *ap = qc->ap; in ata_bmdma_setup() local
2971 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); in ata_bmdma_setup()
2974 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
2978 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
2981 ap->ops->sff_exec_command(ap, &qc->tf); in ata_bmdma_setup()
2994 struct ata_port *ap = qc->ap; in ata_bmdma_start() local
2998 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
2999 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
3031 struct ata_port *ap = qc->ap; in ata_bmdma_stop() local
3032 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_stop()
3039 ata_sff_dma_pause(ap); in ata_bmdma_stop()
3054 u8 ata_bmdma_status(struct ata_port *ap) in ata_bmdma_status() argument
3056 return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); in ata_bmdma_status()
3073 int ata_bmdma_port_start(struct ata_port *ap) in ata_bmdma_port_start() argument
3075 if (ap->mwdma_mask || ap->udma_mask) { in ata_bmdma_port_start()
3076 ap->bmdma_prd = in ata_bmdma_port_start()
3077 dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ, in ata_bmdma_port_start()
3078 &ap->bmdma_prd_dma, GFP_KERNEL); in ata_bmdma_port_start()
3079 if (!ap->bmdma_prd) in ata_bmdma_port_start()
3101 int ata_bmdma_port_start32(struct ata_port *ap) in ata_bmdma_port_start32() argument
3103 ap->pflags |= ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE; in ata_bmdma_port_start32()
3104 return ata_bmdma_port_start(ap); in ata_bmdma_port_start32()
3188 struct ata_port *ap = host->ports[i]; in ata_pci_bmdma_init() local
3191 if (ata_port_is_dummy(ap)) in ata_pci_bmdma_init()
3194 ap->ioaddr.bmdma_addr = bmdma; in ata_pci_bmdma_init()
3195 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) && in ata_pci_bmdma_init()
3199 ata_port_desc(ap, "bmdma 0x%llx", in ata_pci_bmdma_init()
3274 void ata_sff_port_init(struct ata_port *ap) in ata_sff_port_init() argument
3276 INIT_DELAYED_WORK(&ap->sff_pio_task, ata_sff_pio_task); in ata_sff_port_init()
3277 ap->ctl = ATA_DEVCTL_OBS; in ata_sff_port_init()
3278 ap->last_ctl = 0xFF; in ata_sff_port_init()