• Home
  • Raw
  • Download

Lines Matching refs:ap

84 u8 ata_sff_check_status(struct ata_port *ap)  in ata_sff_check_status()  argument
86 return ioread8(ap->ioaddr.status_addr); in ata_sff_check_status()
103 static u8 ata_sff_altstatus(struct ata_port *ap) in ata_sff_altstatus() argument
105 if (ap->ops->sff_check_altstatus) in ata_sff_altstatus()
106 return ap->ops->sff_check_altstatus(ap); in ata_sff_altstatus()
108 return ioread8(ap->ioaddr.altstatus_addr); in ata_sff_altstatus()
123 static u8 ata_sff_irq_status(struct ata_port *ap) in ata_sff_irq_status() argument
127 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { in ata_sff_irq_status()
128 status = ata_sff_altstatus(ap); in ata_sff_irq_status()
134 status = ap->ops->sff_check_status(ap); in ata_sff_irq_status()
150 static void ata_sff_sync(struct ata_port *ap) in ata_sff_sync() argument
152 if (ap->ops->sff_check_altstatus) in ata_sff_sync()
153 ap->ops->sff_check_altstatus(ap); in ata_sff_sync()
154 else if (ap->ioaddr.altstatus_addr) in ata_sff_sync()
155 ioread8(ap->ioaddr.altstatus_addr); in ata_sff_sync()
170 void ata_sff_pause(struct ata_port *ap) in ata_sff_pause() argument
172 ata_sff_sync(ap); in ata_sff_pause()
185 void ata_sff_dma_pause(struct ata_port *ap) in ata_sff_dma_pause() argument
187 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { in ata_sff_dma_pause()
190 ata_sff_altstatus(ap); in ata_sff_dma_pause()
215 int ata_sff_busy_sleep(struct ata_port *ap, in ata_sff_busy_sleep() argument
221 status = ata_sff_busy_wait(ap, ATA_BUSY, 300); in ata_sff_busy_sleep()
226 ata_msleep(ap, 50); in ata_sff_busy_sleep()
227 status = ata_sff_busy_wait(ap, ATA_BUSY, 3); in ata_sff_busy_sleep()
231 ata_port_warn(ap, in ata_sff_busy_sleep()
238 ata_msleep(ap, 50); in ata_sff_busy_sleep()
239 status = ap->ops->sff_check_status(ap); in ata_sff_busy_sleep()
246 ata_port_err(ap, in ata_sff_busy_sleep()
258 u8 status = link->ap->ops->sff_check_status(link->ap); in ata_sff_check_ready()
296 static void ata_sff_set_devctl(struct ata_port *ap, u8 ctl) in ata_sff_set_devctl() argument
298 if (ap->ops->sff_set_devctl) in ata_sff_set_devctl()
299 ap->ops->sff_set_devctl(ap, ctl); in ata_sff_set_devctl()
301 iowrite8(ctl, ap->ioaddr.ctl_addr); in ata_sff_set_devctl()
318 void ata_sff_dev_select(struct ata_port *ap, unsigned int device) in ata_sff_dev_select() argument
327 iowrite8(tmp, ap->ioaddr.device_addr); in ata_sff_dev_select()
328 ata_sff_pause(ap); /* needed; also flushes, for mmio */ in ata_sff_dev_select()
350 static void ata_dev_select(struct ata_port *ap, unsigned int device, in ata_dev_select() argument
353 if (ata_msg_probe(ap)) in ata_dev_select()
354 ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n", in ata_dev_select()
358 ata_wait_idle(ap); in ata_dev_select()
360 ap->ops->sff_dev_select(ap, device); in ata_dev_select()
363 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) in ata_dev_select()
364 ata_msleep(ap, 150); in ata_dev_select()
365 ata_wait_idle(ap); in ata_dev_select()
382 void ata_sff_irq_on(struct ata_port *ap) in ata_sff_irq_on() argument
384 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_irq_on()
386 if (ap->ops->sff_irq_on) { in ata_sff_irq_on()
387 ap->ops->sff_irq_on(ap); in ata_sff_irq_on()
391 ap->ctl &= ~ATA_NIEN; in ata_sff_irq_on()
392 ap->last_ctl = ap->ctl; in ata_sff_irq_on()
394 if (ap->ops->sff_set_devctl || ioaddr->ctl_addr) in ata_sff_irq_on()
395 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_irq_on()
396 ata_wait_idle(ap); in ata_sff_irq_on()
398 if (ap->ops->sff_irq_clear) in ata_sff_irq_on()
399 ap->ops->sff_irq_clear(ap); in ata_sff_irq_on()
413 void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_tf_load() argument
415 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_load()
418 if (tf->ctl != ap->last_ctl) { in ata_sff_tf_load()
421 ap->last_ctl = tf->ctl; in ata_sff_tf_load()
422 ata_wait_idle(ap); in ata_sff_tf_load()
459 ata_wait_idle(ap); in ata_sff_tf_load()
476 void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf) in ata_sff_tf_read() argument
478 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_read()
480 tf->command = ata_sff_check_status(ap); in ata_sff_tf_read()
497 ap->last_ctl = tf->ctl; in ata_sff_tf_read()
515 void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_exec_command() argument
517 DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); in ata_sff_exec_command()
519 iowrite8(tf->command, ap->ioaddr.command_addr); in ata_sff_exec_command()
520 ata_sff_pause(ap); in ata_sff_exec_command()
536 static inline void ata_tf_to_host(struct ata_port *ap, in ata_tf_to_host() argument
539 ap->ops->sff_tf_load(ap, tf); in ata_tf_to_host()
540 ap->ops->sff_exec_command(ap, tf); in ata_tf_to_host()
561 struct ata_port *ap = dev->link->ap; in ata_sff_data_xfer() local
562 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer()
616 struct ata_port *ap = dev->link->ap; in ata_sff_data_xfer32() local
617 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer32()
621 if (!(ap->pflags & ATA_PFLAG_PIO32)) in ata_sff_data_xfer32()
701 struct ata_port *ap = qc->ap; in ata_pio_sector() local
707 ap->hsm_task_state = HSM_ST_LAST; in ata_pio_sector()
726 ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, in ata_pio_sector()
733 ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, in ata_pio_sector()
774 ata_sff_sync(qc->ap); /* flush */ in ata_pio_sectors()
788 static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) in atapi_send_cdb() argument
794 ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); in atapi_send_cdb()
795 ata_sff_sync(ap); in atapi_send_cdb()
800 ap->hsm_task_state = HSM_ST; in atapi_send_cdb()
803 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
807 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
809 ap->ops->bmdma_start(qc); in atapi_send_cdb()
831 struct ata_port *ap = qc->ap; in __atapi_pio_bytes() local
871 consumed = ap->ops->sff_data_xfer(dev, buf + offset, in __atapi_pio_bytes()
878 consumed = ap->ops->sff_data_xfer(dev, buf + offset, in __atapi_pio_bytes()
913 struct ata_port *ap = qc->ap; in atapi_pio_bytes() local
925 ap->ops->sff_tf_read(ap, &qc->result_tf); in atapi_pio_bytes()
943 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); in atapi_pio_bytes()
947 ata_sff_sync(ap); /* flush */ in atapi_pio_bytes()
956 ap->hsm_task_state = HSM_ST_ERR; in atapi_pio_bytes()
967 static inline int ata_hsm_ok_in_wq(struct ata_port *ap, in ata_hsm_ok_in_wq() argument
973 if (ap->hsm_task_state == HSM_ST_FIRST) { in ata_hsm_ok_in_wq()
999 struct ata_port *ap = qc->ap; in ata_hsm_qc_complete() local
1001 if (ap->ops->error_handler) { in ata_hsm_qc_complete()
1006 qc = ata_qc_from_tag(ap, qc->tag); in ata_hsm_qc_complete()
1009 ata_sff_irq_on(ap); in ata_hsm_qc_complete()
1012 ata_port_freeze(ap); in ata_hsm_qc_complete()
1018 ata_port_freeze(ap); in ata_hsm_qc_complete()
1022 ata_sff_irq_on(ap); in ata_hsm_qc_complete()
1039 int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, in ata_sff_hsm_move() argument
1046 lockdep_assert_held(ap->lock); in ata_sff_hsm_move()
1054 WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc)); in ata_sff_hsm_move()
1058 ap->print_id, qc->tf.protocol, ap->hsm_task_state, status); in ata_sff_hsm_move()
1060 switch (ap->hsm_task_state) { in ata_sff_hsm_move()
1083 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1104 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1118 ap->hsm_task_state = HSM_ST; in ata_sff_hsm_move()
1122 atapi_send_cdb(ap, qc); in ata_sff_hsm_move()
1137 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_hsm_move()
1152 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1158 if (unlikely(ap->hsm_task_state == HSM_ST_ERR)) in ata_sff_hsm_move()
1190 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1210 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1234 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1240 if (ap->hsm_task_state == HSM_ST_LAST && in ata_sff_hsm_move()
1243 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1254 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1260 ap->print_id, qc->dev->devno, status); in ata_sff_hsm_move()
1264 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1273 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1303 struct ata_port *ap = link->ap; in ata_sff_queue_pio_task() local
1305 WARN_ON((ap->sff_pio_task_link != NULL) && in ata_sff_queue_pio_task()
1306 (ap->sff_pio_task_link != link)); in ata_sff_queue_pio_task()
1307 ap->sff_pio_task_link = link; in ata_sff_queue_pio_task()
1310 ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay)); in ata_sff_queue_pio_task()
1314 void ata_sff_flush_pio_task(struct ata_port *ap) in ata_sff_flush_pio_task() argument
1318 cancel_delayed_work_sync(&ap->sff_pio_task); in ata_sff_flush_pio_task()
1328 spin_lock_irq(ap->lock); in ata_sff_flush_pio_task()
1329 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_flush_pio_task()
1330 spin_unlock_irq(ap->lock); in ata_sff_flush_pio_task()
1332 ap->sff_pio_task_link = NULL; in ata_sff_flush_pio_task()
1334 if (ata_msg_ctl(ap)) in ata_sff_flush_pio_task()
1335 ata_port_dbg(ap, "%s: EXIT\n", __func__); in ata_sff_flush_pio_task()
1340 struct ata_port *ap = in ata_sff_pio_task() local
1342 struct ata_link *link = ap->sff_pio_task_link; in ata_sff_pio_task()
1347 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1349 BUG_ON(ap->sff_pio_task_link == NULL); in ata_sff_pio_task()
1351 qc = ata_qc_from_tag(ap, link->active_tag); in ata_sff_pio_task()
1353 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1358 WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); in ata_sff_pio_task()
1367 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); in ata_sff_pio_task()
1369 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1370 ata_msleep(ap, 2); in ata_sff_pio_task()
1371 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1373 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); in ata_sff_pio_task()
1384 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1386 poll_next = ata_sff_hsm_move(ap, qc, status, 1); in ata_sff_pio_task()
1394 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1412 struct ata_port *ap = qc->ap; in ata_sff_qc_issue() local
1418 if (ap->flags & ATA_FLAG_PIO_POLLING) in ata_sff_qc_issue()
1422 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_sff_qc_issue()
1430 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1431 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_qc_issue()
1442 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1446 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1454 ap->hsm_task_state = HSM_ST; in ata_sff_qc_issue()
1472 ata_tf_to_host(ap, &qc->tf); in ata_sff_qc_issue()
1474 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1505 qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); in ata_sff_qc_fill_rtf()
1510 static unsigned int ata_sff_idle_irq(struct ata_port *ap) in ata_sff_idle_irq() argument
1512 ap->stats.idle_irq++; in ata_sff_idle_irq()
1515 if ((ap->stats.idle_irq % 1000) == 0) { in ata_sff_idle_irq()
1516 ap->ops->sff_check_status(ap); in ata_sff_idle_irq()
1517 if (ap->ops->sff_irq_clear) in ata_sff_idle_irq()
1518 ap->ops->sff_irq_clear(ap); in ata_sff_idle_irq()
1519 ata_port_warn(ap, "irq trap\n"); in ata_sff_idle_irq()
1526 static unsigned int __ata_sff_port_intr(struct ata_port *ap, in __ata_sff_port_intr() argument
1533 ap->print_id, qc->tf.protocol, ap->hsm_task_state); in __ata_sff_port_intr()
1536 switch (ap->hsm_task_state) { in __ata_sff_port_intr()
1547 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1550 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1556 status = ata_sff_irq_status(ap); in __ata_sff_port_intr()
1561 ap->hsm_task_state = HSM_ST_ERR; in __ata_sff_port_intr()
1563 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1567 if (ap->ops->sff_irq_clear) in __ata_sff_port_intr()
1568 ap->ops->sff_irq_clear(ap); in __ata_sff_port_intr()
1570 ata_sff_hsm_move(ap, qc, status, 0); in __ata_sff_port_intr()
1588 unsigned int ata_sff_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_sff_port_intr() argument
1590 return __ata_sff_port_intr(ap, qc, false); in ata_sff_port_intr()
1609 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1612 qc = ata_qc_from_tag(ap, ap->link.active_tag); in __ata_sff_interrupt()
1615 handled |= port_intr(ap, qc); in __ata_sff_interrupt()
1631 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1636 if (!ap->ops->sff_irq_check || in __ata_sff_interrupt()
1637 !ap->ops->sff_irq_check(ap)) in __ata_sff_interrupt()
1641 ap->ops->sff_check_status(ap); in __ata_sff_interrupt()
1642 if (ap->ops->sff_irq_clear) in __ata_sff_interrupt()
1643 ap->ops->sff_irq_clear(ap); in __ata_sff_interrupt()
1646 if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) in __ata_sff_interrupt()
1699 void ata_sff_lost_interrupt(struct ata_port *ap) in ata_sff_lost_interrupt() argument
1705 qc = ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_lost_interrupt()
1711 status = ata_sff_altstatus(ap); in ata_sff_lost_interrupt()
1717 ata_port_warn(ap, "lost interrupt (Status 0x%x)\n", in ata_sff_lost_interrupt()
1721 ata_sff_port_intr(ap, qc); in ata_sff_lost_interrupt()
1734 void ata_sff_freeze(struct ata_port *ap) in ata_sff_freeze() argument
1736 ap->ctl |= ATA_NIEN; in ata_sff_freeze()
1737 ap->last_ctl = ap->ctl; in ata_sff_freeze()
1739 if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) in ata_sff_freeze()
1740 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_freeze()
1746 ap->ops->sff_check_status(ap); in ata_sff_freeze()
1748 if (ap->ops->sff_irq_clear) in ata_sff_freeze()
1749 ap->ops->sff_irq_clear(ap); in ata_sff_freeze()
1762 void ata_sff_thaw(struct ata_port *ap) in ata_sff_thaw() argument
1765 ap->ops->sff_check_status(ap); in ata_sff_thaw()
1766 if (ap->ops->sff_irq_clear) in ata_sff_thaw()
1767 ap->ops->sff_irq_clear(ap); in ata_sff_thaw()
1768 ata_sff_irq_on(ap); in ata_sff_thaw()
1832 static unsigned int ata_devchk(struct ata_port *ap, unsigned int device) in ata_devchk() argument
1834 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_devchk()
1837 ap->ops->sff_dev_select(ap, device); in ata_devchk()
1881 struct ata_port *ap = dev->link->ap; in ata_sff_dev_classify() local
1886 ap->ops->sff_dev_select(ap, dev->devno); in ata_sff_dev_classify()
1890 ap->ops->sff_tf_read(ap, &tf); in ata_sff_dev_classify()
1921 (ap->ops->sff_check_status(ap) == 0)) in ata_sff_dev_classify()
1948 struct ata_port *ap = link->ap; in ata_sff_wait_after_reset() local
1949 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_wait_after_reset()
1954 ata_msleep(ap, ATA_WAIT_AFTER_RESET); in ata_sff_wait_after_reset()
1970 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1983 ata_msleep(ap, 50); /* give drive a breather */ in ata_sff_wait_after_reset()
1995 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
1997 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1999 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
2005 static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, in ata_bus_softreset() argument
2008 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_bus_softreset()
2010 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); in ata_bus_softreset()
2012 if (ap->ioaddr.ctl_addr) { in ata_bus_softreset()
2014 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
2016 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); in ata_bus_softreset()
2018 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
2019 ap->last_ctl = ap->ctl; in ata_bus_softreset()
2023 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); in ata_bus_softreset()
2043 struct ata_port *ap = link->ap; in ata_sff_softreset() local
2044 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; in ata_sff_softreset()
2052 if (ata_devchk(ap, 0)) in ata_sff_softreset()
2054 if (slave_possible && ata_devchk(ap, 1)) in ata_sff_softreset()
2058 ap->ops->sff_dev_select(ap, 0); in ata_sff_softreset()
2062 rc = ata_bus_softreset(ap, devmask, deadline); in ata_sff_softreset()
2128 struct ata_port *ap = link->ap; in ata_sff_postreset() local
2134 ap->ops->sff_dev_select(ap, 1); in ata_sff_postreset()
2136 ap->ops->sff_dev_select(ap, 0); in ata_sff_postreset()
2145 if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) { in ata_sff_postreset()
2146 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_postreset()
2147 ap->last_ctl = ap->ctl; in ata_sff_postreset()
2165 struct ata_port *ap; in ata_sff_drain_fifo() local
2171 ap = qc->ap; in ata_sff_drain_fifo()
2173 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) in ata_sff_drain_fifo()
2175 ioread16(ap->ioaddr.data_addr); in ata_sff_drain_fifo()
2179 ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count); in ata_sff_drain_fifo()
2196 void ata_sff_error_handler(struct ata_port *ap) in ata_sff_error_handler() argument
2198 ata_reset_fn_t softreset = ap->ops->softreset; in ata_sff_error_handler()
2199 ata_reset_fn_t hardreset = ap->ops->hardreset; in ata_sff_error_handler()
2203 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_error_handler()
2207 spin_lock_irqsave(ap->lock, flags); in ata_sff_error_handler()
2216 if (ap->ops->sff_drain_fifo) in ata_sff_error_handler()
2217 ap->ops->sff_drain_fifo(qc); in ata_sff_error_handler()
2219 spin_unlock_irqrestore(ap->lock, flags); in ata_sff_error_handler()
2223 hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) in ata_sff_error_handler()
2226 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, in ata_sff_error_handler()
2227 ap->ops->postreset); in ata_sff_error_handler()
2301 struct ata_port *ap = host->ports[i]; in ata_pci_sff_init_host() local
2305 if (ata_port_is_dummy(ap)) in ata_pci_sff_init_host()
2313 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2325 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2330 ap->ioaddr.cmd_addr = iomap[base]; in ata_pci_sff_init_host()
2331 ap->ioaddr.altstatus_addr = in ata_pci_sff_init_host()
2332 ap->ioaddr.ctl_addr = (void __iomem *) in ata_pci_sff_init_host()
2334 ata_sff_std_ports(&ap->ioaddr); in ata_pci_sff_init_host()
2336 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx", in ata_pci_sff_init_host()
2633 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg() local
2634 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg()
2684 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg_dumb() local
2685 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg_dumb()
2781 struct ata_port *ap = qc->ap; in ata_bmdma_qc_issue() local
2789 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_bmdma_qc_issue()
2796 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2797 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2798 ap->ops->bmdma_start(qc); /* initiate bmdma */ in ata_bmdma_qc_issue()
2799 ap->hsm_task_state = HSM_ST_LAST; in ata_bmdma_qc_issue()
2805 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2806 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2807 ap->hsm_task_state = HSM_ST_FIRST; in ata_bmdma_qc_issue()
2836 unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_bmdma_port_intr() argument
2838 struct ata_eh_info *ehi = &ap->link.eh_info; in ata_bmdma_port_intr()
2843 if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) { in ata_bmdma_port_intr()
2845 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_port_intr()
2846 VPRINTK("ata%u: host_stat 0x%X\n", ap->print_id, host_stat); in ata_bmdma_port_intr()
2850 return ata_sff_idle_irq(ap); in ata_bmdma_port_intr()
2853 ap->ops->bmdma_stop(qc); in ata_bmdma_port_intr()
2859 ap->hsm_task_state = HSM_ST_ERR; in ata_bmdma_port_intr()
2863 handled = __ata_sff_port_intr(ap, qc, bmdma_stopped); in ata_bmdma_port_intr()
2904 void ata_bmdma_error_handler(struct ata_port *ap) in ata_bmdma_error_handler() argument
2910 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_bmdma_error_handler()
2915 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_error_handler()
2920 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_error_handler()
2932 ap->ops->bmdma_stop(qc); in ata_bmdma_error_handler()
2936 ap->ops->sff_check_status(ap); in ata_bmdma_error_handler()
2937 if (ap->ops->sff_irq_clear) in ata_bmdma_error_handler()
2938 ap->ops->sff_irq_clear(ap); in ata_bmdma_error_handler()
2942 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_error_handler()
2945 ata_eh_thaw_port(ap); in ata_bmdma_error_handler()
2947 ata_sff_error_handler(ap); in ata_bmdma_error_handler()
2960 struct ata_port *ap = qc->ap; in ata_bmdma_post_internal_cmd() local
2964 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2965 ap->ops->bmdma_stop(qc); in ata_bmdma_post_internal_cmd()
2966 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2982 void ata_bmdma_irq_clear(struct ata_port *ap) in ata_bmdma_irq_clear() argument
2984 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_irq_clear()
3002 struct ata_port *ap = qc->ap; in ata_bmdma_setup() local
3008 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); in ata_bmdma_setup()
3011 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
3015 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
3018 ap->ops->sff_exec_command(ap, &qc->tf); in ata_bmdma_setup()
3031 struct ata_port *ap = qc->ap; in ata_bmdma_start() local
3035 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
3036 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
3068 struct ata_port *ap = qc->ap; in ata_bmdma_stop() local
3069 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_stop()
3076 ata_sff_dma_pause(ap); in ata_bmdma_stop()
3091 u8 ata_bmdma_status(struct ata_port *ap) in ata_bmdma_status() argument
3093 return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); in ata_bmdma_status()
3110 int ata_bmdma_port_start(struct ata_port *ap) in ata_bmdma_port_start() argument
3112 if (ap->mwdma_mask || ap->udma_mask) { in ata_bmdma_port_start()
3113 ap->bmdma_prd = in ata_bmdma_port_start()
3114 dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ, in ata_bmdma_port_start()
3115 &ap->bmdma_prd_dma, GFP_KERNEL); in ata_bmdma_port_start()
3116 if (!ap->bmdma_prd) in ata_bmdma_port_start()
3138 int ata_bmdma_port_start32(struct ata_port *ap) in ata_bmdma_port_start32() argument
3140 ap->pflags |= ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE; in ata_bmdma_port_start32()
3141 return ata_bmdma_port_start(ap); in ata_bmdma_port_start32()
3231 struct ata_port *ap = host->ports[i]; in ata_pci_bmdma_init() local
3234 if (ata_port_is_dummy(ap)) in ata_pci_bmdma_init()
3237 ap->ioaddr.bmdma_addr = bmdma; in ata_pci_bmdma_init()
3238 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) && in ata_pci_bmdma_init()
3242 ata_port_desc(ap, "bmdma 0x%llx", in ata_pci_bmdma_init()
3317 void ata_sff_port_init(struct ata_port *ap) in ata_sff_port_init() argument
3319 INIT_DELAYED_WORK(&ap->sff_pio_task, ata_sff_pio_task); in ata_sff_port_init()
3320 ap->ctl = ATA_DEVCTL_OBS; in ata_sff_port_init()
3321 ap->last_ctl = 0xFF; in ata_sff_port_init()