aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 12:46:56 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:25 -0400
commit45db2f6c95eee7c6622ea1b3edb9abafba58e3ab (patch)
tree1c57efcf3e118b177dd7c9c1070b8af70694aff3 /drivers/ata
parent2a0c15ca39f5881aa1b472ca856bb7a2e584ece7 (diff)
libata: move link onlineness check out of softreset methods
Currently, SATA softresets should do link onlineness check before actually performing SRST protocol but it doesn't really belong to softreset. This patch moves onlineness check in softreset to ata_eh_reset() and ata_eh_followup_srst_needed() to clean up code and help future sata_mv changes which need clear separation between SCR and TF accesses. sata_fsl is peculiar in that its softreset really isn't softreset but combination of hardreset and softreset. This patch adds dummy private ->prereset to keep the current behavior but the driver really should implement separate hard and soft resets and return -EAGAIN from hardreset if it should be follwed by softreset. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c6
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-eh.c2
-rw-r--r--drivers/ata/libata-sff.c6
-rw-r--r--drivers/ata/pata_bf54x.c6
-rw-r--r--drivers/ata/pata_scc.c6
-rw-r--r--drivers/ata/sata_fsl.c10
-rw-r--r--drivers/ata/sata_sil24.c7
8 files changed, 15 insertions, 32 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 0de6432ee026..739ba3f222e8 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1273,12 +1273,6 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1273 1273
1274 DPRINTK("ENTER\n"); 1274 DPRINTK("ENTER\n");
1275 1275
1276 if (ata_link_offline(link)) {
1277 DPRINTK("PHY reports no device\n");
1278 *class = ATA_DEV_NONE;
1279 return 0;
1280 }
1281
1282 /* prepare for SRST (AHCI-1.1 10.4.1) */ 1276 /* prepare for SRST (AHCI-1.1 10.4.1) */
1283 rc = ahci_kick_engine(ap, 1); 1277 rc = ahci_kick_engine(ap, 1);
1284 if (rc && rc != -EOPNOTSUPP) 1278 if (rc && rc != -EOPNOTSUPP)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3401248180c9..f60988f5e01b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3541,6 +3541,10 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
3541 "link for reset (errno=%d)\n", rc); 3541 "link for reset (errno=%d)\n", rc);
3542 } 3542 }
3543 3543
3544 /* no point in trying softreset on offline link */
3545 if (ata_link_offline(link))
3546 ehc->i.action &= ~ATA_EH_SOFTRESET;
3547
3544 return 0; 3548 return 0;
3545} 3549}
3546 3550
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 88cdc4938bea..ecbb8e90cb8d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2065,7 +2065,7 @@ static int ata_eh_followup_srst_needed(struct ata_link *link,
2065 int rc, int classify, 2065 int rc, int classify,
2066 const unsigned int *classes) 2066 const unsigned int *classes)
2067{ 2067{
2068 if (link->flags & ATA_LFLAG_NO_SRST) 2068 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link))
2069 return 0; 2069 return 0;
2070 if (rc == -EAGAIN) { 2070 if (rc == -EAGAIN) {
2071 if (classify) 2071 if (classify)
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 8e6c78ac70f8..15499522e642 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1889,11 +1889,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1889 1889
1890 DPRINTK("ENTER\n"); 1890 DPRINTK("ENTER\n");
1891 1891
1892 if (ata_link_offline(link)) {
1893 classes[0] = ATA_DEV_NONE;
1894 goto out;
1895 }
1896
1897 /* determine if device 0/1 are present */ 1892 /* determine if device 0/1 are present */
1898 if (ata_devchk(ap, 0)) 1893 if (ata_devchk(ap, 0))
1899 devmask |= (1 << 0); 1894 devmask |= (1 << 0);
@@ -1919,7 +1914,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1919 classes[1] = ata_sff_dev_classify(&link->device[1], 1914 classes[1] = ata_sff_dev_classify(&link->device[1],
1920 devmask & (1 << 1), &err); 1915 devmask & (1 << 1), &err);
1921 1916
1922 out:
1923 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); 1917 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
1924 return 0; 1918 return 0;
1925} 1919}
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index d98bd7455e6b..0a5ad98635b1 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1103,11 +1103,6 @@ static int bfin_softreset(struct ata_link *link, unsigned int *classes,
1103 unsigned int devmask = 0, err_mask; 1103 unsigned int devmask = 0, err_mask;
1104 u8 err; 1104 u8 err;
1105 1105
1106 if (ata_link_offline(link)) {
1107 classes[0] = ATA_DEV_NONE;
1108 goto out;
1109 }
1110
1111 /* determine if device 0/1 are present */ 1106 /* determine if device 0/1 are present */
1112 if (bfin_devchk(ap, 0)) 1107 if (bfin_devchk(ap, 0))
1113 devmask |= (1 << 0); 1108 devmask |= (1 << 0);
@@ -1132,7 +1127,6 @@ static int bfin_softreset(struct ata_link *link, unsigned int *classes,
1132 classes[1] = ata_sff_dev_classify(&ap->link.device[1], 1127 classes[1] = ata_sff_dev_classify(&ap->link.device[1],
1133 devmask & (1 << 1), &err); 1128 devmask & (1 << 1), &err);
1134 1129
1135 out:
1136 return 0; 1130 return 0;
1137} 1131}
1138 1132
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 7bdea8a4ca7e..e965b251ca24 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -615,11 +615,6 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes,
615 615
616 DPRINTK("ENTER\n"); 616 DPRINTK("ENTER\n");
617 617
618 if (ata_link_offline(link)) {
619 classes[0] = ATA_DEV_NONE;
620 goto out;
621 }
622
623 /* determine if device 0/1 are present */ 618 /* determine if device 0/1 are present */
624 if (scc_devchk(ap, 0)) 619 if (scc_devchk(ap, 0))
625 devmask |= (1 << 0); 620 devmask |= (1 << 0);
@@ -645,7 +640,6 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes,
645 classes[1] = ata_sff_dev_classify(&ap->link.device[1], 640 classes[1] = ata_sff_dev_classify(&ap->link.device[1],
646 devmask & (1 << 1), &err); 641 devmask & (1 << 1), &err);
647 642
648 out:
649 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); 643 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
650 return 0; 644 return 0;
651} 645}
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 9c4e6a6698c2..fddd346b1d57 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -678,6 +678,15 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
678 return ata_dev_classify(&tf); 678 return ata_dev_classify(&tf);
679} 679}
680 680
681static int sata_fsl_prereset(struct ata_linke *link, unsigned long deadline)
682{
683 /* FIXME: Never skip softreset, sata_fsl_softreset() is
684 * combination of soft and hard resets. sata_fsl_softreset()
685 * needs to be splitted into soft and hard resets.
686 */
687 return 0;
688}
689
681static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, 690static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
682 unsigned long deadline) 691 unsigned long deadline)
683{ 692{
@@ -1157,6 +1166,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1157 1166
1158 .freeze = sata_fsl_freeze, 1167 .freeze = sata_fsl_freeze,
1159 .thaw = sata_fsl_thaw, 1168 .thaw = sata_fsl_thaw,
1169 .prereset = sata_fsl_prereset,
1160 .softreset = sata_fsl_softreset, 1170 .softreset = sata_fsl_softreset,
1161 .post_internal_cmd = sata_fsl_post_internal_cmd, 1171 .post_internal_cmd = sata_fsl_post_internal_cmd,
1162 1172
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 20757fa6115d..27a110110077 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -663,12 +663,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
663 663
664 DPRINTK("ENTER\n"); 664 DPRINTK("ENTER\n");
665 665
666 if (ata_link_offline(link)) {
667 DPRINTK("PHY reports no device\n");
668 *class = ATA_DEV_NONE;
669 goto out;
670 }
671
672 /* put the port into known state */ 666 /* put the port into known state */
673 if (sil24_init_port(ap)) { 667 if (sil24_init_port(ap)) {
674 reason = "port not ready"; 668 reason = "port not ready";
@@ -693,7 +687,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
693 sil24_read_tf(ap, 0, &tf); 687 sil24_read_tf(ap, 0, &tf);
694 *class = ata_dev_classify(&tf); 688 *class = ata_dev_classify(&tf);
695 689
696 out:
697 DPRINTK("EXIT, class=%u\n", *class); 690 DPRINTK("EXIT, class=%u\n", *class);
698 return 0; 691 return 0;
699 692