aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c63
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_nv.c1
-rw-r--r--drivers/scsi/sata_promise.c2
-rw-r--r--drivers/scsi/sata_qstor.c1
-rw-r--r--drivers/scsi/sata_sil.c1
-rw-r--r--drivers/scsi/sata_sis.c1
-rw-r--r--drivers/scsi/sata_svw.c1
-rw-r--r--drivers/scsi/sata_sx4.c1
-rw-r--r--drivers/scsi/sata_uli.c1
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/sata_vsc.c1
-rw-r--r--include/linux/libata.h6
13 files changed, 37 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
3541static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, 3541void 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
3586static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, 3587void 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
3625static 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);
5702EXPORT_SYMBOL_GPL(ata_port_stop); 5673EXPORT_SYMBOL_GPL(ata_port_stop);
5703EXPORT_SYMBOL_GPL(ata_host_stop); 5674EXPORT_SYMBOL_GPL(ata_host_stop);
5704EXPORT_SYMBOL_GPL(ata_interrupt); 5675EXPORT_SYMBOL_GPL(ata_interrupt);
5676EXPORT_SYMBOL_GPL(ata_mmio_data_xfer);
5677EXPORT_SYMBOL_GPL(ata_pio_data_xfer);
5705EXPORT_SYMBOL_GPL(ata_qc_prep); 5678EXPORT_SYMBOL_GPL(ata_qc_prep);
5706EXPORT_SYMBOL_GPL(ata_noop_qc_prep); 5679EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
5707EXPORT_SYMBOL_GPL(ata_bmdma_setup); 5680EXPORT_SYMBOL_GPL(ata_bmdma_setup);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 691c115ac8e1..bf3529fdea9c 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -406,6 +406,7 @@ static const struct ata_port_operations mv5_ops = {
406 406
407 .qc_prep = mv_qc_prep, 407 .qc_prep = mv_qc_prep,
408 .qc_issue = mv_qc_issue, 408 .qc_issue = mv_qc_issue,
409 .data_xfer = ata_mmio_data_xfer,
409 410
410 .eng_timeout = mv_eng_timeout, 411 .eng_timeout = mv_eng_timeout,
411 412
@@ -433,6 +434,7 @@ static const struct ata_port_operations mv6_ops = {
433 434
434 .qc_prep = mv_qc_prep, 435 .qc_prep = mv_qc_prep,
435 .qc_issue = mv_qc_issue, 436 .qc_issue = mv_qc_issue,
437 .data_xfer = ata_mmio_data_xfer,
436 438
437 .eng_timeout = mv_eng_timeout, 439 .eng_timeout = mv_eng_timeout,
438 440
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 043ff4fd9ba7..d93513ef7412 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -234,6 +234,7 @@ static const struct ata_port_operations nv_ops = {
234 .qc_prep = ata_qc_prep, 234 .qc_prep = ata_qc_prep,
235 .qc_issue = ata_qc_issue_prot, 235 .qc_issue = ata_qc_issue_prot,
236 .eng_timeout = ata_eng_timeout, 236 .eng_timeout = ata_eng_timeout,
237 .data_xfer = ata_pio_data_xfer,
237 .irq_handler = nv_interrupt, 238 .irq_handler = nv_interrupt,
238 .irq_clear = ata_bmdma_irq_clear, 239 .irq_clear = ata_bmdma_irq_clear,
239 .scr_read = nv_scr_read, 240 .scr_read = nv_scr_read,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 285ab0263d91..01111594d09c 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -137,6 +137,7 @@ static const struct ata_port_operations pdc_sata_ops = {
137 .qc_prep = pdc_qc_prep, 137 .qc_prep = pdc_qc_prep,
138 .qc_issue = pdc_qc_issue_prot, 138 .qc_issue = pdc_qc_issue_prot,
139 .eng_timeout = pdc_eng_timeout, 139 .eng_timeout = pdc_eng_timeout,
140 .data_xfer = ata_mmio_data_xfer,
140 .irq_handler = pdc_interrupt, 141 .irq_handler = pdc_interrupt,
141 .irq_clear = pdc_irq_clear, 142 .irq_clear = pdc_irq_clear,
142 143
@@ -159,6 +160,7 @@ static const struct ata_port_operations pdc_pata_ops = {
159 160
160 .qc_prep = pdc_qc_prep, 161 .qc_prep = pdc_qc_prep,
161 .qc_issue = pdc_qc_issue_prot, 162 .qc_issue = pdc_qc_issue_prot,
163 .data_xfer = ata_mmio_data_xfer,
162 .eng_timeout = pdc_eng_timeout, 164 .eng_timeout = pdc_eng_timeout,
163 .irq_handler = pdc_interrupt, 165 .irq_handler = pdc_interrupt,
164 .irq_clear = pdc_irq_clear, 166 .irq_clear = pdc_irq_clear,
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 54283e06070e..68737cadd2d4 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -156,6 +156,7 @@ static const struct ata_port_operations qs_ata_ops = {
156 .phy_reset = qs_phy_reset, 156 .phy_reset = qs_phy_reset,
157 .qc_prep = qs_qc_prep, 157 .qc_prep = qs_qc_prep,
158 .qc_issue = qs_qc_issue, 158 .qc_issue = qs_qc_issue,
159 .data_xfer = ata_mmio_data_xfer,
159 .eng_timeout = qs_eng_timeout, 160 .eng_timeout = qs_eng_timeout,
160 .irq_handler = qs_intr, 161 .irq_handler = qs_intr,
161 .irq_clear = qs_irq_clear, 162 .irq_clear = qs_irq_clear,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index aa63044eed2e..3bd807738698 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -176,6 +176,7 @@ static const struct ata_port_operations sil_ops = {
176 .bmdma_status = ata_bmdma_status, 176 .bmdma_status = ata_bmdma_status,
177 .qc_prep = ata_qc_prep, 177 .qc_prep = ata_qc_prep,
178 .qc_issue = ata_qc_issue_prot, 178 .qc_issue = ata_qc_issue_prot,
179 .data_xfer = ata_mmio_data_xfer,
179 .freeze = sil_freeze, 180 .freeze = sil_freeze,
180 .thaw = sil_thaw, 181 .thaw = sil_thaw,
181 .error_handler = ata_bmdma_error_handler, 182 .error_handler = ata_bmdma_error_handler,
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 3097821688dc..82a07bff7e91 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -113,6 +113,7 @@ static const struct ata_port_operations sis_ops = {
113 .bmdma_status = ata_bmdma_status, 113 .bmdma_status = ata_bmdma_status,
114 .qc_prep = ata_qc_prep, 114 .qc_prep = ata_qc_prep,
115 .qc_issue = ata_qc_issue_prot, 115 .qc_issue = ata_qc_issue_prot,
116 .data_xfer = ata_pio_data_xfer,
116 .eng_timeout = ata_eng_timeout, 117 .eng_timeout = ata_eng_timeout,
117 .irq_handler = ata_interrupt, 118 .irq_handler = ata_interrupt,
118 .irq_clear = ata_bmdma_irq_clear, 119 .irq_clear = ata_bmdma_irq_clear,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index d5eb5375e265..7a4703bfa12a 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -320,6 +320,7 @@ static const struct ata_port_operations k2_sata_ops = {
320 .bmdma_status = ata_bmdma_status, 320 .bmdma_status = ata_bmdma_status,
321 .qc_prep = ata_qc_prep, 321 .qc_prep = ata_qc_prep,
322 .qc_issue = ata_qc_issue_prot, 322 .qc_issue = ata_qc_issue_prot,
323 .data_xfer = ata_mmio_data_xfer,
323 .eng_timeout = ata_eng_timeout, 324 .eng_timeout = ata_eng_timeout,
324 .irq_handler = ata_interrupt, 325 .irq_handler = ata_interrupt,
325 .irq_clear = ata_bmdma_irq_clear, 326 .irq_clear = ata_bmdma_irq_clear,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index e799ef35e9db..c4db6bf14a25 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -204,6 +204,7 @@ static const struct ata_port_operations pdc_20621_ops = {
204 .phy_reset = pdc_20621_phy_reset, 204 .phy_reset = pdc_20621_phy_reset,
205 .qc_prep = pdc20621_qc_prep, 205 .qc_prep = pdc20621_qc_prep,
206 .qc_issue = pdc20621_qc_issue_prot, 206 .qc_issue = pdc20621_qc_issue_prot,
207 .data_xfer = ata_mmio_data_xfer,
207 .eng_timeout = pdc_eng_timeout, 208 .eng_timeout = pdc_eng_timeout,
208 .irq_handler = pdc20621_interrupt, 209 .irq_handler = pdc20621_interrupt,
209 .irq_clear = pdc20621_irq_clear, 210 .irq_clear = pdc20621_irq_clear,
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 15f81bfc30f0..7fae3e06e461 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -110,6 +110,7 @@ static const struct ata_port_operations uli_ops = {
110 .bmdma_status = ata_bmdma_status, 110 .bmdma_status = ata_bmdma_status,
111 .qc_prep = ata_qc_prep, 111 .qc_prep = ata_qc_prep,
112 .qc_issue = ata_qc_issue_prot, 112 .qc_issue = ata_qc_issue_prot,
113 .data_xfer = ata_pio_data_xfer,
113 114
114 .eng_timeout = ata_eng_timeout, 115 .eng_timeout = ata_eng_timeout,
115 116
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 17aefab5f42f..1c9e2f36805a 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -124,6 +124,7 @@ static const struct ata_port_operations svia_sata_ops = {
124 124
125 .qc_prep = ata_qc_prep, 125 .qc_prep = ata_qc_prep,
126 .qc_issue = ata_qc_issue_prot, 126 .qc_issue = ata_qc_issue_prot,
127 .data_xfer = ata_pio_data_xfer,
127 128
128 .eng_timeout = ata_eng_timeout, 129 .eng_timeout = ata_eng_timeout,
129 130
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 0372be7ff1c9..438e7c6a0f8f 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -297,6 +297,7 @@ static const struct ata_port_operations vsc_sata_ops = {
297 .bmdma_status = ata_bmdma_status, 297 .bmdma_status = ata_bmdma_status,
298 .qc_prep = ata_qc_prep, 298 .qc_prep = ata_qc_prep,
299 .qc_issue = ata_qc_issue_prot, 299 .qc_issue = ata_qc_issue_prot,
300 .data_xfer = ata_pio_data_xfer,
300 .eng_timeout = ata_eng_timeout, 301 .eng_timeout = ata_eng_timeout,
301 .irq_handler = vsc_sata_interrupt, 302 .irq_handler = vsc_sata_interrupt,
302 .irq_clear = ata_bmdma_irq_clear, 303 .irq_clear = ata_bmdma_irq_clear,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c51502c047a4..25a6bf181599 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -525,6 +525,8 @@ struct ata_port_operations {
525 void (*bmdma_setup) (struct ata_queued_cmd *qc); 525 void (*bmdma_setup) (struct ata_queued_cmd *qc);
526 void (*bmdma_start) (struct ata_queued_cmd *qc); 526 void (*bmdma_start) (struct ata_queued_cmd *qc);
527 527
528 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
529
528 void (*qc_prep) (struct ata_queued_cmd *qc); 530 void (*qc_prep) (struct ata_queued_cmd *qc);
529 unsigned int (*qc_issue) (struct ata_queued_cmd *qc); 531 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
530 532
@@ -646,6 +648,10 @@ extern int ata_port_start (struct ata_port *ap);
646extern void ata_port_stop (struct ata_port *ap); 648extern void ata_port_stop (struct ata_port *ap);
647extern void ata_host_stop (struct ata_host_set *host_set); 649extern void ata_host_stop (struct ata_host_set *host_set);
648extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 650extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
651extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
652 unsigned int buflen, int write_data);
653extern void ata_pio_data_xfer(struct ata_device *adev, unsigned char *buf,
654 unsigned int buflen, int write_data);
649extern void ata_qc_prep(struct ata_queued_cmd *qc); 655extern void ata_qc_prep(struct ata_queued_cmd *qc);
650extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 656extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
651extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 657extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);