diff options
author | Tejun Heo <htejun@gmail.com> | 2008-04-07 09:47:20 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:23 -0400 |
commit | 22183bf569c8600ff414ac25f23134044e0ef453 (patch) | |
tree | 1dea79cdbe439637477e1c4214b600b6823cb866 | |
parent | 305d2a1ab137d11d573319c315748a87060fe82d (diff) |
libata: add qc_fill_rtf port operation
On command completion, ata_qc_complete() directly called ops->tf_read
to fill qc->result_tf. This patch adds ops->qc_fill_rtf to replace
hardcoded ops->tf_read usage.
ata_sff_qc_fill_rtf() which uses ops->tf_read to fill result_tf is
implemented and set in ata_base_port_ops and other ops tables which
don't inherit from ata_base_port_ops, so this patch doesn't introduce
any behavior change.
ops->qc_fill_rtf() is similar to ops->sff_tf_read() but can only be
called when a command finishes. As some non-SFF controllers don't
have TF registers defined unless they're associated with in-flight
commands, this limited operation makes life easier for those drivers
and help lifting SFF assumptions from libata core layer.
Signed-off-by: Tejun Heo <htejun@gmail.com>
-rw-r--r-- | drivers/ata/libata-core.c | 3 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 20 | ||||
-rw-r--r-- | drivers/ata/sata_sx4.c | 1 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 1 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_ata.c | 1 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
6 files changed, 27 insertions, 1 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 51876b93c1b7..3b822124e97e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -74,6 +74,7 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 }; | |||
74 | const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; | 74 | const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; |
75 | 75 | ||
76 | const struct ata_port_operations ata_base_port_ops = { | 76 | const struct ata_port_operations ata_base_port_ops = { |
77 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | ||
77 | .prereset = ata_std_prereset, | 78 | .prereset = ata_std_prereset, |
78 | .postreset = ata_std_postreset, | 79 | .postreset = ata_std_postreset, |
79 | .error_handler = ata_std_error_handler, | 80 | .error_handler = ata_std_error_handler, |
@@ -4562,7 +4563,7 @@ static void fill_result_tf(struct ata_queued_cmd *qc) | |||
4562 | struct ata_port *ap = qc->ap; | 4563 | struct ata_port *ap = qc->ap; |
4563 | 4564 | ||
4564 | qc->result_tf.flags = qc->tf.flags; | 4565 | qc->result_tf.flags = qc->tf.flags; |
4565 | ap->ops->sff_tf_read(ap, &qc->result_tf); | 4566 | ap->ops->qc_fill_rtf(qc); |
4566 | } | 4567 | } |
4567 | 4568 | ||
4568 | static void ata_verify_xfer(struct ata_queued_cmd *qc) | 4569 | static void ata_verify_xfer(struct ata_queued_cmd *qc) |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 5be8a6058dac..5ae813f54420 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1408,6 +1408,25 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | /** | 1410 | /** |
1411 | * ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read | ||
1412 | * @qc: qc to fill result TF for | ||
1413 | * | ||
1414 | * @qc is finished and result TF needs to be filled. Fill it | ||
1415 | * using ->sff_tf_read. | ||
1416 | * | ||
1417 | * LOCKING: | ||
1418 | * spin_lock_irqsave(host lock) | ||
1419 | * | ||
1420 | * RETURNS: | ||
1421 | * true indicating that result TF is successfully filled. | ||
1422 | */ | ||
1423 | bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc) | ||
1424 | { | ||
1425 | qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); | ||
1426 | return true; | ||
1427 | } | ||
1428 | |||
1429 | /** | ||
1411 | * ata_sff_host_intr - Handle host interrupt for given (port, task) | 1430 | * ata_sff_host_intr - Handle host interrupt for given (port, task) |
1412 | * @ap: Port on which interrupt arrived (possibly...) | 1431 | * @ap: Port on which interrupt arrived (possibly...) |
1413 | * @qc: Taskfile currently active in engine | 1432 | * @qc: Taskfile currently active in engine |
@@ -2724,6 +2743,7 @@ EXPORT_SYMBOL_GPL(ata_sff_irq_on); | |||
2724 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); | 2743 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); |
2725 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); | 2744 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); |
2726 | EXPORT_SYMBOL_GPL(ata_sff_qc_issue); | 2745 | EXPORT_SYMBOL_GPL(ata_sff_qc_issue); |
2746 | EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf); | ||
2727 | EXPORT_SYMBOL_GPL(ata_sff_host_intr); | 2747 | EXPORT_SYMBOL_GPL(ata_sff_host_intr); |
2728 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); | 2748 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); |
2729 | EXPORT_SYMBOL_GPL(ata_sff_freeze); | 2749 | EXPORT_SYMBOL_GPL(ata_sff_freeze); |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index 6107eff731f3..ec04b8d3c791 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -251,6 +251,7 @@ static struct ata_port_operations pdc_20621_ops = { | |||
251 | .phy_reset = pdc_20621_phy_reset, | 251 | .phy_reset = pdc_20621_phy_reset, |
252 | .qc_prep = pdc20621_qc_prep, | 252 | .qc_prep = pdc20621_qc_prep, |
253 | .qc_issue = pdc20621_qc_issue, | 253 | .qc_issue = pdc20621_qc_issue, |
254 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | ||
254 | .sff_data_xfer = ata_sff_data_xfer, | 255 | .sff_data_xfer = ata_sff_data_xfer, |
255 | .eng_timeout = pdc_eng_timeout, | 256 | .eng_timeout = pdc_eng_timeout, |
256 | .sff_irq_clear = pdc20621_irq_clear, | 257 | .sff_irq_clear = pdc20621_irq_clear, |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 5bddae19d1fb..2ecd32991522 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -5280,6 +5280,7 @@ static struct ata_port_operations ipr_sata_ops = { | |||
5280 | .sff_tf_read = ipr_tf_read, | 5280 | .sff_tf_read = ipr_tf_read, |
5281 | .qc_prep = ata_noop_qc_prep, | 5281 | .qc_prep = ata_noop_qc_prep, |
5282 | .qc_issue = ipr_qc_issue, | 5282 | .qc_issue = ipr_qc_issue, |
5283 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | ||
5283 | .port_start = ata_sas_port_start, | 5284 | .port_start = ata_sas_port_start, |
5284 | .port_stop = ata_sas_port_stop | 5285 | .port_stop = ata_sas_port_stop |
5285 | }; | 5286 | }; |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index a1664b87927a..2ec255839dcd 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -356,6 +356,7 @@ static struct ata_port_operations sas_sata_ops = { | |||
356 | .sff_tf_read = sas_ata_tf_read, | 356 | .sff_tf_read = sas_ata_tf_read, |
357 | .qc_prep = ata_noop_qc_prep, | 357 | .qc_prep = ata_noop_qc_prep, |
358 | .qc_issue = sas_ata_qc_issue, | 358 | .qc_issue = sas_ata_qc_issue, |
359 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | ||
359 | .port_start = ata_sas_port_start, | 360 | .port_start = ata_sas_port_start, |
360 | .port_stop = ata_sas_port_stop, | 361 | .port_stop = ata_sas_port_stop, |
361 | .scr_read = sas_ata_scr_read, | 362 | .scr_read = sas_ata_scr_read, |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 2b5a0b77e179..bb4200d42f0d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -715,6 +715,7 @@ struct ata_port_operations { | |||
715 | int (*check_atapi_dma)(struct ata_queued_cmd *qc); | 715 | int (*check_atapi_dma)(struct ata_queued_cmd *qc); |
716 | void (*qc_prep)(struct ata_queued_cmd *qc); | 716 | void (*qc_prep)(struct ata_queued_cmd *qc); |
717 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); | 717 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); |
718 | bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); | ||
718 | 719 | ||
719 | /* | 720 | /* |
720 | * Configuration and exception handling | 721 | * Configuration and exception handling |
@@ -1385,6 +1386,7 @@ extern void ata_sff_irq_clear(struct ata_port *ap); | |||
1385 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | 1386 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
1386 | u8 status, int in_wq); | 1387 | u8 status, int in_wq); |
1387 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | 1388 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
1389 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | ||
1388 | extern unsigned int ata_sff_host_intr(struct ata_port *ap, | 1390 | extern unsigned int ata_sff_host_intr(struct ata_port *ap, |
1389 | struct ata_queued_cmd *qc); | 1391 | struct ata_queued_cmd *qc); |
1390 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); | 1392 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); |