aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pretzel.yyz.us>2005-06-22 13:07:28 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-22 13:07:28 -0400
commitff40c6d3d1437ecdf295b8e39adcb06c3d6021ef (patch)
tree3666d029b4bd4df2909dbefd9c7a09e6042b7d32 /include/linux/libata.h
parent8bf62ecee58360749c5f0e68bc97d5e02a6816b1 (diff)
parent2a5a68b840cbab31baab2d9b2e1e6de3b289ae1e (diff)
Merge upstream kernel changes into 'C/H/S support' branch of libata.
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bd0df84cfd87..973090be7fc4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -416,6 +416,7 @@ extern u8 ata_chk_err(struct ata_port *ap);
416extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); 416extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);
417extern int ata_port_start (struct ata_port *ap); 417extern int ata_port_start (struct ata_port *ap);
418extern void ata_port_stop (struct ata_port *ap); 418extern void ata_port_stop (struct ata_port *ap);
419extern void ata_host_stop (struct ata_host_set *host_set);
419extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 420extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
420extern void ata_qc_prep(struct ata_queued_cmd *qc); 421extern void ata_qc_prep(struct ata_queued_cmd *qc);
421extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); 422extern int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -426,6 +427,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
426extern unsigned int ata_dev_classify(struct ata_taskfile *tf); 427extern unsigned int ata_dev_classify(struct ata_taskfile *tf);
427extern void ata_dev_id_string(u16 *id, unsigned char *s, 428extern void ata_dev_id_string(u16 *id, unsigned char *s,
428 unsigned int ofs, unsigned int len); 429 unsigned int ofs, unsigned int len);
430extern void ata_dev_config(struct ata_port *ap, unsigned int i);
429extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 431extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
430extern void ata_bmdma_start (struct ata_queued_cmd *qc); 432extern void ata_bmdma_start (struct ata_queued_cmd *qc);
431extern void ata_bmdma_stop(struct ata_port *ap); 433extern void ata_bmdma_stop(struct ata_port *ap);
@@ -472,12 +474,34 @@ static inline u8 ata_chk_status(struct ata_port *ap)
472 return ap->ops->check_status(ap); 474 return ap->ops->check_status(ap);
473} 475}
474 476
477
478/**
479 * ata_pause - Flush writes and pause 400 nanoseconds.
480 * @ap: Port to wait for.
481 *
482 * LOCKING:
483 * Inherited from caller.
484 */
485
475static inline void ata_pause(struct ata_port *ap) 486static inline void ata_pause(struct ata_port *ap)
476{ 487{
477 ata_altstatus(ap); 488 ata_altstatus(ap);
478 ndelay(400); 489 ndelay(400);
479} 490}
480 491
492
493/**
494 * ata_busy_wait - Wait for a port status register
495 * @ap: Port to wait for.
496 *
497 * Waits up to max*10 microseconds for the selected bits in the port's
498 * status register to be cleared.
499 * Returns final value of status register.
500 *
501 * LOCKING:
502 * Inherited from caller.
503 */
504
481static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, 505static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
482 unsigned int max) 506 unsigned int max)
483{ 507{
@@ -492,6 +516,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
492 return status; 516 return status;
493} 517}
494 518
519
520/**
521 * ata_wait_idle - Wait for a port to be idle.
522 * @ap: Port to wait for.
523 *
524 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
525 * Returns final value of status register.
526 *
527 * LOCKING:
528 * Inherited from caller.
529 */
530
495static inline u8 ata_wait_idle(struct ata_port *ap) 531static inline u8 ata_wait_idle(struct ata_port *ap)
496{ 532{
497 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 533 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
@@ -530,6 +566,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns
530 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 566 tf->device = ATA_DEVICE_OBS | ATA_DEV1;
531} 567}
532 568
569
570/**
571 * ata_irq_on - Enable interrupts on a port.
572 * @ap: Port on which interrupts are enabled.
573 *
574 * Enable interrupts on a legacy IDE device using MMIO or PIO,
575 * wait for idle, clear any pending interrupts.
576 *
577 * LOCKING:
578 * Inherited from caller.
579 */
580
533static inline u8 ata_irq_on(struct ata_port *ap) 581static inline u8 ata_irq_on(struct ata_port *ap)
534{ 582{
535 struct ata_ioports *ioaddr = &ap->ioaddr; 583 struct ata_ioports *ioaddr = &ap->ioaddr;
@@ -549,6 +597,18 @@ static inline u8 ata_irq_on(struct ata_port *ap)
549 return tmp; 597 return tmp;
550} 598}
551 599
600
601/**
602 * ata_irq_ack - Acknowledge a device interrupt.
603 * @ap: Port on which interrupts are enabled.
604 *
605 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
606 * or BUSY+DRQ clear). Obtain dma status and port status from
607 * device. Clear the interrupt. Return port status.
608 *
609 * LOCKING:
610 */
611
552static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 612static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
553{ 613{
554 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; 614 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
@@ -590,6 +650,13 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val)
590 ap->ops->scr_write(ap, reg, val); 650 ap->ops->scr_write(ap, reg, val);
591} 651}
592 652
653static inline void scr_write_flush(struct ata_port *ap, unsigned int reg,
654 u32 val)
655{
656 ap->ops->scr_write(ap, reg, val);
657 (void) ap->ops->scr_read(ap, reg);
658}
659
593static inline unsigned int sata_dev_present(struct ata_port *ap) 660static inline unsigned int sata_dev_present(struct ata_port *ap)
594{ 661{
595 return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; 662 return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0;