diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 63 |
1 files changed, 18 insertions, 45 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 45b6b29bc10f..074a46e5bbdd 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -3527,7 +3527,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
3527 | 3527 | ||
3528 | /** | 3528 | /** |
3529 | * ata_mmio_data_xfer - Transfer data by MMIO | 3529 | * ata_mmio_data_xfer - Transfer data by MMIO |
3530 | * @ap: port to read/write | 3530 | * @dev: device for this I/O |
3531 | * @buf: data buffer | 3531 | * @buf: data buffer |
3532 | * @buflen: buffer length | 3532 | * @buflen: buffer length |
3533 | * @write_data: read/write | 3533 | * @write_data: read/write |
@@ -3538,9 +3538,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
3538 | * Inherited from caller. | 3538 | * Inherited from caller. |
3539 | */ | 3539 | */ |
3540 | 3540 | ||
3541 | static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, | 3541 | void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, |
3542 | unsigned int buflen, int write_data) | 3542 | unsigned int buflen, int write_data) |
3543 | { | 3543 | { |
3544 | struct ata_port *ap = adev->ap; | ||
3544 | unsigned int i; | 3545 | unsigned int i; |
3545 | unsigned int words = buflen >> 1; | 3546 | unsigned int words = buflen >> 1; |
3546 | u16 *buf16 = (u16 *) buf; | 3547 | u16 *buf16 = (u16 *) buf; |
@@ -3572,7 +3573,7 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, | |||
3572 | 3573 | ||
3573 | /** | 3574 | /** |
3574 | * ata_pio_data_xfer - Transfer data by PIO | 3575 | * ata_pio_data_xfer - Transfer data by PIO |
3575 | * @ap: port to read/write | 3576 | * @adev: device to target |
3576 | * @buf: data buffer | 3577 | * @buf: data buffer |
3577 | * @buflen: buffer length | 3578 | * @buflen: buffer length |
3578 | * @write_data: read/write | 3579 | * @write_data: read/write |
@@ -3583,9 +3584,10 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, | |||
3583 | * Inherited from caller. | 3584 | * Inherited from caller. |
3584 | */ | 3585 | */ |
3585 | 3586 | ||
3586 | static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, | 3587 | void ata_pio_data_xfer(struct ata_device *adev, unsigned char *buf, |
3587 | unsigned int buflen, int write_data) | 3588 | unsigned int buflen, int write_data) |
3588 | { | 3589 | { |
3590 | struct ata_port *ap = adev->ap; | ||
3589 | unsigned int words = buflen >> 1; | 3591 | unsigned int words = buflen >> 1; |
3590 | 3592 | ||
3591 | /* Transfer multiple of 2 bytes */ | 3593 | /* Transfer multiple of 2 bytes */ |
@@ -3610,39 +3612,6 @@ static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, | |||
3610 | } | 3612 | } |
3611 | 3613 | ||
3612 | /** | 3614 | /** |
3613 | * ata_data_xfer - Transfer data from/to the data register. | ||
3614 | * @ap: port to read/write | ||
3615 | * @buf: data buffer | ||
3616 | * @buflen: buffer length | ||
3617 | * @do_write: read/write | ||
3618 | * | ||
3619 | * Transfer data from/to the device data register. | ||
3620 | * | ||
3621 | * LOCKING: | ||
3622 | * Inherited from caller. | ||
3623 | */ | ||
3624 | |||
3625 | static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, | ||
3626 | unsigned int buflen, int do_write) | ||
3627 | { | ||
3628 | /* Make the crap hardware pay the costs not the good stuff */ | ||
3629 | if (unlikely(ap->flags & ATA_FLAG_IRQ_MASK)) { | ||
3630 | unsigned long flags; | ||
3631 | local_irq_save(flags); | ||
3632 | if (ap->flags & ATA_FLAG_MMIO) | ||
3633 | ata_mmio_data_xfer(ap, buf, buflen, do_write); | ||
3634 | else | ||
3635 | ata_pio_data_xfer(ap, buf, buflen, do_write); | ||
3636 | local_irq_restore(flags); | ||
3637 | } else { | ||
3638 | if (ap->flags & ATA_FLAG_MMIO) | ||
3639 | ata_mmio_data_xfer(ap, buf, buflen, do_write); | ||
3640 | else | ||
3641 | ata_pio_data_xfer(ap, buf, buflen, do_write); | ||
3642 | } | ||
3643 | } | ||
3644 | |||
3645 | /** | ||
3646 | * ata_pio_sector - Transfer ATA_SECT_SIZE (512 bytes) of data. | 3615 | * ata_pio_sector - Transfer ATA_SECT_SIZE (512 bytes) of data. |
3647 | * @qc: Command on going | 3616 | * @qc: Command on going |
3648 | * | 3617 | * |
@@ -3676,17 +3645,18 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
3676 | if (PageHighMem(page)) { | 3645 | if (PageHighMem(page)) { |
3677 | unsigned long flags; | 3646 | unsigned long flags; |
3678 | 3647 | ||
3648 | /* FIXME: use a bounce buffer */ | ||
3679 | local_irq_save(flags); | 3649 | local_irq_save(flags); |
3680 | buf = kmap_atomic(page, KM_IRQ0); | 3650 | buf = kmap_atomic(page, KM_IRQ0); |
3681 | 3651 | ||
3682 | /* do the actual data transfer */ | 3652 | /* do the actual data transfer */ |
3683 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | 3653 | ap->ops->data_xfer(qc->dev, buf + offset, ATA_SECT_SIZE, do_write); |
3684 | 3654 | ||
3685 | kunmap_atomic(buf, KM_IRQ0); | 3655 | kunmap_atomic(buf, KM_IRQ0); |
3686 | local_irq_restore(flags); | 3656 | local_irq_restore(flags); |
3687 | } else { | 3657 | } else { |
3688 | buf = page_address(page); | 3658 | buf = page_address(page); |
3689 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | 3659 | ap->ops->data_xfer(qc->dev, buf + offset, ATA_SECT_SIZE, do_write); |
3690 | } | 3660 | } |
3691 | 3661 | ||
3692 | qc->cursect++; | 3662 | qc->cursect++; |
@@ -3742,7 +3712,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
3742 | DPRINTK("send cdb\n"); | 3712 | DPRINTK("send cdb\n"); |
3743 | WARN_ON(qc->dev->cdb_len < 12); | 3713 | WARN_ON(qc->dev->cdb_len < 12); |
3744 | 3714 | ||
3745 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); | 3715 | ap->ops->data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); |
3746 | ata_altstatus(ap); /* flush */ | 3716 | ata_altstatus(ap); /* flush */ |
3747 | 3717 | ||
3748 | switch (qc->tf.protocol) { | 3718 | switch (qc->tf.protocol) { |
@@ -3802,7 +3772,7 @@ next_sg: | |||
3802 | "%u bytes trailing data\n", bytes); | 3772 | "%u bytes trailing data\n", bytes); |
3803 | 3773 | ||
3804 | for (i = 0; i < words; i++) | 3774 | for (i = 0; i < words; i++) |
3805 | ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); | 3775 | ap->ops->data_xfer(qc->dev, (unsigned char*)pad_buf, 2, do_write); |
3806 | 3776 | ||
3807 | ap->hsm_task_state = HSM_ST_LAST; | 3777 | ap->hsm_task_state = HSM_ST_LAST; |
3808 | return; | 3778 | return; |
@@ -3828,17 +3798,18 @@ next_sg: | |||
3828 | if (PageHighMem(page)) { | 3798 | if (PageHighMem(page)) { |
3829 | unsigned long flags; | 3799 | unsigned long flags; |
3830 | 3800 | ||
3801 | /* FIXME: use bounce buffer */ | ||
3831 | local_irq_save(flags); | 3802 | local_irq_save(flags); |
3832 | buf = kmap_atomic(page, KM_IRQ0); | 3803 | buf = kmap_atomic(page, KM_IRQ0); |
3833 | 3804 | ||
3834 | /* do the actual data transfer */ | 3805 | /* do the actual data transfer */ |
3835 | ata_data_xfer(ap, buf + offset, count, do_write); | 3806 | ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); |
3836 | 3807 | ||
3837 | kunmap_atomic(buf, KM_IRQ0); | 3808 | kunmap_atomic(buf, KM_IRQ0); |
3838 | local_irq_restore(flags); | 3809 | local_irq_restore(flags); |
3839 | } else { | 3810 | } else { |
3840 | buf = page_address(page); | 3811 | buf = page_address(page); |
3841 | ata_data_xfer(ap, buf + offset, count, do_write); | 3812 | ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); |
3842 | } | 3813 | } |
3843 | 3814 | ||
3844 | bytes -= count; | 3815 | bytes -= count; |
@@ -5702,6 +5673,8 @@ EXPORT_SYMBOL_GPL(ata_port_start); | |||
5702 | EXPORT_SYMBOL_GPL(ata_port_stop); | 5673 | EXPORT_SYMBOL_GPL(ata_port_stop); |
5703 | EXPORT_SYMBOL_GPL(ata_host_stop); | 5674 | EXPORT_SYMBOL_GPL(ata_host_stop); |
5704 | EXPORT_SYMBOL_GPL(ata_interrupt); | 5675 | EXPORT_SYMBOL_GPL(ata_interrupt); |
5676 | EXPORT_SYMBOL_GPL(ata_mmio_data_xfer); | ||
5677 | EXPORT_SYMBOL_GPL(ata_pio_data_xfer); | ||
5705 | EXPORT_SYMBOL_GPL(ata_qc_prep); | 5678 | EXPORT_SYMBOL_GPL(ata_qc_prep); |
5706 | EXPORT_SYMBOL_GPL(ata_noop_qc_prep); | 5679 | EXPORT_SYMBOL_GPL(ata_noop_qc_prep); |
5707 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); | 5680 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); |