diff options
author | <jgarzik@pretzel.yyz.us> | 2005-06-03 23:54:56 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-03 23:54:56 -0400 |
commit | 73561695b2e77473e353a5ae63bab81ed5098d8e (patch) | |
tree | d039affaa54d38985e41566e4d62e0aa6a170287 /include/linux/libata.h | |
parent | 6f2f38128170814e151cfedf79532e19cd179567 (diff) | |
parent | 8be3de3fd8469154a2b3e18a4712032dac5b4a53 (diff) |
Automatic merge of /spare/repo/linux-2.6/.git branch HEAD
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 d33e70361a7d..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); | |||
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); |
@@ -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; |
@@ -585,6 +644,13 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val) | |||
585 | ap->ops->scr_write(ap, reg, val); | 644 | ap->ops->scr_write(ap, reg, val); |
586 | } | 645 | } |
587 | 646 | ||
647 | static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, | ||
648 | u32 val) | ||
649 | { | ||
650 | ap->ops->scr_write(ap, reg, val); | ||
651 | (void) ap->ops->scr_read(ap, reg); | ||
652 | } | ||
653 | |||
588 | static inline unsigned int sata_dev_present(struct ata_port *ap) | 654 | static inline unsigned int sata_dev_present(struct ata_port *ap) |
589 | { | 655 | { |
590 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; | 656 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; |