diff options
author | Tejun Heo <tj@kernel.org> | 2010-05-10 15:41:42 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-05-19 13:38:55 -0400 |
commit | 360ff7833098e944e5003618b03894251e937802 (patch) | |
tree | aaa8c8f771cf35b2a0dab58ea6bad35d88f4ac8a | |
parent | f60d70113fa04e32aee2dedbf304a48469c9c45c (diff) |
libata-sff: separate out BMDMA qc_issue
Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
uses ata_sff_qc_issue() for non-DMA commands. All the users are
updated accordingly.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/ata/libata-sff.c | 112 | ||||
-rw-r--r-- | drivers/ata/pata_acpi.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_cs5530.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_hpt3x2n.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_it821x.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_oldpiix.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_radisys.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_sc1200.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_nv.c | 4 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
11 files changed, 80 insertions, 57 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 6f52b598b8d2..19ddf924944f 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1379,15 +1379,11 @@ fsm_start: | |||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | /** | 1381 | /** |
1382 | * ata_sff_qc_issue - issue taskfile to device in proto-dependent manner | 1382 | * ata_sff_qc_issue - issue taskfile to a SFF controller |
1383 | * @qc: command to issue to device | 1383 | * @qc: command to issue to device |
1384 | * | 1384 | * |
1385 | * Using various libata functions and hooks, this function | 1385 | * This function issues a PIO or NODATA command to a SFF |
1386 | * starts an ATA command. ATA commands are grouped into | 1386 | * controller. |
1387 | * classes called "protocols", and issuing each type of protocol | ||
1388 | * is slightly different. | ||
1389 | * | ||
1390 | * May be used as the qc_issue() entry in ata_port_operations. | ||
1391 | * | 1387 | * |
1392 | * LOCKING: | 1388 | * LOCKING: |
1393 | * spin_lock_irqsave(host lock) | 1389 | * spin_lock_irqsave(host lock) |
@@ -1402,23 +1398,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1402 | /* Use polling pio if the LLD doesn't handle | 1398 | /* Use polling pio if the LLD doesn't handle |
1403 | * interrupt driven pio and atapi CDB interrupt. | 1399 | * interrupt driven pio and atapi CDB interrupt. |
1404 | */ | 1400 | */ |
1405 | if (ap->flags & ATA_FLAG_PIO_POLLING) { | 1401 | if (ap->flags & ATA_FLAG_PIO_POLLING) |
1406 | switch (qc->tf.protocol) { | 1402 | qc->tf.flags |= ATA_TFLAG_POLLING; |
1407 | case ATA_PROT_PIO: | ||
1408 | case ATA_PROT_NODATA: | ||
1409 | case ATAPI_PROT_PIO: | ||
1410 | case ATAPI_PROT_NODATA: | ||
1411 | qc->tf.flags |= ATA_TFLAG_POLLING; | ||
1412 | break; | ||
1413 | case ATAPI_PROT_DMA: | ||
1414 | if (qc->dev->flags & ATA_DFLAG_CDB_INTR) | ||
1415 | /* see ata_dma_blacklisted() */ | ||
1416 | BUG(); | ||
1417 | break; | ||
1418 | default: | ||
1419 | break; | ||
1420 | } | ||
1421 | } | ||
1422 | 1403 | ||
1423 | /* select the device */ | 1404 | /* select the device */ |
1424 | ata_dev_select(ap, qc->dev->devno, 1, 0); | 1405 | ata_dev_select(ap, qc->dev->devno, 1, 0); |
@@ -1437,15 +1418,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1437 | 1418 | ||
1438 | break; | 1419 | break; |
1439 | 1420 | ||
1440 | case ATA_PROT_DMA: | ||
1441 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); | ||
1442 | |||
1443 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | ||
1444 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | ||
1445 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | ||
1446 | ap->hsm_task_state = HSM_ST_LAST; | ||
1447 | break; | ||
1448 | |||
1449 | case ATA_PROT_PIO: | 1421 | case ATA_PROT_PIO: |
1450 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 1422 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
1451 | ata_qc_set_polling(qc); | 1423 | ata_qc_set_polling(qc); |
@@ -1490,18 +1462,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1490 | ata_sff_queue_pio_task(ap, 0); | 1462 | ata_sff_queue_pio_task(ap, 0); |
1491 | break; | 1463 | break; |
1492 | 1464 | ||
1493 | case ATAPI_PROT_DMA: | ||
1494 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); | ||
1495 | |||
1496 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | ||
1497 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | ||
1498 | ap->hsm_task_state = HSM_ST_FIRST; | ||
1499 | |||
1500 | /* send cdb by polling if no cdb interrupt */ | ||
1501 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | ||
1502 | ata_sff_queue_pio_task(ap, 0); | ||
1503 | break; | ||
1504 | |||
1505 | default: | 1465 | default: |
1506 | WARN_ON_ONCE(1); | 1466 | WARN_ON_ONCE(1); |
1507 | return AC_ERR_SYSTEM; | 1467 | return AC_ERR_SYSTEM; |
@@ -2618,6 +2578,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { | |||
2618 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 2578 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
2619 | 2579 | ||
2620 | .qc_prep = ata_bmdma_qc_prep, | 2580 | .qc_prep = ata_bmdma_qc_prep, |
2581 | .qc_issue = ata_bmdma_qc_issue, | ||
2621 | 2582 | ||
2622 | .bmdma_setup = ata_bmdma_setup, | 2583 | .bmdma_setup = ata_bmdma_setup, |
2623 | .bmdma_start = ata_bmdma_start, | 2584 | .bmdma_start = ata_bmdma_start, |
@@ -2782,6 +2743,67 @@ void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc) | |||
2782 | EXPORT_SYMBOL_GPL(ata_bmdma_dumb_qc_prep); | 2743 | EXPORT_SYMBOL_GPL(ata_bmdma_dumb_qc_prep); |
2783 | 2744 | ||
2784 | /** | 2745 | /** |
2746 | * ata_bmdma_qc_issue - issue taskfile to a BMDMA controller | ||
2747 | * @qc: command to issue to device | ||
2748 | * | ||
2749 | * This function issues a PIO, NODATA or DMA command to a | ||
2750 | * SFF/BMDMA controller. PIO and NODATA are handled by | ||
2751 | * ata_sff_qc_issue(). | ||
2752 | * | ||
2753 | * LOCKING: | ||
2754 | * spin_lock_irqsave(host lock) | ||
2755 | * | ||
2756 | * RETURNS: | ||
2757 | * Zero on success, AC_ERR_* mask on failure | ||
2758 | */ | ||
2759 | unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) | ||
2760 | { | ||
2761 | struct ata_port *ap = qc->ap; | ||
2762 | |||
2763 | /* see ata_dma_blacklisted() */ | ||
2764 | BUG_ON((ap->flags & ATA_FLAG_PIO_POLLING) && | ||
2765 | qc->tf.protocol == ATAPI_PROT_DMA); | ||
2766 | |||
2767 | /* defer PIO handling to sff_qc_issue */ | ||
2768 | if (!ata_is_dma(qc->tf.protocol)) | ||
2769 | return ata_sff_qc_issue(qc); | ||
2770 | |||
2771 | /* select the device */ | ||
2772 | ata_dev_select(ap, qc->dev->devno, 1, 0); | ||
2773 | |||
2774 | /* start the command */ | ||
2775 | switch (qc->tf.protocol) { | ||
2776 | case ATA_PROT_DMA: | ||
2777 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); | ||
2778 | |||
2779 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | ||
2780 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | ||
2781 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | ||
2782 | ap->hsm_task_state = HSM_ST_LAST; | ||
2783 | break; | ||
2784 | |||
2785 | case ATAPI_PROT_DMA: | ||
2786 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); | ||
2787 | |||
2788 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | ||
2789 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | ||
2790 | ap->hsm_task_state = HSM_ST_FIRST; | ||
2791 | |||
2792 | /* send cdb by polling if no cdb interrupt */ | ||
2793 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | ||
2794 | ata_sff_queue_pio_task(ap, 0); | ||
2795 | break; | ||
2796 | |||
2797 | default: | ||
2798 | WARN_ON(1); | ||
2799 | return AC_ERR_SYSTEM; | ||
2800 | } | ||
2801 | |||
2802 | return 0; | ||
2803 | } | ||
2804 | EXPORT_SYMBOL_GPL(ata_bmdma_qc_issue); | ||
2805 | |||
2806 | /** | ||
2785 | * ata_bmdma_error_handler - Stock error handler for BMDMA controller | 2807 | * ata_bmdma_error_handler - Stock error handler for BMDMA controller |
2786 | * @ap: port to handle error for | 2808 | * @ap: port to handle error for |
2787 | * | 2809 | * |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index 1a5a309abccd..066b9f301ed5 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -172,7 +172,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) | |||
172 | struct pata_acpi *acpi = ap->private_data; | 172 | struct pata_acpi *acpi = ap->private_data; |
173 | 173 | ||
174 | if (acpi->gtm.flags & 0x10) | 174 | if (acpi->gtm.flags & 0x10) |
175 | return ata_sff_qc_issue(qc); | 175 | return ata_bmdma_qc_issue(qc); |
176 | 176 | ||
177 | if (adev != acpi->last) { | 177 | if (adev != acpi->last) { |
178 | pacpi_set_piomode(ap, adev); | 178 | pacpi_set_piomode(ap, adev); |
@@ -180,7 +180,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) | |||
180 | pacpi_set_dmamode(ap, adev); | 180 | pacpi_set_dmamode(ap, adev); |
181 | acpi->last = adev; | 181 | acpi->last = adev; |
182 | } | 182 | } |
183 | return ata_sff_qc_issue(qc); | 183 | return ata_bmdma_qc_issue(qc); |
184 | } | 184 | } |
185 | 185 | ||
186 | /** | 186 | /** |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 4b9a66f18de6..e809a4233a81 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -156,7 +156,7 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc) | |||
156 | cs5530_set_dmamode(ap, adev); | 156 | cs5530_set_dmamode(ap, adev); |
157 | } | 157 | } |
158 | 158 | ||
159 | return ata_sff_qc_issue(qc); | 159 | return ata_bmdma_qc_issue(qc); |
160 | } | 160 | } |
161 | 161 | ||
162 | static struct scsi_host_template cs5530_sht = { | 162 | static struct scsi_host_template cs5530_sht = { |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index 01457b266f3d..8b95aeba0e74 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -320,7 +320,7 @@ static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc) | |||
320 | 320 | ||
321 | hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23); | 321 | hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23); |
322 | } | 322 | } |
323 | return ata_sff_qc_issue(qc); | 323 | return ata_bmdma_qc_issue(qc); |
324 | } | 324 | } |
325 | 325 | ||
326 | static struct scsi_host_template hpt3x2n_sht = { | 326 | static struct scsi_host_template hpt3x2n_sht = { |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 8d73438f292c..2bd2b002d14a 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -430,7 +430,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc) | |||
430 | case 0xFC: /* Internal 'report rebuild state' */ | 430 | case 0xFC: /* Internal 'report rebuild state' */ |
431 | /* Arguably should just no-op this one */ | 431 | /* Arguably should just no-op this one */ |
432 | case ATA_CMD_SET_FEATURES: | 432 | case ATA_CMD_SET_FEATURES: |
433 | return ata_sff_qc_issue(qc); | 433 | return ata_bmdma_qc_issue(qc); |
434 | } | 434 | } |
435 | printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command); | 435 | printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command); |
436 | return AC_ERR_DEV; | 436 | return AC_ERR_DEV; |
@@ -448,7 +448,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc) | |||
448 | static unsigned int it821x_passthru_qc_issue(struct ata_queued_cmd *qc) | 448 | static unsigned int it821x_passthru_qc_issue(struct ata_queued_cmd *qc) |
449 | { | 449 | { |
450 | it821x_passthru_dev_select(qc->ap, qc->dev->devno); | 450 | it821x_passthru_dev_select(qc->ap, qc->dev->devno); |
451 | return ata_sff_qc_issue(qc); | 451 | return ata_bmdma_qc_issue(qc); |
452 | } | 452 | } |
453 | 453 | ||
454 | /** | 454 | /** |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index 5f6aba7eb0dd..988ef2627be3 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -200,7 +200,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc) | |||
200 | if (ata_dma_enabled(adev)) | 200 | if (ata_dma_enabled(adev)) |
201 | oldpiix_set_dmamode(ap, adev); | 201 | oldpiix_set_dmamode(ap, adev); |
202 | } | 202 | } |
203 | return ata_sff_qc_issue(qc); | 203 | return ata_bmdma_qc_issue(qc); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index fc9602229acb..a5fa388e5398 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -179,7 +179,7 @@ static unsigned int radisys_qc_issue(struct ata_queued_cmd *qc) | |||
179 | radisys_set_piomode(ap, adev); | 179 | radisys_set_piomode(ap, adev); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | return ata_sff_qc_issue(qc); | 182 | return ata_bmdma_qc_issue(qc); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 599e648a722f..6b5b63a2fd8e 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -174,7 +174,7 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc) | |||
174 | sc1200_set_dmamode(ap, adev); | 174 | sc1200_set_dmamode(ap, adev); |
175 | } | 175 | } |
176 | 176 | ||
177 | return ata_sff_qc_issue(qc); | 177 | return ata_bmdma_qc_issue(qc); |
178 | } | 178 | } |
179 | 179 | ||
180 | /** | 180 | /** |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index fb0d2c1d8417..f3471bc949d3 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -2358,7 +2358,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
2358 | if (IS_GEN_II(hpriv)) | 2358 | if (IS_GEN_II(hpriv)) |
2359 | return mv_qc_issue_fis(qc); | 2359 | return mv_qc_issue_fis(qc); |
2360 | } | 2360 | } |
2361 | return ata_sff_qc_issue(qc); | 2361 | return ata_bmdma_qc_issue(qc); |
2362 | } | 2362 | } |
2363 | 2363 | ||
2364 | static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap) | 2364 | static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap) |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 4863a62c3d8c..baa8f0d2c86f 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -1468,7 +1468,7 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc) | |||
1468 | BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) && | 1468 | BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) && |
1469 | (qc->flags & ATA_QCFLAG_DMAMAP)); | 1469 | (qc->flags & ATA_QCFLAG_DMAMAP)); |
1470 | nv_adma_register_mode(qc->ap); | 1470 | nv_adma_register_mode(qc->ap); |
1471 | return ata_sff_qc_issue(qc); | 1471 | return ata_bmdma_qc_issue(qc); |
1472 | } else | 1472 | } else |
1473 | nv_adma_mode(qc->ap); | 1473 | nv_adma_mode(qc->ap); |
1474 | 1474 | ||
@@ -2088,7 +2088,7 @@ static unsigned int nv_swncq_qc_issue(struct ata_queued_cmd *qc) | |||
2088 | struct nv_swncq_port_priv *pp = ap->private_data; | 2088 | struct nv_swncq_port_priv *pp = ap->private_data; |
2089 | 2089 | ||
2090 | if (qc->tf.protocol != ATA_PROT_NCQ) | 2090 | if (qc->tf.protocol != ATA_PROT_NCQ) |
2091 | return ata_sff_qc_issue(qc); | 2091 | return ata_bmdma_qc_issue(qc); |
2092 | 2092 | ||
2093 | DPRINTK("Enter\n"); | 2093 | DPRINTK("Enter\n"); |
2094 | 2094 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index d973972f0db2..ee84e7e12039 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -1626,6 +1626,7 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
1626 | #endif /* CONFIG_PCI */ | 1626 | #endif /* CONFIG_PCI */ |
1627 | 1627 | ||
1628 | extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); | 1628 | extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); |
1629 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); | ||
1629 | extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); | 1630 | extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); |
1630 | extern void ata_bmdma_error_handler(struct ata_port *ap); | 1631 | extern void ata_bmdma_error_handler(struct ata_port *ap); |
1631 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | 1632 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); |