aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1f7e2039a04e..6cd9ba63563b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -410,6 +410,7 @@ extern u8 ata_chk_err(struct ata_port *ap);
410extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); 410extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);
411extern int ata_port_start (struct ata_port *ap); 411extern int ata_port_start (struct ata_port *ap);
412extern void ata_port_stop (struct ata_port *ap); 412extern void ata_port_stop (struct ata_port *ap);
413extern void ata_host_stop (struct ata_host_set *host_set);
413extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 414extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
414extern void ata_qc_prep(struct ata_queued_cmd *qc); 415extern void ata_qc_prep(struct ata_queued_cmd *qc);
415extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); 416extern int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -420,6 +421,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
420extern unsigned int ata_dev_classify(struct ata_taskfile *tf); 421extern unsigned int ata_dev_classify(struct ata_taskfile *tf);
421extern void ata_dev_id_string(u16 *id, unsigned char *s, 422extern void ata_dev_id_string(u16 *id, unsigned char *s,
422 unsigned int ofs, unsigned int len); 423 unsigned int ofs, unsigned int len);
424extern void ata_dev_config(struct ata_port *ap, unsigned int i);
423extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 425extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
424extern void ata_bmdma_start (struct ata_queued_cmd *qc); 426extern void ata_bmdma_start (struct ata_queued_cmd *qc);
425extern void ata_bmdma_stop(struct ata_port *ap); 427extern void ata_bmdma_stop(struct ata_port *ap);
@@ -466,12 +468,34 @@ static inline u8 ata_chk_status(struct ata_port *ap)
466 return ap->ops->check_status(ap); 468 return ap->ops->check_status(ap);
467} 469}
468 470
471
472/**
473 * ata_pause - Flush writes and pause 400 nanoseconds.
474 * @ap: Port to wait for.
475 *
476 * LOCKING:
477 * Inherited from caller.
478 */
479
469static inline void ata_pause(struct ata_port *ap) 480static inline void ata_pause(struct ata_port *ap)
470{ 481{
471 ata_altstatus(ap); 482 ata_altstatus(ap);
472 ndelay(400); 483 ndelay(400);
473} 484}
474 485
486
487/**
488 * ata_busy_wait - Wait for a port status register
489 * @ap: Port to wait for.
490 *
491 * Waits up to max*10 microseconds for the selected bits in the port's
492 * status register to be cleared.
493 * Returns final value of status register.
494 *
495 * LOCKING:
496 * Inherited from caller.
497 */
498
475static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, 499static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
476 unsigned int max) 500 unsigned int max)
477{ 501{
@@ -486,6 +510,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
486 return status; 510 return status;
487} 511}
488 512
513
514/**
515 * ata_wait_idle - Wait for a port to be idle.
516 * @ap: Port to wait for.
517 *
518 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
519 * Returns final value of status register.
520 *
521 * LOCKING:
522 * Inherited from caller.
523 */
524
489static inline u8 ata_wait_idle(struct ata_port *ap) 525static inline u8 ata_wait_idle(struct ata_port *ap)
490{ 526{
491 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 527 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
@@ -524,6 +560,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns
524 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 560 tf->device = ATA_DEVICE_OBS | ATA_DEV1;
525} 561}
526 562
563
564/**
565 * ata_irq_on - Enable interrupts on a port.
566 * @ap: Port on which interrupts are enabled.
567 *
568 * Enable interrupts on a legacy IDE device using MMIO or PIO,
569 * wait for idle, clear any pending interrupts.
570 *
571 * LOCKING:
572 * Inherited from caller.
573 */
574
527static inline u8 ata_irq_on(struct ata_port *ap) 575static inline u8 ata_irq_on(struct ata_port *ap)
528{ 576{
529 struct ata_ioports *ioaddr = &ap->ioaddr; 577 struct ata_ioports *ioaddr = &ap->ioaddr;
@@ -543,6 +591,18 @@ static inline u8 ata_irq_on(struct ata_port *ap)
543 return tmp; 591 return tmp;
544} 592}
545 593
594
595/**
596 * ata_irq_ack - Acknowledge a device interrupt.
597 * @ap: Port on which interrupts are enabled.
598 *
599 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
600 * or BUSY+DRQ clear). Obtain dma status and port status from
601 * device. Clear the interrupt. Return port status.
602 *
603 * LOCKING:
604 */
605
546static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 606static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
547{ 607{
548 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; 608 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;