diff options
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 505160ab472b..b009f801e7c5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -410,6 +410,7 @@ extern u8 ata_chk_err(struct ata_port *ap); | |||
| 410 | extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); | 410 | extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); |
| 411 | extern int ata_port_start (struct ata_port *ap); | 411 | extern int ata_port_start (struct ata_port *ap); |
| 412 | extern void ata_port_stop (struct ata_port *ap); | 412 | extern void ata_port_stop (struct ata_port *ap); |
| 413 | extern void ata_host_stop (struct ata_host_set *host_set); | ||
| 413 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 414 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
| 414 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | 415 | extern void ata_qc_prep(struct ata_queued_cmd *qc); |
| 415 | extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); | 416 | extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); |
| @@ -466,12 +467,34 @@ static inline u8 ata_chk_status(struct ata_port *ap) | |||
| 466 | return ap->ops->check_status(ap); | 467 | return ap->ops->check_status(ap); |
| 467 | } | 468 | } |
| 468 | 469 | ||
| 470 | |||
| 471 | /** | ||
| 472 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
| 473 | * @ap: Port to wait for. | ||
| 474 | * | ||
| 475 | * LOCKING: | ||
| 476 | * Inherited from caller. | ||
| 477 | */ | ||
| 478 | |||
| 469 | static inline void ata_pause(struct ata_port *ap) | 479 | static inline void ata_pause(struct ata_port *ap) |
| 470 | { | 480 | { |
| 471 | ata_altstatus(ap); | 481 | ata_altstatus(ap); |
| 472 | ndelay(400); | 482 | ndelay(400); |
| 473 | } | 483 | } |
| 474 | 484 | ||
| 485 | |||
| 486 | /** | ||
| 487 | * ata_busy_wait - Wait for a port status register | ||
| 488 | * @ap: Port to wait for. | ||
| 489 | * | ||
| 490 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
| 491 | * status register to be cleared. | ||
| 492 | * Returns final value of status register. | ||
| 493 | * | ||
| 494 | * LOCKING: | ||
| 495 | * Inherited from caller. | ||
| 496 | */ | ||
| 497 | |||
| 475 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | 498 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, |
| 476 | unsigned int max) | 499 | unsigned int max) |
| 477 | { | 500 | { |
| @@ -486,6 +509,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | |||
| 486 | return status; | 509 | return status; |
| 487 | } | 510 | } |
| 488 | 511 | ||
| 512 | |||
| 513 | /** | ||
| 514 | * ata_wait_idle - Wait for a port to be idle. | ||
| 515 | * @ap: Port to wait for. | ||
| 516 | * | ||
| 517 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
| 518 | * Returns final value of status register. | ||
| 519 | * | ||
| 520 | * LOCKING: | ||
| 521 | * Inherited from caller. | ||
| 522 | */ | ||
| 523 | |||
| 489 | static inline u8 ata_wait_idle(struct ata_port *ap) | 524 | static inline u8 ata_wait_idle(struct ata_port *ap) |
| 490 | { | 525 | { |
| 491 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 526 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
| @@ -524,6 +559,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns | |||
| 524 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; | 559 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; |
| 525 | } | 560 | } |
| 526 | 561 | ||
| 562 | |||
| 563 | /** | ||
| 564 | * ata_irq_on - Enable interrupts on a port. | ||
| 565 | * @ap: Port on which interrupts are enabled. | ||
| 566 | * | ||
| 567 | * Enable interrupts on a legacy IDE device using MMIO or PIO, | ||
| 568 | * wait for idle, clear any pending interrupts. | ||
| 569 | * | ||
| 570 | * LOCKING: | ||
| 571 | * Inherited from caller. | ||
| 572 | */ | ||
| 573 | |||
| 527 | static inline u8 ata_irq_on(struct ata_port *ap) | 574 | static inline u8 ata_irq_on(struct ata_port *ap) |
| 528 | { | 575 | { |
| 529 | struct ata_ioports *ioaddr = &ap->ioaddr; | 576 | struct ata_ioports *ioaddr = &ap->ioaddr; |
| @@ -543,6 +590,18 @@ static inline u8 ata_irq_on(struct ata_port *ap) | |||
| 543 | return tmp; | 590 | return tmp; |
| 544 | } | 591 | } |
| 545 | 592 | ||
| 593 | |||
| 594 | /** | ||
| 595 | * ata_irq_ack - Acknowledge a device interrupt. | ||
| 596 | * @ap: Port on which interrupts are enabled. | ||
| 597 | * | ||
| 598 | * Wait up to 10 ms for legacy IDE device to become idle (BUSY | ||
| 599 | * or BUSY+DRQ clear). Obtain dma status and port status from | ||
| 600 | * device. Clear the interrupt. Return port status. | ||
| 601 | * | ||
| 602 | * LOCKING: | ||
| 603 | */ | ||
| 604 | |||
| 546 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 605 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
| 547 | { | 606 | { |
| 548 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 607 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |
| @@ -584,6 +643,13 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val) | |||
| 584 | ap->ops->scr_write(ap, reg, val); | 643 | ap->ops->scr_write(ap, reg, val); |
| 585 | } | 644 | } |
| 586 | 645 | ||
| 646 | static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, | ||
| 647 | u32 val) | ||
| 648 | { | ||
| 649 | ap->ops->scr_write(ap, reg, val); | ||
| 650 | (void) ap->ops->scr_read(ap, reg); | ||
| 651 | } | ||
| 652 | |||
| 587 | static inline unsigned int sata_dev_present(struct ata_port *ap) | 653 | static inline unsigned int sata_dev_present(struct ata_port *ap) |
| 588 | { | 654 | { |
| 589 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; | 655 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; |
