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 | 4c9bf4e799ce06a7378f1196587084802a414c03 (patch) | |
tree | 70a7d3741e756b975468850537f222349143a0be /drivers/ata | |
parent | 79f97dadfe9b4b561634d202225ba2fa910dc225 (diff) |
libata: replace tf_read with qc_fill_rtf for non-SFF drivers
Now that all SFF stuff is separated out of core layer, core layer
doesn't call ops->tf_read directly. It gets called only via
ops->qc_fill_rtf() for non-SFF drivers. This patch directly
implements private ops->qc_fill_rtf() for non-SFF controllers and kill
ops->tf_read().
This is much cleaner for non-SFF controllers as some of them have to
cache SFF register values in private data structure and report the
cached values via ops->tf_read(). Also, ops->tf_read() gets nasty for
controllers which don't have clear notion of TF registers when
operation is not in progress.
As this change makes default ops->qc_fill_rtf unnecessary, move
ata_sff_qc_fill_rtf() form ata_base_port_ops to ata_sff_port_ops where
it belongs.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 21 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 1 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 1 | ||||
-rw-r--r-- | drivers/ata/sata_fsl.c | 24 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 8 |
5 files changed, 27 insertions, 28 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 1389c64e0027..ad5b6f384ba1 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -243,9 +243,9 @@ static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | |||
243 | static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 243 | static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
244 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 244 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
245 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | 245 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); |
246 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); | ||
246 | static int ahci_port_start(struct ata_port *ap); | 247 | static int ahci_port_start(struct ata_port *ap); |
247 | static void ahci_port_stop(struct ata_port *ap); | 248 | static void ahci_port_stop(struct ata_port *ap); |
248 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
249 | static void ahci_qc_prep(struct ata_queued_cmd *qc); | 249 | static void ahci_qc_prep(struct ata_queued_cmd *qc); |
250 | static u8 ahci_check_status(struct ata_port *ap); | 250 | static u8 ahci_check_status(struct ata_port *ap); |
251 | static void ahci_freeze(struct ata_port *ap); | 251 | static void ahci_freeze(struct ata_port *ap); |
@@ -295,10 +295,10 @@ static struct ata_port_operations ahci_ops = { | |||
295 | .sff_check_status = ahci_check_status, | 295 | .sff_check_status = ahci_check_status, |
296 | .sff_check_altstatus = ahci_check_status, | 296 | .sff_check_altstatus = ahci_check_status, |
297 | 297 | ||
298 | .sff_tf_read = ahci_tf_read, | ||
299 | .qc_defer = sata_pmp_qc_defer_cmd_switch, | 298 | .qc_defer = sata_pmp_qc_defer_cmd_switch, |
300 | .qc_prep = ahci_qc_prep, | 299 | .qc_prep = ahci_qc_prep, |
301 | .qc_issue = ahci_qc_issue, | 300 | .qc_issue = ahci_qc_issue, |
301 | .qc_fill_rtf = ahci_qc_fill_rtf, | ||
302 | 302 | ||
303 | .freeze = ahci_freeze, | 303 | .freeze = ahci_freeze, |
304 | .thaw = ahci_thaw, | 304 | .thaw = ahci_thaw, |
@@ -1473,14 +1473,6 @@ static u8 ahci_check_status(struct ata_port *ap) | |||
1473 | return readl(mmio + PORT_TFDATA) & 0xFF; | 1473 | return readl(mmio + PORT_TFDATA) & 0xFF; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | ||
1477 | { | ||
1478 | struct ahci_port_priv *pp = ap->private_data; | ||
1479 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | ||
1480 | |||
1481 | ata_tf_from_fis(d2h_fis, tf); | ||
1482 | } | ||
1483 | |||
1484 | static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl) | 1476 | static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl) |
1485 | { | 1477 | { |
1486 | struct scatterlist *sg; | 1478 | struct scatterlist *sg; |
@@ -1779,6 +1771,15 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
1779 | return 0; | 1771 | return 0; |
1780 | } | 1772 | } |
1781 | 1773 | ||
1774 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | ||
1775 | { | ||
1776 | struct ahci_port_priv *pp = qc->ap->private_data; | ||
1777 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | ||
1778 | |||
1779 | ata_tf_from_fis(d2h_fis, &qc->result_tf); | ||
1780 | return true; | ||
1781 | } | ||
1782 | |||
1782 | static void ahci_freeze(struct ata_port *ap) | 1783 | static void ahci_freeze(struct ata_port *ap) |
1783 | { | 1784 | { |
1784 | void __iomem *port_mmio = ahci_port_base(ap); | 1785 | void __iomem *port_mmio = ahci_port_base(ap); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index dcc5a28e26c1..e8598eeeec39 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -74,7 +74,6 @@ 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, | ||
78 | .prereset = ata_std_prereset, | 77 | .prereset = ata_std_prereset, |
79 | .postreset = ata_std_postreset, | 78 | .postreset = ata_std_postreset, |
80 | .error_handler = ata_std_error_handler, | 79 | .error_handler = ata_std_error_handler, |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 5ae813f54420..8e6c78ac70f8 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -44,6 +44,7 @@ const struct ata_port_operations ata_sff_port_ops = { | |||
44 | 44 | ||
45 | .qc_prep = ata_sff_qc_prep, | 45 | .qc_prep = ata_sff_qc_prep, |
46 | .qc_issue = ata_sff_qc_issue, | 46 | .qc_issue = ata_sff_qc_issue, |
47 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | ||
47 | 48 | ||
48 | .freeze = ata_sff_freeze, | 49 | .freeze = ata_sff_freeze, |
49 | .thaw = ata_sff_thaw, | 50 | .thaw = ata_sff_thaw, |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 37482d4e883f..e880b7ec060f 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -464,6 +464,20 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc) | |||
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
466 | 466 | ||
467 | static bool sata_fsl_qc_fill_rtf(struct ata_queued_cmd *qc) | ||
468 | { | ||
469 | struct sata_fsl_port_priv *pp = qc->ap->private_data; | ||
470 | struct sata_fsl_host_priv *host_priv = qc->ap->host->private_data; | ||
471 | void __iomem *hcr_base = host_priv->hcr_base; | ||
472 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); | ||
473 | struct command_desc *cd; | ||
474 | |||
475 | cd = pp->cmdentry + tag; | ||
476 | |||
477 | ata_tf_from_fis(cd->sfis, &qc->result_tf); | ||
478 | return true; | ||
479 | } | ||
480 | |||
467 | static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | 481 | static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, |
468 | u32 val) | 482 | u32 val) |
469 | { | 483 | { |
@@ -580,13 +594,6 @@ static u8 sata_fsl_check_status(struct ata_port *ap) | |||
580 | return pp->tf.command; | 594 | return pp->tf.command; |
581 | } | 595 | } |
582 | 596 | ||
583 | static void sata_fsl_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | ||
584 | { | ||
585 | struct sata_fsl_port_priv *pp = ap->private_data; | ||
586 | |||
587 | *tf = pp->tf; | ||
588 | } | ||
589 | |||
590 | static int sata_fsl_port_start(struct ata_port *ap) | 597 | static int sata_fsl_port_start(struct ata_port *ap) |
591 | { | 598 | { |
592 | struct device *dev = ap->host->dev; | 599 | struct device *dev = ap->host->dev; |
@@ -1193,10 +1200,9 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1193 | .sff_check_status = sata_fsl_check_status, | 1200 | .sff_check_status = sata_fsl_check_status, |
1194 | .sff_check_altstatus = sata_fsl_check_status, | 1201 | .sff_check_altstatus = sata_fsl_check_status, |
1195 | 1202 | ||
1196 | .sff_tf_read = sata_fsl_tf_read, | ||
1197 | |||
1198 | .qc_prep = sata_fsl_qc_prep, | 1203 | .qc_prep = sata_fsl_qc_prep, |
1199 | .qc_issue = sata_fsl_qc_issue, | 1204 | .qc_issue = sata_fsl_qc_issue, |
1205 | .qc_fill_rtf = sata_fsl_qc_fill_rtf, | ||
1200 | 1206 | ||
1201 | .scr_read = sata_fsl_scr_read, | 1207 | .scr_read = sata_fsl_scr_read, |
1202 | .scr_write = sata_fsl_scr_write, | 1208 | .scr_write = sata_fsl_scr_write, |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 79952f825b40..51a7c06803df 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -344,7 +344,6 @@ static void sil24_dev_config(struct ata_device *dev); | |||
344 | static u8 sil24_check_status(struct ata_port *ap); | 344 | static u8 sil24_check_status(struct ata_port *ap); |
345 | static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val); | 345 | static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val); |
346 | static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | 346 | static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); |
347 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
348 | static int sil24_qc_defer(struct ata_queued_cmd *qc); | 347 | static int sil24_qc_defer(struct ata_queued_cmd *qc); |
349 | static void sil24_qc_prep(struct ata_queued_cmd *qc); | 348 | static void sil24_qc_prep(struct ata_queued_cmd *qc); |
350 | static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); | 349 | static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); |
@@ -404,7 +403,6 @@ static struct ata_port_operations sil24_ops = { | |||
404 | 403 | ||
405 | .sff_check_status = sil24_check_status, | 404 | .sff_check_status = sil24_check_status, |
406 | .sff_check_altstatus = sil24_check_status, | 405 | .sff_check_altstatus = sil24_check_status, |
407 | .sff_tf_read = sil24_tf_read, | ||
408 | .qc_defer = sil24_qc_defer, | 406 | .qc_defer = sil24_qc_defer, |
409 | .qc_prep = sil24_qc_prep, | 407 | .qc_prep = sil24_qc_prep, |
410 | .qc_issue = sil24_qc_issue, | 408 | .qc_issue = sil24_qc_issue, |
@@ -533,12 +531,6 @@ static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) | |||
533 | return -EINVAL; | 531 | return -EINVAL; |
534 | } | 532 | } |
535 | 533 | ||
536 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | ||
537 | { | ||
538 | struct sil24_port_priv *pp = ap->private_data; | ||
539 | *tf = pp->tf; | ||
540 | } | ||
541 | |||
542 | static void sil24_config_port(struct ata_port *ap) | 534 | static void sil24_config_port(struct ata_port *ap) |
543 | { | 535 | { |
544 | void __iomem *port = ap->ioaddr.cmd_addr; | 536 | void __iomem *port = ap->ioaddr.cmd_addr; |