diff options
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index e74f301e9bae..6cd9ba63563b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -421,6 +421,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | |||
| 421 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); | 421 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); |
| 422 | extern void ata_dev_id_string(u16 *id, unsigned char *s, | 422 | extern void ata_dev_id_string(u16 *id, unsigned char *s, |
| 423 | unsigned int ofs, unsigned int len); | 423 | unsigned int ofs, unsigned int len); |
| 424 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | ||
| 424 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 425 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
| 425 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 426 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
| 426 | extern void ata_bmdma_stop(struct ata_port *ap); | 427 | extern void ata_bmdma_stop(struct ata_port *ap); |
| @@ -467,12 +468,34 @@ static inline u8 ata_chk_status(struct ata_port *ap) | |||
| 467 | return ap->ops->check_status(ap); | 468 | return ap->ops->check_status(ap); |
| 468 | } | 469 | } |
| 469 | 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 | |||
| 470 | static inline void ata_pause(struct ata_port *ap) | 480 | static inline void ata_pause(struct ata_port *ap) |
| 471 | { | 481 | { |
| 472 | ata_altstatus(ap); | 482 | ata_altstatus(ap); |
| 473 | ndelay(400); | 483 | ndelay(400); |
| 474 | } | 484 | } |
| 475 | 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 | |||
| 476 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | 499 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, |
| 477 | unsigned int max) | 500 | unsigned int max) |
| 478 | { | 501 | { |
| @@ -487,6 +510,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | |||
| 487 | return status; | 510 | return status; |
| 488 | } | 511 | } |
| 489 | 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 | |||
| 490 | static inline u8 ata_wait_idle(struct ata_port *ap) | 525 | static inline u8 ata_wait_idle(struct ata_port *ap) |
| 491 | { | 526 | { |
| 492 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 527 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
| @@ -525,6 +560,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns | |||
| 525 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; | 560 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; |
| 526 | } | 561 | } |
| 527 | 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 | |||
| 528 | static inline u8 ata_irq_on(struct ata_port *ap) | 575 | static inline u8 ata_irq_on(struct ata_port *ap) |
| 529 | { | 576 | { |
| 530 | struct ata_ioports *ioaddr = &ap->ioaddr; | 577 | struct ata_ioports *ioaddr = &ap->ioaddr; |
| @@ -544,6 +591,18 @@ static inline u8 ata_irq_on(struct ata_port *ap) | |||
| 544 | return tmp; | 591 | return tmp; |
| 545 | } | 592 | } |
| 546 | 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 | |||
| 547 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 606 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
| 548 | { | 607 | { |
| 549 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 608 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |
