aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 09:47:20 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:23 -0400
commit5958e3025fd9d97429163e074d9cfa3848f51f28 (patch)
treef20492dc35fc2651452c871fbc812bd4f8379b40
parentac371987a81c61c2efbd6931245cdcaf43baad89 (diff)
libata: move PMP SCR access failure during reset to ata_eh_reset()
If PMP fan-out reset fails and SCR isn't accessible, PMP should be reset. This used to be tested by sata_pmp_std_hardreset() and communicated to EH by -ERESTART. However, this logic is generic and doesn't really have much to do with specific hardreset implementation. This patch moves SCR access failure detection logic to ata_eh_reset() where it belongs. As this makes sata_pmp_std_hardreset() identical to sata_std_hardreset(), the function is killed and replaced with the standard method. Signed-off-by: Tejun Heo <htejun@gmail.com>
-rw-r--r--drivers/ata/libata-core.c3
-rw-r--r--drivers/ata/libata-eh.c5
-rw-r--r--drivers/ata/libata-pmp.c35
-rw-r--r--drivers/ata/sata_sil24.c2
-rw-r--r--include/linux/libata.h2
5 files changed, 7 insertions, 40 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e00b620f161a..2da579b46bdd 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -91,7 +91,7 @@ const struct ata_port_operations sata_pmp_port_ops = {
91 .inherits = &sata_port_ops, 91 .inherits = &sata_port_ops,
92 92
93 .pmp_prereset = ata_std_prereset, 93 .pmp_prereset = ata_std_prereset,
94 .pmp_hardreset = sata_pmp_std_hardreset, 94 .pmp_hardreset = sata_std_hardreset,
95 .pmp_postreset = ata_std_postreset, 95 .pmp_postreset = ata_std_postreset,
96 .error_handler = sata_pmp_error_handler, 96 .error_handler = sata_pmp_error_handler,
97}; 97};
@@ -6307,7 +6307,6 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume);
6307#endif /* CONFIG_PCI */ 6307#endif /* CONFIG_PCI */
6308 6308
6309EXPORT_SYMBOL_GPL(sata_pmp_qc_defer_cmd_switch); 6309EXPORT_SYMBOL_GPL(sata_pmp_qc_defer_cmd_switch);
6310EXPORT_SYMBOL_GPL(sata_pmp_std_hardreset);
6311EXPORT_SYMBOL_GPL(sata_pmp_error_handler); 6310EXPORT_SYMBOL_GPL(sata_pmp_error_handler);
6312 6311
6313EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); 6312EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 21687bbd9a70..d8c4a45dcf26 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2276,6 +2276,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2276 return rc; 2276 return rc;
2277 2277
2278 fail: 2278 fail:
2279 /* if SCR isn't accessible on a fan-out port, PMP needs to be reset */
2280 if (!ata_is_host_link(link) &&
2281 sata_scr_read(link, SCR_STATUS, &sstatus))
2282 rc = -ERESTART;
2283
2279 if (rc == -ERESTART || try >= max_tries) 2284 if (rc == -ERESTART || try >= max_tries)
2280 goto out; 2285 goto out;
2281 2286
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index 2f8a9577c26d..9c998611b644 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -176,41 +176,6 @@ int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)
176} 176}
177 177
178/** 178/**
179 * sata_pmp_std_hardreset - standard hardreset method for PMP link
180 * @link: link to be reset
181 * @class: resulting class of attached device
182 * @deadline: deadline jiffies for the operation
183 *
184 * Hardreset PMP port @link. Note that this function doesn't
185 * wait for BSY clearance. There simply isn't a generic way to
186 * wait the event. Instead, this function return -EAGAIN thus
187 * telling libata-EH to followup with softreset.
188 *
189 * LOCKING:
190 * Kernel thread context (may sleep)
191 *
192 * RETURNS:
193 * 0 on success, -errno otherwise.
194 */
195int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
196 unsigned long deadline)
197{
198 u32 tmp;
199 int rc;
200
201 DPRINTK("ENTER\n");
202
203 rc = sata_std_hardreset(link, class, deadline);
204
205 /* if SCR isn't accessible, we need to reset the PMP */
206 if (rc && rc != -EAGAIN && sata_scr_read(link, SCR_STATUS, &tmp))
207 rc = -ERESTART;
208
209 DPRINTK("EXIT, rc=%d\n", rc);
210 return rc;
211}
212
213/**
214 * sata_pmp_read_gscr - read GSCR block of SATA PMP 179 * sata_pmp_read_gscr - read GSCR block of SATA PMP
215 * @dev: PMP device 180 * @dev: PMP device
216 * @gscr: buffer to read GSCR block into 181 * @gscr: buffer to read GSCR block into
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b83851f6e068..fc9d48cd8122 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -944,7 +944,7 @@ static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class,
944 return rc; 944 return rc;
945 } 945 }
946 946
947 return sata_pmp_std_hardreset(link, class, deadline); 947 return sata_std_hardreset(link, class, deadline);
948} 948}
949 949
950static void sil24_freeze(struct ata_port *ap) 950static void sil24_freeze(struct ata_port *ap)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b9188371b12a..2b5a0b77e179 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1025,8 +1025,6 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1025 * PMP - drivers/ata/libata-pmp.c 1025 * PMP - drivers/ata/libata-pmp.c
1026 */ 1026 */
1027extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); 1027extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1028extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
1029 unsigned long deadline);
1030extern void sata_pmp_error_handler(struct ata_port *ap); 1028extern void sata_pmp_error_handler(struct ata_port *ap);
1031 1029
1032/* 1030/*