diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 1f7e2039a04e..ad410590664f 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -466,12 +466,34 @@ static inline u8 ata_chk_status(struct ata_port *ap) | |||
466 | return ap->ops->check_status(ap); | 466 | return ap->ops->check_status(ap); |
467 | } | 467 | } |
468 | 468 | ||
469 | |||
470 | /** | ||
471 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
472 | * @ap: Port to wait for. | ||
473 | * | ||
474 | * LOCKING: | ||
475 | * Inherited from caller. | ||
476 | */ | ||
477 | |||
469 | static inline void ata_pause(struct ata_port *ap) | 478 | static inline void ata_pause(struct ata_port *ap) |
470 | { | 479 | { |
471 | ata_altstatus(ap); | 480 | ata_altstatus(ap); |
472 | ndelay(400); | 481 | ndelay(400); |
473 | } | 482 | } |
474 | 483 | ||
484 | |||
485 | /** | ||
486 | * ata_busy_wait - Wait for a port status register | ||
487 | * @ap: Port to wait for. | ||
488 | * | ||
489 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
490 | * status register to be cleared. | ||
491 | * Returns final value of status register. | ||
492 | * | ||
493 | * LOCKING: | ||
494 | * Inherited from caller. | ||
495 | */ | ||
496 | |||
475 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | 497 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, |
476 | unsigned int max) | 498 | unsigned int max) |
477 | { | 499 | { |
@@ -486,6 +508,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | |||
486 | return status; | 508 | return status; |
487 | } | 509 | } |
488 | 510 | ||
511 | |||
512 | /** | ||
513 | * ata_wait_idle - Wait for a port to be idle. | ||
514 | * @ap: Port to wait for. | ||
515 | * | ||
516 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
517 | * Returns final value of status register. | ||
518 | * | ||
519 | * LOCKING: | ||
520 | * Inherited from caller. | ||
521 | */ | ||
522 | |||
489 | static inline u8 ata_wait_idle(struct ata_port *ap) | 523 | static inline u8 ata_wait_idle(struct ata_port *ap) |
490 | { | 524 | { |
491 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 525 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
@@ -524,6 +558,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns | |||
524 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; | 558 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; |
525 | } | 559 | } |
526 | 560 | ||
561 | |||
562 | /** | ||
563 | * ata_irq_on - Enable interrupts on a port. | ||
564 | * @ap: Port on which interrupts are enabled. | ||
565 | * | ||
566 | * Enable interrupts on a legacy IDE device using MMIO or PIO, | ||
567 | * wait for idle, clear any pending interrupts. | ||
568 | * | ||
569 | * LOCKING: | ||
570 | * Inherited from caller. | ||
571 | */ | ||
572 | |||
527 | static inline u8 ata_irq_on(struct ata_port *ap) | 573 | static inline u8 ata_irq_on(struct ata_port *ap) |
528 | { | 574 | { |
529 | struct ata_ioports *ioaddr = &ap->ioaddr; | 575 | struct ata_ioports *ioaddr = &ap->ioaddr; |
@@ -543,6 +589,18 @@ static inline u8 ata_irq_on(struct ata_port *ap) | |||
543 | return tmp; | 589 | return tmp; |
544 | } | 590 | } |
545 | 591 | ||
592 | |||
593 | /** | ||
594 | * ata_irq_ack - Acknowledge a device interrupt. | ||
595 | * @ap: Port on which interrupts are enabled. | ||
596 | * | ||
597 | * Wait up to 10 ms for legacy IDE device to become idle (BUSY | ||
598 | * or BUSY+DRQ clear). Obtain dma status and port status from | ||
599 | * device. Clear the interrupt. Return port status. | ||
600 | * | ||
601 | * LOCKING: | ||
602 | */ | ||
603 | |||
546 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 604 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
547 | { | 605 | { |
548 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 606 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |