Lines Matching full:ap

54  *	@ap: port where the device is
63 u8 ata_sff_check_status(struct ata_port *ap) in ata_sff_check_status() argument
65 return ioread8(ap->ioaddr.status_addr); in ata_sff_check_status()
71 * @ap: port where the device is
83 static bool ata_sff_altstatus(struct ata_port *ap, u8 *status) in ata_sff_altstatus() argument
87 if (ap->ops->sff_check_altstatus) { in ata_sff_altstatus()
88 tmp = ap->ops->sff_check_altstatus(ap); in ata_sff_altstatus()
91 if (ap->ioaddr.altstatus_addr) { in ata_sff_altstatus()
92 tmp = ioread8(ap->ioaddr.altstatus_addr); in ata_sff_altstatus()
105 * @ap: port where the device is
115 static u8 ata_sff_irq_status(struct ata_port *ap) in ata_sff_irq_status() argument
120 if (ata_sff_altstatus(ap, &status) && (status & ATA_BUSY)) in ata_sff_irq_status()
123 status = ap->ops->sff_check_status(ap); in ata_sff_irq_status()
129 * @ap: Port to wait for.
139 static void ata_sff_sync(struct ata_port *ap) in ata_sff_sync() argument
141 ata_sff_altstatus(ap, NULL); in ata_sff_sync()
146 * @ap: Port to pause for.
156 void ata_sff_pause(struct ata_port *ap) in ata_sff_pause() argument
158 ata_sff_sync(ap); in ata_sff_pause()
165 * @ap: Port to pause for.
171 void ata_sff_dma_pause(struct ata_port *ap) in ata_sff_dma_pause() argument
177 if (ata_sff_altstatus(ap, NULL)) in ata_sff_dma_pause()
188 u8 status = link->ap->ops->sff_check_status(link->ap); in ata_sff_check_ready()
215 * @ap: port where the device is
226 static bool ata_sff_set_devctl(struct ata_port *ap, u8 ctl) in ata_sff_set_devctl() argument
228 if (ap->ops->sff_set_devctl) { in ata_sff_set_devctl()
229 ap->ops->sff_set_devctl(ap, ctl); in ata_sff_set_devctl()
232 if (ap->ioaddr.ctl_addr) { in ata_sff_set_devctl()
233 iowrite8(ctl, ap->ioaddr.ctl_addr); in ata_sff_set_devctl()
242 * @ap: ATA channel to manipulate
254 void ata_sff_dev_select(struct ata_port *ap, unsigned int device) in ata_sff_dev_select() argument
263 iowrite8(tmp, ap->ioaddr.device_addr); in ata_sff_dev_select()
264 ata_sff_pause(ap); /* needed; also flushes, for mmio */ in ata_sff_dev_select()
270 * @ap: ATA channel to manipulate
286 static void ata_dev_select(struct ata_port *ap, unsigned int device, in ata_dev_select() argument
290 ata_wait_idle(ap); in ata_dev_select()
292 ap->ops->sff_dev_select(ap, device); in ata_dev_select()
295 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) in ata_dev_select()
296 ata_msleep(ap, 150); in ata_dev_select()
297 ata_wait_idle(ap); in ata_dev_select()
303 * @ap: Port on which interrupts are enabled.
314 void ata_sff_irq_on(struct ata_port *ap) in ata_sff_irq_on() argument
316 if (ap->ops->sff_irq_on) { in ata_sff_irq_on()
317 ap->ops->sff_irq_on(ap); in ata_sff_irq_on()
321 ap->ctl &= ~ATA_NIEN; in ata_sff_irq_on()
322 ap->last_ctl = ap->ctl; in ata_sff_irq_on()
324 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_irq_on()
325 ata_wait_idle(ap); in ata_sff_irq_on()
327 if (ap->ops->sff_irq_clear) in ata_sff_irq_on()
328 ap->ops->sff_irq_clear(ap); in ata_sff_irq_on()
334 * @ap: Port to which output is sent
342 void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_tf_load() argument
344 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_load()
347 if (tf->ctl != ap->last_ctl) { in ata_sff_tf_load()
350 ap->last_ctl = tf->ctl; in ata_sff_tf_load()
351 ata_wait_idle(ap); in ata_sff_tf_load()
374 ata_wait_idle(ap); in ata_sff_tf_load()
380 * @ap: Port from which input is read
391 void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf) in ata_sff_tf_read() argument
393 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_tf_read()
395 tf->status = ata_sff_check_status(ap); in ata_sff_tf_read()
412 ap->last_ctl = tf->ctl; in ata_sff_tf_read()
421 * @ap: port to which command is being issued
430 void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) in ata_sff_exec_command() argument
432 iowrite8(tf->command, ap->ioaddr.command_addr); in ata_sff_exec_command()
433 ata_sff_pause(ap); in ata_sff_exec_command()
439 * @ap: port to which command is being issued
450 static inline void ata_tf_to_host(struct ata_port *ap, in ata_tf_to_host() argument
454 trace_ata_tf_load(ap, tf); in ata_tf_to_host()
455 ap->ops->sff_tf_load(ap, tf); in ata_tf_to_host()
456 trace_ata_exec_command(ap, tf, tag); in ata_tf_to_host()
457 ap->ops->sff_exec_command(ap, tf); in ata_tf_to_host()
478 struct ata_port *ap = qc->dev->link->ap; in ata_sff_data_xfer() local
479 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer()
534 struct ata_port *ap = dev->link->ap; in ata_sff_data_xfer32() local
535 void __iomem *data_addr = ap->ioaddr.data_addr; in ata_sff_data_xfer32()
539 if (!(ap->pflags & ATA_PFLAG_PIO32)) in ata_sff_data_xfer32()
584 qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); in ata_pio_xfer()
602 struct ata_port *ap = qc->ap; in ata_pio_sector() local
611 ap->hsm_task_state = HSM_ST_LAST; in ata_pio_sector()
643 ap->hsm_task_state = HSM_ST_LAST; in ata_pio_sector()
673 ata_sff_sync(qc->ap); /* flush */ in ata_pio_sectors()
678 * @ap: Port to which ATAPI device is attached.
687 static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) in atapi_send_cdb() argument
693 ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1); in atapi_send_cdb()
694 ata_sff_sync(ap); in atapi_send_cdb()
699 ap->hsm_task_state = HSM_ST; in atapi_send_cdb()
702 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
706 ap->hsm_task_state = HSM_ST_LAST; in atapi_send_cdb()
708 trace_ata_bmdma_start(ap, &qc->tf, qc->tag); in atapi_send_cdb()
709 ap->ops->bmdma_start(qc); in atapi_send_cdb()
731 struct ata_port *ap = qc->ap; in __atapi_pio_bytes() local
765 consumed = ap->ops->sff_data_xfer(qc, buf + offset, count, rw); in __atapi_pio_bytes()
799 struct ata_port *ap = qc->ap; in atapi_pio_bytes() local
811 ap->ops->sff_tf_read(ap, &qc->result_tf); in atapi_pio_bytes()
831 ata_sff_sync(ap); /* flush */ in atapi_pio_bytes()
840 ap->hsm_task_state = HSM_ST_ERR; in atapi_pio_bytes()
845 * @ap: the target ata_port
851 static inline int ata_hsm_ok_in_wq(struct ata_port *ap, in ata_hsm_ok_in_wq() argument
857 if (ap->hsm_task_state == HSM_ST_FIRST) { in ata_hsm_ok_in_wq()
883 struct ata_port *ap = qc->ap; in ata_hsm_qc_complete() local
887 qc = ata_qc_from_tag(ap, qc->tag); in ata_hsm_qc_complete()
890 ata_sff_irq_on(ap); in ata_hsm_qc_complete()
893 ata_port_freeze(ap); in ata_hsm_qc_complete()
899 ata_port_freeze(ap); in ata_hsm_qc_complete()
905 * @ap: the target ata_port
913 int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, in ata_sff_hsm_move() argument
920 lockdep_assert_held(ap->lock); in ata_sff_hsm_move()
928 WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc)); in ata_sff_hsm_move()
933 switch (ap->hsm_task_state) { in ata_sff_hsm_move()
956 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
977 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
991 ap->hsm_task_state = HSM_ST; in ata_sff_hsm_move()
995 atapi_send_cdb(ap, qc); in ata_sff_hsm_move()
1010 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_hsm_move()
1025 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1031 if (unlikely(ap->hsm_task_state == HSM_ST_ERR)) in ata_sff_hsm_move()
1063 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1083 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1107 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1113 if (ap->hsm_task_state == HSM_ST_LAST && in ata_sff_hsm_move()
1116 status = ata_wait_idle(ap); in ata_sff_hsm_move()
1127 ap->hsm_task_state = HSM_ST_ERR; in ata_sff_hsm_move()
1136 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1145 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_hsm_move()
1155 ap->print_id, ap->hsm_task_state); in ata_sff_hsm_move()
1176 struct ata_port *ap = link->ap; in ata_sff_queue_pio_task() local
1178 WARN_ON((ap->sff_pio_task_link != NULL) && in ata_sff_queue_pio_task()
1179 (ap->sff_pio_task_link != link)); in ata_sff_queue_pio_task()
1180 ap->sff_pio_task_link = link; in ata_sff_queue_pio_task()
1183 ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay)); in ata_sff_queue_pio_task()
1187 void ata_sff_flush_pio_task(struct ata_port *ap) in ata_sff_flush_pio_task() argument
1189 trace_ata_sff_flush_pio_task(ap); in ata_sff_flush_pio_task()
1191 cancel_delayed_work_sync(&ap->sff_pio_task); in ata_sff_flush_pio_task()
1201 spin_lock_irq(ap->lock); in ata_sff_flush_pio_task()
1202 ap->hsm_task_state = HSM_ST_IDLE; in ata_sff_flush_pio_task()
1203 spin_unlock_irq(ap->lock); in ata_sff_flush_pio_task()
1205 ap->sff_pio_task_link = NULL; in ata_sff_flush_pio_task()
1210 struct ata_port *ap = in ata_sff_pio_task() local
1212 struct ata_link *link = ap->sff_pio_task_link; in ata_sff_pio_task()
1217 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1219 BUG_ON(ap->sff_pio_task_link == NULL); in ata_sff_pio_task()
1221 qc = ata_qc_from_tag(ap, link->active_tag); in ata_sff_pio_task()
1223 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1228 WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); in ata_sff_pio_task()
1237 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); in ata_sff_pio_task()
1239 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1240 ata_msleep(ap, 2); in ata_sff_pio_task()
1241 spin_lock_irq(ap->lock); in ata_sff_pio_task()
1243 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); in ata_sff_pio_task()
1254 ap->sff_pio_task_link = NULL; in ata_sff_pio_task()
1256 poll_next = ata_sff_hsm_move(ap, qc, status, 1); in ata_sff_pio_task()
1264 spin_unlock_irq(ap->lock); in ata_sff_pio_task()
1282 struct ata_port *ap = qc->ap; in ata_sff_qc_issue() local
1288 if (ap->flags & ATA_FLAG_PIO_POLLING) in ata_sff_qc_issue()
1292 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_sff_qc_issue()
1300 ata_tf_to_host(ap, &qc->tf, qc->tag); in ata_sff_qc_issue()
1301 ap->hsm_task_state = HSM_ST_LAST; in ata_sff_qc_issue()
1312 ata_tf_to_host(ap, &qc->tf, qc->tag); in ata_sff_qc_issue()
1316 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1324 ap->hsm_task_state = HSM_ST; in ata_sff_qc_issue()
1342 ata_tf_to_host(ap, &qc->tf, qc->tag); in ata_sff_qc_issue()
1344 ap->hsm_task_state = HSM_ST_FIRST; in ata_sff_qc_issue()
1372 qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); in ata_sff_qc_fill_rtf()
1376 static unsigned int ata_sff_idle_irq(struct ata_port *ap) in ata_sff_idle_irq() argument
1378 ap->stats.idle_irq++; in ata_sff_idle_irq()
1381 if ((ap->stats.idle_irq % 1000) == 0) { in ata_sff_idle_irq()
1382 ap->ops->sff_check_status(ap); in ata_sff_idle_irq()
1383 if (ap->ops->sff_irq_clear) in ata_sff_idle_irq()
1384 ap->ops->sff_irq_clear(ap); in ata_sff_idle_irq()
1385 ata_port_warn(ap, "irq trap\n"); in ata_sff_idle_irq()
1392 static unsigned int __ata_sff_port_intr(struct ata_port *ap, in __ata_sff_port_intr() argument
1401 switch (ap->hsm_task_state) { in __ata_sff_port_intr()
1412 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1415 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1421 status = ata_sff_irq_status(ap); in __ata_sff_port_intr()
1426 ap->hsm_task_state = HSM_ST_ERR; in __ata_sff_port_intr()
1428 return ata_sff_idle_irq(ap); in __ata_sff_port_intr()
1432 if (ap->ops->sff_irq_clear) in __ata_sff_port_intr()
1433 ap->ops->sff_irq_clear(ap); in __ata_sff_port_intr()
1435 ata_sff_hsm_move(ap, qc, status, 0); in __ata_sff_port_intr()
1442 * @ap: Port on which interrupt arrived (possibly...)
1453 unsigned int ata_sff_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_sff_port_intr() argument
1455 return __ata_sff_port_intr(ap, qc, false); in ata_sff_port_intr()
1474 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1477 qc = ata_qc_from_tag(ap, ap->link.active_tag); in __ata_sff_interrupt()
1480 handled |= port_intr(ap, qc); in __ata_sff_interrupt()
1496 struct ata_port *ap = host->ports[i]; in __ata_sff_interrupt() local
1501 if (!ap->ops->sff_irq_check || in __ata_sff_interrupt()
1502 !ap->ops->sff_irq_check(ap)) in __ata_sff_interrupt()
1506 ap->ops->sff_check_status(ap); in __ata_sff_interrupt()
1507 if (ap->ops->sff_irq_clear) in __ata_sff_interrupt()
1508 ap->ops->sff_irq_clear(ap); in __ata_sff_interrupt()
1511 if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) in __ata_sff_interrupt()
1553 * @ap: port that appears to have timed out
1564 void ata_sff_lost_interrupt(struct ata_port *ap) in ata_sff_lost_interrupt() argument
1570 qc = ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_lost_interrupt()
1576 if (WARN_ON_ONCE(!ata_sff_altstatus(ap, &status))) in ata_sff_lost_interrupt()
1583 ata_port_warn(ap, "lost interrupt (Status 0x%x)\n", status); in ata_sff_lost_interrupt()
1586 ata_sff_port_intr(ap, qc); in ata_sff_lost_interrupt()
1592 * @ap: port to freeze
1599 void ata_sff_freeze(struct ata_port *ap) in ata_sff_freeze() argument
1601 ap->ctl |= ATA_NIEN; in ata_sff_freeze()
1602 ap->last_ctl = ap->ctl; in ata_sff_freeze()
1604 ata_sff_set_devctl(ap, ap->ctl); in ata_sff_freeze()
1610 ap->ops->sff_check_status(ap); in ata_sff_freeze()
1612 if (ap->ops->sff_irq_clear) in ata_sff_freeze()
1613 ap->ops->sff_irq_clear(ap); in ata_sff_freeze()
1619 * @ap: port to thaw
1626 void ata_sff_thaw(struct ata_port *ap) in ata_sff_thaw() argument
1629 ap->ops->sff_check_status(ap); in ata_sff_thaw()
1630 if (ap->ops->sff_irq_clear) in ata_sff_thaw()
1631 ap->ops->sff_irq_clear(ap); in ata_sff_thaw()
1632 ata_sff_irq_on(ap); in ata_sff_thaw()
1680 * @ap: ATA channel to examine
1698 static bool ata_devchk(struct ata_port *ap, unsigned int device) in ata_devchk() argument
1700 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_devchk()
1703 ap->ops->sff_dev_select(ap, device); in ata_devchk()
1747 struct ata_port *ap = dev->link->ap; in ata_sff_dev_classify() local
1752 ap->ops->sff_dev_select(ap, dev->devno); in ata_sff_dev_classify()
1756 ap->ops->sff_tf_read(ap, &tf); in ata_sff_dev_classify()
1773 class = ata_port_classify(ap, &tf); in ata_sff_dev_classify()
1789 if (ap->ops->sff_check_status(ap) == 0) in ata_sff_dev_classify()
1817 struct ata_port *ap = link->ap; in ata_sff_wait_after_reset() local
1818 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_sff_wait_after_reset()
1823 ata_msleep(ap, ATA_WAIT_AFTER_RESET); in ata_sff_wait_after_reset()
1839 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1852 ata_msleep(ap, 50); /* give drive a breather */ in ata_sff_wait_after_reset()
1864 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
1866 ap->ops->sff_dev_select(ap, 1); in ata_sff_wait_after_reset()
1868 ap->ops->sff_dev_select(ap, 0); in ata_sff_wait_after_reset()
1874 static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, in ata_bus_softreset() argument
1877 struct ata_ioports *ioaddr = &ap->ioaddr; in ata_bus_softreset()
1879 if (ap->ioaddr.ctl_addr) { in ata_bus_softreset()
1881 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
1883 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); in ata_bus_softreset()
1885 iowrite8(ap->ctl, ioaddr->ctl_addr); in ata_bus_softreset()
1886 ap->last_ctl = ap->ctl; in ata_bus_softreset()
1890 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); in ata_bus_softreset()
1910 struct ata_port *ap = link->ap; in ata_sff_softreset() local
1911 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; in ata_sff_softreset()
1917 if (ata_devchk(ap, 0)) in ata_sff_softreset()
1919 if (slave_possible && ata_devchk(ap, 1)) in ata_sff_softreset()
1923 ap->ops->sff_dev_select(ap, 0); in ata_sff_softreset()
1926 rc = ata_bus_softreset(ap, devmask, deadline); in ata_sff_softreset()
1990 struct ata_port *ap = link->ap; in ata_sff_postreset() local
1996 ap->ops->sff_dev_select(ap, 1); in ata_sff_postreset()
1998 ap->ops->sff_dev_select(ap, 0); in ata_sff_postreset()
2005 if (ata_sff_set_devctl(ap, ap->ctl)) in ata_sff_postreset()
2006 ap->last_ctl = ap->ctl; in ata_sff_postreset()
2023 struct ata_port *ap; in ata_sff_drain_fifo() local
2029 ap = qc->ap; in ata_sff_drain_fifo()
2031 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) in ata_sff_drain_fifo()
2033 ioread16(ap->ioaddr.data_addr); in ata_sff_drain_fifo()
2036 ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count); in ata_sff_drain_fifo()
2043 * @ap: port to handle error for
2053 void ata_sff_error_handler(struct ata_port *ap) in ata_sff_error_handler() argument
2055 ata_reset_fn_t softreset = ap->ops->softreset; in ata_sff_error_handler()
2056 ata_reset_fn_t hardreset = ap->ops->hardreset; in ata_sff_error_handler()
2060 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_sff_error_handler()
2064 spin_lock_irqsave(ap->lock, flags); in ata_sff_error_handler()
2073 if (ap->ops->sff_drain_fifo) in ata_sff_error_handler()
2074 ap->ops->sff_drain_fifo(qc); in ata_sff_error_handler()
2076 spin_unlock_irqrestore(ap->lock, flags); in ata_sff_error_handler()
2080 hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) in ata_sff_error_handler()
2083 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, in ata_sff_error_handler()
2084 ap->ops->postreset); in ata_sff_error_handler()
2158 struct ata_port *ap = host->ports[i]; in ata_pci_sff_init_host() local
2162 if (ata_port_is_dummy(ap)) in ata_pci_sff_init_host()
2170 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2182 ap->ops = &ata_dummy_port_ops; in ata_pci_sff_init_host()
2187 ap->ioaddr.cmd_addr = iomap[base]; in ata_pci_sff_init_host()
2188 ap->ioaddr.altstatus_addr = in ata_pci_sff_init_host()
2189 ap->ioaddr.ctl_addr = (void __iomem *) in ata_pci_sff_init_host()
2191 ata_sff_std_ports(&ap->ioaddr); in ata_pci_sff_init_host()
2193 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx", in ata_pci_sff_init_host()
2498 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg() local
2499 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg()
2548 struct ata_port *ap = qc->ap; in ata_bmdma_fill_sg_dumb() local
2549 struct ata_bmdma_prd *prd = ap->bmdma_prd; in ata_bmdma_fill_sg_dumb()
2648 struct ata_port *ap = qc->ap; in ata_bmdma_qc_issue() local
2656 ata_dev_select(ap, qc->dev->devno, 1, 0); in ata_bmdma_qc_issue()
2663 trace_ata_tf_load(ap, &qc->tf); in ata_bmdma_qc_issue()
2664 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2665 trace_ata_bmdma_setup(ap, &qc->tf, qc->tag); in ata_bmdma_qc_issue()
2666 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2667 trace_ata_bmdma_start(ap, &qc->tf, qc->tag); in ata_bmdma_qc_issue()
2668 ap->ops->bmdma_start(qc); /* initiate bmdma */ in ata_bmdma_qc_issue()
2669 ap->hsm_task_state = HSM_ST_LAST; in ata_bmdma_qc_issue()
2675 trace_ata_tf_load(ap, &qc->tf); in ata_bmdma_qc_issue()
2676 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ in ata_bmdma_qc_issue()
2677 trace_ata_bmdma_setup(ap, &qc->tf, qc->tag); in ata_bmdma_qc_issue()
2678 ap->ops->bmdma_setup(qc); /* set up bmdma */ in ata_bmdma_qc_issue()
2679 ap->hsm_task_state = HSM_ST_FIRST; in ata_bmdma_qc_issue()
2697 * @ap: Port on which interrupt arrived (possibly...)
2708 unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) in ata_bmdma_port_intr() argument
2710 struct ata_eh_info *ehi = &ap->link.eh_info; in ata_bmdma_port_intr()
2715 if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) { in ata_bmdma_port_intr()
2717 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_port_intr()
2718 trace_ata_bmdma_status(ap, host_stat); in ata_bmdma_port_intr()
2722 return ata_sff_idle_irq(ap); in ata_bmdma_port_intr()
2725 trace_ata_bmdma_stop(ap, &qc->tf, qc->tag); in ata_bmdma_port_intr()
2726 ap->ops->bmdma_stop(qc); in ata_bmdma_port_intr()
2732 ap->hsm_task_state = HSM_ST_ERR; in ata_bmdma_port_intr()
2736 handled = __ata_sff_port_intr(ap, qc, bmdma_stopped); in ata_bmdma_port_intr()
2767 * @ap: port to handle error for
2777 void ata_bmdma_error_handler(struct ata_port *ap) in ata_bmdma_error_handler() argument
2783 qc = __ata_qc_from_tag(ap, ap->link.active_tag); in ata_bmdma_error_handler()
2788 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_error_handler()
2793 host_stat = ap->ops->bmdma_status(ap); in ata_bmdma_error_handler()
2794 trace_ata_bmdma_status(ap, host_stat); in ata_bmdma_error_handler()
2806 trace_ata_bmdma_stop(ap, &qc->tf, qc->tag); in ata_bmdma_error_handler()
2807 ap->ops->bmdma_stop(qc); in ata_bmdma_error_handler()
2811 ap->ops->sff_check_status(ap); in ata_bmdma_error_handler()
2812 if (ap->ops->sff_irq_clear) in ata_bmdma_error_handler()
2813 ap->ops->sff_irq_clear(ap); in ata_bmdma_error_handler()
2817 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_error_handler()
2820 ata_eh_thaw_port(ap); in ata_bmdma_error_handler()
2822 ata_sff_error_handler(ap); in ata_bmdma_error_handler()
2835 struct ata_port *ap = qc->ap; in ata_bmdma_post_internal_cmd() local
2839 spin_lock_irqsave(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2840 trace_ata_bmdma_stop(ap, &qc->tf, qc->tag); in ata_bmdma_post_internal_cmd()
2841 ap->ops->bmdma_stop(qc); in ata_bmdma_post_internal_cmd()
2842 spin_unlock_irqrestore(ap->lock, flags); in ata_bmdma_post_internal_cmd()
2849 * @ap: Port associated with this ATA transaction.
2858 void ata_bmdma_irq_clear(struct ata_port *ap) in ata_bmdma_irq_clear() argument
2860 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_irq_clear()
2878 struct ata_port *ap = qc->ap; in ata_bmdma_setup() local
2884 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); in ata_bmdma_setup()
2887 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
2891 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_setup()
2894 ap->ops->sff_exec_command(ap, &qc->tf); in ata_bmdma_setup()
2907 struct ata_port *ap = qc->ap; in ata_bmdma_start() local
2911 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
2912 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ata_bmdma_start()
2944 struct ata_port *ap = qc->ap; in ata_bmdma_stop() local
2945 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ata_bmdma_stop()
2952 ata_sff_dma_pause(ap); in ata_bmdma_stop()
2958 * @ap: Port associated with this ATA transaction.
2967 u8 ata_bmdma_status(struct ata_port *ap) in ata_bmdma_status() argument
2969 return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); in ata_bmdma_status()
2976 * @ap: Port to initialize
2986 int ata_bmdma_port_start(struct ata_port *ap) in ata_bmdma_port_start() argument
2988 if (ap->mwdma_mask || ap->udma_mask) { in ata_bmdma_port_start()
2989 ap->bmdma_prd = in ata_bmdma_port_start()
2990 dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ, in ata_bmdma_port_start()
2991 &ap->bmdma_prd_dma, GFP_KERNEL); in ata_bmdma_port_start()
2992 if (!ap->bmdma_prd) in ata_bmdma_port_start()
3002 * @ap: Port to initialize
3014 int ata_bmdma_port_start32(struct ata_port *ap) in ata_bmdma_port_start32() argument
3016 ap->pflags |= ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE; in ata_bmdma_port_start32()
3017 return ata_bmdma_port_start(ap); in ata_bmdma_port_start32()
3105 struct ata_port *ap = host->ports[i]; in ata_pci_bmdma_init() local
3108 if (ata_port_is_dummy(ap)) in ata_pci_bmdma_init()
3111 ap->ioaddr.bmdma_addr = bmdma; in ata_pci_bmdma_init()
3112 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) && in ata_pci_bmdma_init()
3116 ata_port_desc(ap, "bmdma 0x%llx", in ata_pci_bmdma_init()
3183 * @ap: Port to initialize
3191 void ata_sff_port_init(struct ata_port *ap) in ata_sff_port_init() argument
3193 INIT_DELAYED_WORK(&ap->sff_pio_task, ata_sff_pio_task); in ata_sff_port_init()
3194 ap->ctl = ATA_DEVCTL_OBS; in ata_sff_port_init()
3195 ap->last_ctl = 0xFF; in ata_sff_port_init()