aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c53
-rw-r--r--drivers/ata/ata_piix.c21
-rw-r--r--drivers/ata/libata-core.c14
-rw-r--r--drivers/ata/libata-eh.c25
-rw-r--r--drivers/ata/libata-pmp.c47
-rw-r--r--drivers/ata/libata-sff.c49
-rw-r--r--drivers/ata/pata_artop.c34
-rw-r--r--drivers/ata/pata_atiixp.c7
-rw-r--r--drivers/ata/pata_bf54x.c14
-rw-r--r--drivers/ata/pata_efar.c15
-rw-r--r--drivers/ata/pata_hpt37x.c61
-rw-r--r--drivers/ata/pata_hpt3x2n.c16
-rw-r--r--drivers/ata/pata_icside.c8
-rw-r--r--drivers/ata/pata_it8213.c15
-rw-r--r--drivers/ata/pata_mpc52xx.c10
-rw-r--r--drivers/ata/pata_mpiix.c16
-rw-r--r--drivers/ata/pata_ns87410.c16
-rw-r--r--drivers/ata/pata_oldpiix.c16
-rw-r--r--drivers/ata/pata_opti.c17
-rw-r--r--drivers/ata/pata_optidma.c17
-rw-r--r--drivers/ata/pata_pdc2027x.c19
-rw-r--r--drivers/ata/pata_scc.c15
-rw-r--r--drivers/ata/pata_sis.c15
-rw-r--r--drivers/ata/pata_sl82c105.c8
-rw-r--r--drivers/ata/pata_triflex.c7
-rw-r--r--drivers/ata/pata_via.c14
-rw-r--r--drivers/ata/pdc_adma.c11
-rw-r--r--drivers/ata/sata_fsl.c12
-rw-r--r--drivers/ata/sata_inic162x.c5
-rw-r--r--drivers/ata/sata_mv.c16
-rw-r--r--drivers/ata/sata_nv.c17
-rw-r--r--drivers/ata/sata_promise.c22
-rw-r--r--drivers/ata/sata_qstor.c6
-rw-r--r--drivers/ata/sata_sil24.c18
-rw-r--r--drivers/ata/sata_via.c10
35 files changed, 174 insertions, 492 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index dacb3ef0c3e6..3efa9904f7a0 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -252,9 +252,18 @@ static void ahci_freeze(struct ata_port *ap);
252static void ahci_thaw(struct ata_port *ap); 252static void ahci_thaw(struct ata_port *ap);
253static void ahci_pmp_attach(struct ata_port *ap); 253static void ahci_pmp_attach(struct ata_port *ap);
254static void ahci_pmp_detach(struct ata_port *ap); 254static void ahci_pmp_detach(struct ata_port *ap);
255static int ahci_softreset(struct ata_link *link, unsigned int *class,
256 unsigned long deadline);
257static int ahci_hardreset(struct ata_link *link, unsigned int *class,
258 unsigned long deadline);
259static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
260 unsigned long deadline);
261static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
262 unsigned long deadline);
263static void ahci_postreset(struct ata_link *link, unsigned int *class);
264static int ahci_pmp_softreset(struct ata_link *link, unsigned int *class,
265 unsigned long deadline);
255static void ahci_error_handler(struct ata_port *ap); 266static void ahci_error_handler(struct ata_port *ap);
256static void ahci_vt8251_error_handler(struct ata_port *ap);
257static void ahci_p5wdh_error_handler(struct ata_port *ap);
258static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 267static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
259static int ahci_port_resume(struct ata_port *ap); 268static int ahci_port_resume(struct ata_port *ap);
260static void ahci_dev_config(struct ata_device *dev); 269static void ahci_dev_config(struct ata_device *dev);
@@ -293,6 +302,10 @@ static struct ata_port_operations ahci_ops = {
293 302
294 .freeze = ahci_freeze, 303 .freeze = ahci_freeze,
295 .thaw = ahci_thaw, 304 .thaw = ahci_thaw,
305 .softreset = ahci_softreset,
306 .hardreset = ahci_hardreset,
307 .postreset = ahci_postreset,
308 .pmp_softreset = ahci_pmp_softreset,
296 .error_handler = ahci_error_handler, 309 .error_handler = ahci_error_handler,
297 .post_internal_cmd = ahci_post_internal_cmd, 310 .post_internal_cmd = ahci_post_internal_cmd,
298 .dev_config = ahci_dev_config, 311 .dev_config = ahci_dev_config,
@@ -314,12 +327,12 @@ static struct ata_port_operations ahci_ops = {
314 327
315static struct ata_port_operations ahci_vt8251_ops = { 328static struct ata_port_operations ahci_vt8251_ops = {
316 .inherits = &ahci_ops, 329 .inherits = &ahci_ops,
317 .error_handler = ahci_vt8251_error_handler, 330 .hardreset = ahci_vt8251_hardreset,
318}; 331};
319 332
320static struct ata_port_operations ahci_p5wdh_ops = { 333static struct ata_port_operations ahci_p5wdh_ops = {
321 .inherits = &ahci_ops, 334 .inherits = &ahci_ops,
322 .error_handler = ahci_p5wdh_error_handler, 335 .hardreset = ahci_p5wdh_hardreset,
323}; 336};
324 337
325#define AHCI_HFLAGS(flags) .private_data = (void *)(flags) 338#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
@@ -1796,37 +1809,7 @@ static void ahci_error_handler(struct ata_port *ap)
1796 ahci_start_engine(ap); 1809 ahci_start_engine(ap);
1797 } 1810 }
1798 1811
1799 /* perform recovery */ 1812 sata_pmp_error_handler(ap);
1800 sata_pmp_do_eh(ap, ata_std_prereset, ahci_softreset,
1801 ahci_hardreset, ahci_postreset,
1802 sata_pmp_std_prereset, ahci_pmp_softreset,
1803 sata_pmp_std_hardreset, sata_pmp_std_postreset);
1804}
1805
1806static void ahci_vt8251_error_handler(struct ata_port *ap)
1807{
1808 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
1809 /* restart engine */
1810 ahci_stop_engine(ap);
1811 ahci_start_engine(ap);
1812 }
1813
1814 /* perform recovery */
1815 ata_do_eh(ap, ata_std_prereset, ahci_softreset, ahci_vt8251_hardreset,
1816 ahci_postreset);
1817}
1818
1819static void ahci_p5wdh_error_handler(struct ata_port *ap)
1820{
1821 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
1822 /* restart engine */
1823 ahci_stop_engine(ap);
1824 ahci_start_engine(ap);
1825 }
1826
1827 /* perform recovery */
1828 ata_do_eh(ap, ata_std_prereset, ahci_softreset, ahci_p5wdh_hardreset,
1829 ahci_postreset);
1830} 1813}
1831 1814
1832static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 1815static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index bb46b61a7c6b..eafb984313f6 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -162,15 +162,16 @@ struct piix_host_priv {
162 162
163static int piix_init_one(struct pci_dev *pdev, 163static int piix_init_one(struct pci_dev *pdev,
164 const struct pci_device_id *ent); 164 const struct pci_device_id *ent);
165static void piix_pata_error_handler(struct ata_port *ap); 165static int piix_pata_prereset(struct ata_link *link, unsigned long deadline);
166static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev); 166static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev);
167static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); 167static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
168static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); 168static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
169static int ich_pata_cable_detect(struct ata_port *ap); 169static int ich_pata_cable_detect(struct ata_port *ap);
170static u8 piix_vmw_bmdma_status(struct ata_port *ap); 170static u8 piix_vmw_bmdma_status(struct ata_port *ap);
171static int piix_sidpr_hardreset(struct ata_link *link, unsigned int *class,
172 unsigned long deadline);
171static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val); 173static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val);
172static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val); 174static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val);
173static void piix_sidpr_error_handler(struct ata_port *ap);
174#ifdef CONFIG_PM 175#ifdef CONFIG_PM
175static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 176static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
176static int piix_pci_device_resume(struct pci_dev *pdev); 177static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -299,7 +300,7 @@ static struct ata_port_operations piix_pata_ops = {
299 .cable_detect = ata_cable_40wire, 300 .cable_detect = ata_cable_40wire,
300 .set_piomode = piix_set_piomode, 301 .set_piomode = piix_set_piomode,
301 .set_dmamode = piix_set_dmamode, 302 .set_dmamode = piix_set_dmamode,
302 .error_handler = piix_pata_error_handler, 303 .prereset = piix_pata_prereset,
303}; 304};
304 305
305static struct ata_port_operations piix_vmw_ops = { 306static struct ata_port_operations piix_vmw_ops = {
@@ -319,9 +320,9 @@ static struct ata_port_operations piix_sata_ops = {
319 320
320static struct ata_port_operations piix_sidpr_sata_ops = { 321static struct ata_port_operations piix_sidpr_sata_ops = {
321 .inherits = &piix_sata_ops, 322 .inherits = &piix_sata_ops,
323 .hardreset = piix_sidpr_hardreset,
322 .scr_read = piix_sidpr_scr_read, 324 .scr_read = piix_sidpr_scr_read,
323 .scr_write = piix_sidpr_scr_write, 325 .scr_write = piix_sidpr_scr_write,
324 .error_handler = piix_sidpr_error_handler,
325}; 326};
326 327
327static const struct piix_map_db ich5_map_db = { 328static const struct piix_map_db ich5_map_db = {
@@ -645,12 +646,6 @@ static int piix_pata_prereset(struct ata_link *link, unsigned long deadline)
645 return ata_std_prereset(link, deadline); 646 return ata_std_prereset(link, deadline);
646} 647}
647 648
648static void piix_pata_error_handler(struct ata_port *ap)
649{
650 ata_bmdma_drive_eh(ap, piix_pata_prereset, ata_std_softreset, NULL,
651 ata_std_postreset);
652}
653
654/** 649/**
655 * piix_set_piomode - Initialize host controller PATA PIO timings 650 * piix_set_piomode - Initialize host controller PATA PIO timings
656 * @ap: Port whose timings we are configuring 651 * @ap: Port whose timings we are configuring
@@ -1057,12 +1052,6 @@ static int piix_sidpr_hardreset(struct ata_link *link, unsigned int *class,
1057 return -EAGAIN; 1052 return -EAGAIN;
1058} 1053}
1059 1054
1060static void piix_sidpr_error_handler(struct ata_port *ap)
1061{
1062 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset,
1063 piix_sidpr_hardreset, ata_std_postreset);
1064}
1065
1066#ifdef CONFIG_PM 1055#ifdef CONFIG_PM
1067static int piix_broken_suspend(void) 1056static int piix_broken_suspend(void)
1068{ 1057{
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index aa6bcd79d60a..345f4a6865a8 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -76,6 +76,10 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
76 76
77const struct ata_port_operations ata_base_port_ops = { 77const struct ata_port_operations ata_base_port_ops = {
78 .irq_clear = ata_noop_irq_clear, 78 .irq_clear = ata_noop_irq_clear,
79 .prereset = ata_std_prereset,
80 .hardreset = sata_std_hardreset,
81 .postreset = ata_std_postreset,
82 .error_handler = ata_std_error_handler,
79}; 83};
80 84
81const struct ata_port_operations sata_port_ops = { 85const struct ata_port_operations sata_port_ops = {
@@ -87,6 +91,11 @@ const struct ata_port_operations sata_port_ops = {
87 91
88const struct ata_port_operations sata_pmp_port_ops = { 92const struct ata_port_operations sata_pmp_port_ops = {
89 .inherits = &sata_port_ops, 93 .inherits = &sata_port_ops,
94
95 .pmp_prereset = sata_pmp_std_prereset,
96 .pmp_hardreset = sata_pmp_std_hardreset,
97 .pmp_postreset = sata_pmp_std_postreset,
98 .error_handler = sata_pmp_error_handler,
90}; 99};
91 100
92const struct ata_port_operations ata_sff_port_ops = { 101const struct ata_port_operations ata_sff_port_ops = {
@@ -97,6 +106,7 @@ const struct ata_port_operations ata_sff_port_ops = {
97 106
98 .freeze = ata_bmdma_freeze, 107 .freeze = ata_bmdma_freeze,
99 .thaw = ata_bmdma_thaw, 108 .thaw = ata_bmdma_thaw,
109 .softreset = ata_std_softreset,
100 .error_handler = ata_bmdma_error_handler, 110 .error_handler = ata_bmdma_error_handler,
101 .post_internal_cmd = ata_bmdma_post_internal_cmd, 111 .post_internal_cmd = ata_bmdma_post_internal_cmd,
102 112
@@ -7935,7 +7945,6 @@ EXPORT_SYMBOL_GPL(ata_bmdma_status);
7935EXPORT_SYMBOL_GPL(ata_bmdma_stop); 7945EXPORT_SYMBOL_GPL(ata_bmdma_stop);
7936EXPORT_SYMBOL_GPL(ata_bmdma_freeze); 7946EXPORT_SYMBOL_GPL(ata_bmdma_freeze);
7937EXPORT_SYMBOL_GPL(ata_bmdma_thaw); 7947EXPORT_SYMBOL_GPL(ata_bmdma_thaw);
7938EXPORT_SYMBOL_GPL(ata_bmdma_drive_eh);
7939EXPORT_SYMBOL_GPL(ata_bmdma_error_handler); 7948EXPORT_SYMBOL_GPL(ata_bmdma_error_handler);
7940EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); 7949EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd);
7941EXPORT_SYMBOL_GPL(ata_port_probe); 7950EXPORT_SYMBOL_GPL(ata_port_probe);
@@ -8005,7 +8014,7 @@ EXPORT_SYMBOL_GPL(sata_pmp_qc_defer_cmd_switch);
8005EXPORT_SYMBOL_GPL(sata_pmp_std_prereset); 8014EXPORT_SYMBOL_GPL(sata_pmp_std_prereset);
8006EXPORT_SYMBOL_GPL(sata_pmp_std_hardreset); 8015EXPORT_SYMBOL_GPL(sata_pmp_std_hardreset);
8007EXPORT_SYMBOL_GPL(sata_pmp_std_postreset); 8016EXPORT_SYMBOL_GPL(sata_pmp_std_postreset);
8008EXPORT_SYMBOL_GPL(sata_pmp_do_eh); 8017EXPORT_SYMBOL_GPL(sata_pmp_error_handler);
8009 8018
8010EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); 8019EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
8011EXPORT_SYMBOL_GPL(ata_ehi_push_desc); 8020EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
@@ -8024,6 +8033,7 @@ EXPORT_SYMBOL_GPL(ata_eh_thaw_port);
8024EXPORT_SYMBOL_GPL(ata_eh_qc_complete); 8033EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
8025EXPORT_SYMBOL_GPL(ata_eh_qc_retry); 8034EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
8026EXPORT_SYMBOL_GPL(ata_do_eh); 8035EXPORT_SYMBOL_GPL(ata_do_eh);
8036EXPORT_SYMBOL_GPL(ata_std_error_handler);
8027EXPORT_SYMBOL_GPL(ata_irq_on); 8037EXPORT_SYMBOL_GPL(ata_irq_on);
8028EXPORT_SYMBOL_GPL(ata_dev_try_classify); 8038EXPORT_SYMBOL_GPL(ata_dev_try_classify);
8029 8039
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0d0a2c0ab9e7..ec32082356cb 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2814,6 +2814,7 @@ void ata_eh_finish(struct ata_port *ap)
2814/** 2814/**
2815 * ata_do_eh - do standard error handling 2815 * ata_do_eh - do standard error handling
2816 * @ap: host port to handle error for 2816 * @ap: host port to handle error for
2817 *
2817 * @prereset: prereset method (can be NULL) 2818 * @prereset: prereset method (can be NULL)
2818 * @softreset: softreset method (can be NULL) 2819 * @softreset: softreset method (can be NULL)
2819 * @hardreset: hardreset method (can be NULL) 2820 * @hardreset: hardreset method (can be NULL)
@@ -2844,6 +2845,30 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
2844 ata_eh_finish(ap); 2845 ata_eh_finish(ap);
2845} 2846}
2846 2847
2848/**
2849 * ata_std_error_handler - standard error handler
2850 * @ap: host port to handle error for
2851 *
2852 * Standard error handler
2853 *
2854 * LOCKING:
2855 * Kernel thread context (may sleep).
2856 */
2857void ata_std_error_handler(struct ata_port *ap)
2858{
2859 struct ata_port_operations *ops = ap->ops;
2860 ata_reset_fn_t hardreset = ops->hardreset;
2861
2862 /* sata_std_hardreset is inherited to all drivers from
2863 * ata_base_port_ops. Ignore it if SCR access is not
2864 * available.
2865 */
2866 if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link))
2867 hardreset = NULL;
2868
2869 ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
2870}
2871
2847#ifdef CONFIG_PM 2872#ifdef CONFIG_PM
2848/** 2873/**
2849 * ata_eh_handle_port_suspend - perform port suspend operation 2874 * ata_eh_handle_port_suspend - perform port suspend operation
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index 39e036c8a2bc..a7cb1498c9b2 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -962,14 +962,6 @@ static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
962/** 962/**
963 * sata_pmp_eh_recover - recover PMP-enabled port 963 * sata_pmp_eh_recover - recover PMP-enabled port
964 * @ap: ATA port to recover 964 * @ap: ATA port to recover
965 * @prereset: prereset method (can be NULL)
966 * @softreset: softreset method
967 * @hardreset: hardreset method
968 * @postreset: postreset method (can be NULL)
969 * @pmp_prereset: PMP prereset method (can be NULL)
970 * @pmp_softreset: PMP softreset method (can be NULL)
971 * @pmp_hardreset: PMP hardreset method (can be NULL)
972 * @pmp_postreset: PMP postreset method (can be NULL)
973 * 965 *
974 * Drive EH recovery operation for PMP enabled port @ap. This 966 * Drive EH recovery operation for PMP enabled port @ap. This
975 * function recovers host and PMP ports with proper retrials and 967 * function recovers host and PMP ports with proper retrials and
@@ -982,12 +974,9 @@ static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
982 * RETURNS: 974 * RETURNS:
983 * 0 on success, -errno on failure. 975 * 0 on success, -errno on failure.
984 */ 976 */
985static int sata_pmp_eh_recover(struct ata_port *ap, 977static int sata_pmp_eh_recover(struct ata_port *ap)
986 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
987 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
988 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
989 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset)
990{ 978{
979 struct ata_port_operations *ops = ap->ops;
991 int pmp_tries, link_tries[SATA_PMP_MAX_PORTS]; 980 int pmp_tries, link_tries[SATA_PMP_MAX_PORTS];
992 struct ata_link *pmp_link = &ap->link; 981 struct ata_link *pmp_link = &ap->link;
993 struct ata_device *pmp_dev = pmp_link->device; 982 struct ata_device *pmp_dev = pmp_link->device;
@@ -1005,8 +994,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap,
1005 retry: 994 retry:
1006 /* PMP attached? */ 995 /* PMP attached? */
1007 if (!ap->nr_pmp_links) { 996 if (!ap->nr_pmp_links) {
1008 rc = ata_eh_recover(ap, prereset, softreset, hardreset, 997 rc = ata_eh_recover(ap, ops->prereset, ops->softreset,
1009 postreset, NULL); 998 ops->hardreset, ops->postreset, NULL);
1010 if (rc) { 999 if (rc) {
1011 ata_link_for_each_dev(dev, &ap->link) 1000 ata_link_for_each_dev(dev, &ap->link)
1012 ata_dev_disable(dev); 1001 ata_dev_disable(dev);
@@ -1024,8 +1013,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap,
1024 } 1013 }
1025 1014
1026 /* recover pmp */ 1015 /* recover pmp */
1027 rc = sata_pmp_eh_recover_pmp(ap, prereset, softreset, hardreset, 1016 rc = sata_pmp_eh_recover_pmp(ap, ops->prereset, ops->softreset,
1028 postreset); 1017 ops->hardreset, ops->postreset);
1029 if (rc) 1018 if (rc)
1030 goto pmp_fail; 1019 goto pmp_fail;
1031 1020
@@ -1035,8 +1024,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap,
1035 goto pmp_fail; 1024 goto pmp_fail;
1036 1025
1037 /* recover links */ 1026 /* recover links */
1038 rc = ata_eh_recover(ap, pmp_prereset, pmp_softreset, pmp_hardreset, 1027 rc = ata_eh_recover(ap, ops->pmp_prereset, ops->pmp_softreset,
1039 pmp_postreset, &link); 1028 ops->pmp_hardreset, ops->pmp_postreset, &link);
1040 if (rc) 1029 if (rc)
1041 goto link_fail; 1030 goto link_fail;
1042 1031
@@ -1132,16 +1121,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap,
1132} 1121}
1133 1122
1134/** 1123/**
1135 * sata_pmp_do_eh - do standard error handling for PMP-enabled host 1124 * sata_pmp_error_handler - do standard error handling for PMP-enabled host
1136 * @ap: host port to handle error for 1125 * @ap: host port to handle error for
1137 * @prereset: prereset method (can be NULL)
1138 * @softreset: softreset method
1139 * @hardreset: hardreset method
1140 * @postreset: postreset method (can be NULL)
1141 * @pmp_prereset: PMP prereset method (can be NULL)
1142 * @pmp_softreset: PMP softreset method (can be NULL)
1143 * @pmp_hardreset: PMP hardreset method (can be NULL)
1144 * @pmp_postreset: PMP postreset method (can be NULL)
1145 * 1126 *
1146 * Perform standard error handling sequence for PMP-enabled host 1127 * Perform standard error handling sequence for PMP-enabled host
1147 * @ap. 1128 * @ap.
@@ -1149,16 +1130,10 @@ static int sata_pmp_eh_recover(struct ata_port *ap,
1149 * LOCKING: 1130 * LOCKING:
1150 * Kernel thread context (may sleep). 1131 * Kernel thread context (may sleep).
1151 */ 1132 */
1152void sata_pmp_do_eh(struct ata_port *ap, 1133void sata_pmp_error_handler(struct ata_port *ap)
1153 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1154 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
1155 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
1156 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset)
1157{ 1134{
1158 ata_eh_autopsy(ap); 1135 ata_eh_autopsy(ap);
1159 ata_eh_report(ap); 1136 ata_eh_report(ap);
1160 sata_pmp_eh_recover(ap, prereset, softreset, hardreset, postreset, 1137 sata_pmp_eh_recover(ap);
1161 pmp_prereset, pmp_softreset, pmp_hardreset,
1162 pmp_postreset);
1163 ata_eh_finish(ap); 1138 ata_eh_finish(ap);
1164} 1139}
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 6223ec042c80..2a229a1d3211 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -396,28 +396,21 @@ void ata_bmdma_thaw(struct ata_port *ap)
396} 396}
397 397
398/** 398/**
399 * ata_bmdma_drive_eh - Perform EH with given methods for BMDMA controller 399 * ata_bmdma_error_handler - Stock error handler for BMDMA controller
400 * @ap: port to handle error for 400 * @ap: port to handle error for
401 * @prereset: prereset method (can be NULL)
402 * @softreset: softreset method (can be NULL)
403 * @hardreset: hardreset method (can be NULL)
404 * @postreset: postreset method (can be NULL)
405 * 401 *
406 * Handle error for ATA BMDMA controller. It can handle both 402 * Stock error handler for BMDMA controller. It can handle both
407 * PATA and SATA controllers. Many controllers should be able to 403 * PATA and SATA controllers. Many controllers should be able to
408 * use this EH as-is or with some added handling before and 404 * use this EH as-is or with some added handling before and
409 * after. 405 * after.
410 * 406 *
411 * This function is intended to be used for constructing
412 * ->error_handler callback by low level drivers.
413 *
414 * LOCKING: 407 * LOCKING:
415 * Kernel thread context (may sleep) 408 * Kernel thread context (may sleep)
416 */ 409 */
417void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, 410void ata_bmdma_error_handler(struct ata_port *ap)
418 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
419 ata_postreset_fn_t postreset)
420{ 411{
412 ata_reset_fn_t softreset = ap->ops->softreset;
413 ata_reset_fn_t hardreset = ap->ops->hardreset;
421 struct ata_queued_cmd *qc; 414 struct ata_queued_cmd *qc;
422 unsigned long flags; 415 unsigned long flags;
423 int thaw = 0; 416 int thaw = 0;
@@ -460,29 +453,19 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
460 ata_eh_thaw_port(ap); 453 ata_eh_thaw_port(ap);
461 454
462 /* PIO and DMA engines have been stopped, perform recovery */ 455 /* PIO and DMA engines have been stopped, perform recovery */
463 ata_do_eh(ap, prereset, softreset, hardreset, postreset);
464}
465
466/**
467 * ata_bmdma_error_handler - Stock error handler for BMDMA controller
468 * @ap: port to handle error for
469 *
470 * Stock error handler for BMDMA controller.
471 *
472 * LOCKING:
473 * Kernel thread context (may sleep)
474 */
475void ata_bmdma_error_handler(struct ata_port *ap)
476{
477 ata_reset_fn_t softreset = NULL, hardreset = NULL;
478 456
479 if (ap->ioaddr.ctl_addr) 457 /* ata_std_softreset and sata_std_hardreset are inherited to
480 softreset = ata_std_softreset; 458 * all SFF drivers from ata_sff_port_ops. Ignore softreset if
481 if (sata_scr_valid(&ap->link)) 459 * ctl isn't accessible. Ignore hardreset if SCR access isn't
482 hardreset = sata_std_hardreset; 460 * available.
461 */
462 if (softreset == ata_std_softreset && !ap->ioaddr.ctl_addr)
463 softreset = NULL;
464 if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link))
465 hardreset = NULL;
483 466
484 ata_bmdma_drive_eh(ap, ata_std_prereset, softreset, hardreset, 467 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset,
485 ata_std_postreset); 468 ap->ops->postreset);
486} 469}
487 470
488/** 471/**
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index ebd15cadf15f..b6d8c4d0e6c2 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -56,21 +56,6 @@ static int artop6210_pre_reset(struct ata_link *link, unsigned long deadline)
56} 56}
57 57
58/** 58/**
59 * artop6210_error_handler - Probe specified port on PATA host controller
60 * @ap: Port to probe
61 *
62 * LOCKING:
63 * None (inherited from caller).
64 */
65
66static void artop6210_error_handler(struct ata_port *ap)
67{
68 ata_bmdma_drive_eh(ap, artop6210_pre_reset,
69 ata_std_softreset, NULL,
70 ata_std_postreset);
71}
72
73/**
74 * artop6260_pre_reset - check for 40/80 pin 59 * artop6260_pre_reset - check for 40/80 pin
75 * @link: link 60 * @link: link
76 * @deadline: deadline jiffies for the operation 61 * @deadline: deadline jiffies for the operation
@@ -114,21 +99,6 @@ static int artop6260_cable_detect(struct ata_port *ap)
114} 99}
115 100
116/** 101/**
117 * artop6260_error_handler - Probe specified port on PATA host controller
118 * @ap: Port to probe
119 *
120 * LOCKING:
121 * None (inherited from caller).
122 */
123
124static void artop6260_error_handler(struct ata_port *ap)
125{
126 ata_bmdma_drive_eh(ap, artop6260_pre_reset,
127 ata_std_softreset, NULL,
128 ata_std_postreset);
129}
130
131/**
132 * artop6210_load_piomode - Load a set of PATA PIO timings 102 * artop6210_load_piomode - Load a set of PATA PIO timings
133 * @ap: Port whose timings we are configuring 103 * @ap: Port whose timings we are configuring
134 * @adev: Device 104 * @adev: Device
@@ -322,7 +292,7 @@ static struct ata_port_operations artop6210_ops = {
322 .cable_detect = ata_cable_40wire, 292 .cable_detect = ata_cable_40wire,
323 .set_piomode = artop6210_set_piomode, 293 .set_piomode = artop6210_set_piomode,
324 .set_dmamode = artop6210_set_dmamode, 294 .set_dmamode = artop6210_set_dmamode,
325 .error_handler = artop6210_error_handler, 295 .prereset = artop6210_pre_reset,
326}; 296};
327 297
328static struct ata_port_operations artop6260_ops = { 298static struct ata_port_operations artop6260_ops = {
@@ -330,7 +300,7 @@ static struct ata_port_operations artop6260_ops = {
330 .cable_detect = artop6260_cable_detect, 300 .cable_detect = artop6260_cable_detect,
331 .set_piomode = artop6260_set_piomode, 301 .set_piomode = artop6260_set_piomode,
332 .set_dmamode = artop6260_set_dmamode, 302 .set_dmamode = artop6260_set_dmamode,
333 .error_handler = artop6260_error_handler, 303 .prereset = artop6260_pre_reset,
334}; 304};
335 305
336 306
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 0bea7e75d2d6..56a65baddd4a 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -48,11 +48,6 @@ static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)
48 return ata_std_prereset(link, deadline); 48 return ata_std_prereset(link, deadline);
49} 49}
50 50
51static void atiixp_error_handler(struct ata_port *ap)
52{
53 ata_bmdma_drive_eh(ap, atiixp_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
54}
55
56static int atiixp_cable_detect(struct ata_port *ap) 51static int atiixp_cable_detect(struct ata_port *ap)
57{ 52{
58 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 53 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -235,7 +230,7 @@ static struct ata_port_operations atiixp_port_ops = {
235 .cable_detect = atiixp_cable_detect, 230 .cable_detect = atiixp_cable_detect,
236 .set_piomode = atiixp_set_piomode, 231 .set_piomode = atiixp_set_piomode,
237 .set_dmamode = atiixp_set_dmamode, 232 .set_dmamode = atiixp_set_dmamode,
238 .error_handler = atiixp_error_handler, 233 .prereset = atiixp_pre_reset,
239}; 234};
240 235
241static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 236static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 7a22ef483061..eea275acb2a8 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1314,17 +1314,6 @@ static void bfin_std_postreset(struct ata_link *link, unsigned int *classes)
1314 write_atapi_register(base, ATA_REG_CTRL, ap->ctl); 1314 write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
1315} 1315}
1316 1316
1317/**
1318 * bfin_error_handler - Stock error handler for DMA controller
1319 * @ap: port to handle error for
1320 */
1321
1322static void bfin_error_handler(struct ata_port *ap)
1323{
1324 ata_bmdma_drive_eh(ap, ata_std_prereset, bfin_std_softreset, NULL,
1325 bfin_std_postreset);
1326}
1327
1328static void bfin_port_stop(struct ata_port *ap) 1317static void bfin_port_stop(struct ata_port *ap)
1329{ 1318{
1330 dev_dbg(ap->dev, "in atapi port stop\n"); 1319 dev_dbg(ap->dev, "in atapi port stop\n");
@@ -1385,7 +1374,8 @@ static const struct ata_port_operations bfin_pata_ops = {
1385 1374
1386 .freeze = bfin_bmdma_freeze, 1375 .freeze = bfin_bmdma_freeze,
1387 .thaw = bfin_bmdma_thaw, 1376 .thaw = bfin_bmdma_thaw,
1388 .error_handler = bfin_error_handler, 1377 .softreset = bfin_std_softreset,
1378 .postreset = bfin_std_postreset,
1389 .post_internal_cmd = bfin_bmdma_stop, 1379 .post_internal_cmd = bfin_bmdma_stop,
1390 1380
1391 .irq_clear = bfin_irq_clear, 1381 .irq_clear = bfin_irq_clear,
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index 2f5b4848456a..1d839a57068e 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -49,19 +49,6 @@ static int efar_pre_reset(struct ata_link *link, unsigned long deadline)
49} 49}
50 50
51/** 51/**
52 * efar_probe_reset - Probe specified port on PATA host controller
53 * @ap: Port to probe
54 *
55 * LOCKING:
56 * None (inherited from caller).
57 */
58
59static void efar_error_handler(struct ata_port *ap)
60{
61 ata_bmdma_drive_eh(ap, efar_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
62}
63
64/**
65 * efar_cable_detect - check for 40/80 pin 52 * efar_cable_detect - check for 40/80 pin
66 * @ap: Port 53 * @ap: Port
67 * 54 *
@@ -241,7 +228,7 @@ static struct ata_port_operations efar_ops = {
241 .cable_detect = efar_cable_detect, 228 .cable_detect = efar_cable_detect,
242 .set_piomode = efar_set_piomode, 229 .set_piomode = efar_set_piomode,
243 .set_dmamode = efar_set_dmamode, 230 .set_dmamode = efar_set_dmamode,
244 .error_handler = efar_error_handler, 231 .prereset = efar_pre_reset,
245}; 232};
246 233
247 234
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index fb37e3a161fc..c10fcd31418d 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -341,19 +341,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline)
341 return ata_std_prereset(link, deadline); 341 return ata_std_prereset(link, deadline);
342} 342}
343 343
344/** 344static int hpt374_fn1_pre_reset(struct ata_link *link, unsigned long deadline)
345 * hpt37x_error_handler - reset the hpt374
346 * @ap: ATA port to reset
347 *
348 * Perform probe for HPT37x, except for HPT374 channel 2
349 */
350
351static void hpt37x_error_handler(struct ata_port *ap)
352{
353 ata_bmdma_drive_eh(ap, hpt37x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
354}
355
356static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
357{ 345{
358 static const struct pci_bits hpt37x_enable_bits[] = { 346 static const struct pci_bits hpt37x_enable_bits[] = {
359 { 0x50, 1, 0x04, 0x04 }, 347 { 0x50, 1, 0x04, 0x04 },
@@ -390,25 +378,6 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
390} 378}
391 379
392/** 380/**
393 * hpt374_error_handler - reset the hpt374
394 * @classes:
395 *
396 * The 374 cable detect is a little different due to the extra
397 * channels. The function 0 channels work like usual but function 1
398 * is special
399 */
400
401static void hpt374_error_handler(struct ata_port *ap)
402{
403 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
404
405 if (!(PCI_FUNC(pdev->devfn) & 1))
406 hpt37x_error_handler(ap);
407 else
408 ata_bmdma_drive_eh(ap, hpt374_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
409}
410
411/**
412 * hpt370_set_piomode - PIO setup 381 * hpt370_set_piomode - PIO setup
413 * @ap: ATA interface 382 * @ap: ATA interface
414 * @adev: device on the interface 383 * @adev: device on the interface
@@ -635,7 +604,7 @@ static struct ata_port_operations hpt370_port_ops = {
635 .mode_filter = hpt370_filter, 604 .mode_filter = hpt370_filter,
636 .set_piomode = hpt370_set_piomode, 605 .set_piomode = hpt370_set_piomode,
637 .set_dmamode = hpt370_set_dmamode, 606 .set_dmamode = hpt370_set_dmamode,
638 .error_handler = hpt37x_error_handler, 607 .prereset = hpt37x_pre_reset,
639}; 608};
640 609
641/* 610/*
@@ -659,17 +628,17 @@ static struct ata_port_operations hpt372_port_ops = {
659 628
660 .set_piomode = hpt372_set_piomode, 629 .set_piomode = hpt372_set_piomode,
661 .set_dmamode = hpt372_set_dmamode, 630 .set_dmamode = hpt372_set_dmamode,
662 .error_handler = hpt37x_error_handler, 631 .prereset = hpt37x_pre_reset,
663}; 632};
664 633
665/* 634/*
666 * Configuration for HPT374. Mode setting works like 372 and friends 635 * Configuration for HPT374. Mode setting works like 372 and friends
667 * but we have a different cable detection procedure. 636 * but we have a different cable detection procedure for function 1.
668 */ 637 */
669 638
670static struct ata_port_operations hpt374_port_ops = { 639static struct ata_port_operations hpt374_fn1_port_ops = {
671 .inherits = &hpt372_port_ops, 640 .inherits = &hpt372_port_ops,
672 .error_handler = hpt374_error_handler, 641 .prereset = hpt374_fn1_pre_reset,
673}; 642};
674 643
675/** 644/**
@@ -821,13 +790,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
821 .udma_mask = ATA_UDMA6, 790 .udma_mask = ATA_UDMA6,
822 .port_ops = &hpt372_port_ops 791 .port_ops = &hpt372_port_ops
823 }; 792 };
824 /* HPT374 - UDMA100 */ 793 /* HPT374 - UDMA100, function 1 uses different prereset method */
825 static const struct ata_port_info info_hpt374 = { 794 static const struct ata_port_info info_hpt374_fn0 = {
795 .flags = ATA_FLAG_SLAVE_POSS,
796 .pio_mask = 0x1f,
797 .mwdma_mask = 0x07,
798 .udma_mask = ATA_UDMA5,
799 .port_ops = &hpt372_port_ops
800 };
801 static const struct ata_port_info info_hpt374_fn1 = {
826 .flags = ATA_FLAG_SLAVE_POSS, 802 .flags = ATA_FLAG_SLAVE_POSS,
827 .pio_mask = 0x1f, 803 .pio_mask = 0x1f,
828 .mwdma_mask = 0x07, 804 .mwdma_mask = 0x07,
829 .udma_mask = ATA_UDMA5, 805 .udma_mask = ATA_UDMA5,
830 .port_ops = &hpt374_port_ops 806 .port_ops = &hpt374_fn1_port_ops
831 }; 807 };
832 808
833 static const int MHz[4] = { 33, 40, 50, 66 }; 809 static const int MHz[4] = { 33, 40, 50, 66 };
@@ -912,7 +888,10 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
912 break; 888 break;
913 case PCI_DEVICE_ID_TTI_HPT374: 889 case PCI_DEVICE_ID_TTI_HPT374:
914 chip_table = &hpt374; 890 chip_table = &hpt374;
915 ppi[0] = &info_hpt374; 891 if (!(PCI_FUNC(dev->devfn) & 1))
892 *ppi = &info_hpt374_fn0;
893 else
894 *ppi = &info_hpt374_fn1;
916 break; 895 break;
917 default: 896 default:
918 printk(KERN_ERR "pata_hpt37x: PCI table is bogus please report (%d).\n", dev->device); 897 printk(KERN_ERR "pata_hpt37x: PCI table is bogus please report (%d).\n", dev->device);
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index c774be93ae04..cd44ee3d3cc1 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -148,7 +148,7 @@ static int hpt3x2n_cable_detect(struct ata_port *ap)
148 * Reset the hardware and state machine, 148 * Reset the hardware and state machine,
149 */ 149 */
150 150
151static int hpt3xn_pre_reset(struct ata_link *link, unsigned long deadline) 151static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline)
152{ 152{
153 struct ata_port *ap = link->ap; 153 struct ata_port *ap = link->ap;
154 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 154 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -160,18 +160,6 @@ static int hpt3xn_pre_reset(struct ata_link *link, unsigned long deadline)
160} 160}
161 161
162/** 162/**
163 * hpt3x2n_error_handler - probe the hpt3x2n bus
164 * @ap: ATA port to reset
165 *
166 * Perform the probe reset handling for the 3x2N
167 */
168
169static void hpt3x2n_error_handler(struct ata_port *ap)
170{
171 ata_bmdma_drive_eh(ap, hpt3xn_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
172}
173
174/**
175 * hpt3x2n_set_piomode - PIO setup 163 * hpt3x2n_set_piomode - PIO setup
176 * @ap: ATA interface 164 * @ap: ATA interface
177 * @adev: device on the interface 165 * @adev: device on the interface
@@ -355,7 +343,7 @@ static struct ata_port_operations hpt3x2n_port_ops = {
355 .cable_detect = hpt3x2n_cable_detect, 343 .cable_detect = hpt3x2n_cable_detect,
356 .set_piomode = hpt3x2n_set_piomode, 344 .set_piomode = hpt3x2n_set_piomode,
357 .set_dmamode = hpt3x2n_set_dmamode, 345 .set_dmamode = hpt3x2n_set_dmamode,
358 .error_handler = hpt3x2n_error_handler, 346 .prereset = hpt3x2n_pre_reset,
359}; 347};
360 348
361/** 349/**
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index ff16b0eaa2c2..13d43e9dd279 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -332,12 +332,6 @@ static void pata_icside_postreset(struct ata_link *link, unsigned int *classes)
332 } 332 }
333} 333}
334 334
335static void pata_icside_error_handler(struct ata_port *ap)
336{
337 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,
338 pata_icside_postreset);
339}
340
341static struct ata_port_operations pata_icside_port_ops = { 335static struct ata_port_operations pata_icside_port_ops = {
342 .inherits = &ata_sff_port_ops, 336 .inherits = &ata_sff_port_ops,
343 /* no need to build any PRD tables for DMA */ 337 /* no need to build any PRD tables for DMA */
@@ -350,7 +344,7 @@ static struct ata_port_operations pata_icside_port_ops = {
350 344
351 .cable_detect = ata_cable_40wire, 345 .cable_detect = ata_cable_40wire,
352 .set_dmamode = pata_icside_set_dmamode, 346 .set_dmamode = pata_icside_set_dmamode,
353 .error_handler = pata_icside_error_handler, 347 .postreset = pata_icside_postreset,
354 .post_internal_cmd = pata_icside_bmdma_stop, 348 .post_internal_cmd = pata_icside_bmdma_stop,
355}; 349};
356 350
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index d23a46b75028..84ab89e8a247 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -44,19 +44,6 @@ static int it8213_pre_reset(struct ata_link *link, unsigned long deadline)
44} 44}
45 45
46/** 46/**
47 * it8213_error_handler - Probe specified port on PATA host controller
48 * @ap: Port to probe
49 *
50 * LOCKING:
51 * None (inherited from caller).
52 */
53
54static void it8213_error_handler(struct ata_port *ap)
55{
56 ata_bmdma_drive_eh(ap, it8213_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
57}
58
59/**
60 * it8213_cable_detect - check for 40/80 pin 47 * it8213_cable_detect - check for 40/80 pin
61 * @ap: Port 48 * @ap: Port
62 * 49 *
@@ -252,7 +239,7 @@ static struct ata_port_operations it8213_ops = {
252 .cable_detect = it8213_cable_detect, 239 .cable_detect = it8213_cable_detect,
253 .set_piomode = it8213_set_piomode, 240 .set_piomode = it8213_set_piomode,
254 .set_dmamode = it8213_set_dmamode, 241 .set_dmamode = it8213_set_dmamode,
255 .error_handler = it8213_error_handler, 242 .prereset = it8213_pre_reset,
256}; 243};
257 244
258 245
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index ac7c0822b1a7..fec93196710e 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -255,15 +255,6 @@ mpc52xx_ata_dev_select(struct ata_port *ap, unsigned int device)
255 ata_std_dev_select(ap,device); 255 ata_std_dev_select(ap,device);
256} 256}
257 257
258static void
259mpc52xx_ata_error_handler(struct ata_port *ap)
260{
261 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,
262 ata_std_postreset);
263}
264
265
266
267static struct scsi_host_template mpc52xx_ata_sht = { 258static struct scsi_host_template mpc52xx_ata_sht = {
268 ATA_PIO_SHT(DRV_NAME), 259 ATA_PIO_SHT(DRV_NAME),
269}; 260};
@@ -273,7 +264,6 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
273 .dev_select = mpc52xx_ata_dev_select, 264 .dev_select = mpc52xx_ata_dev_select,
274 .cable_detect = ata_cable_40wire, 265 .cable_detect = ata_cable_40wire,
275 .set_piomode = mpc52xx_ata_set_piomode, 266 .set_piomode = mpc52xx_ata_set_piomode,
276 .error_handler = mpc52xx_ata_error_handler,
277 .post_internal_cmd = ATA_OP_NULL, 267 .post_internal_cmd = ATA_OP_NULL,
278}; 268};
279 269
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index dab54f8a272d..1b9d0d412ebf 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -59,20 +59,6 @@ static int mpiix_pre_reset(struct ata_link *link, unsigned long deadline)
59} 59}
60 60
61/** 61/**
62 * mpiix_error_handler - probe reset
63 * @ap: ATA port
64 *
65 * Perform the ATA probe and bus reset sequence plus specific handling
66 * for this hardware. The MPIIX has the enable bits in a different place
67 * to PIIX4 and friends. As a pure PIO device it has no cable detect
68 */
69
70static void mpiix_error_handler(struct ata_port *ap)
71{
72 ata_bmdma_drive_eh(ap, mpiix_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
73}
74
75/**
76 * mpiix_set_piomode - set initial PIO mode data 62 * mpiix_set_piomode - set initial PIO mode data
77 * @ap: ATA interface 63 * @ap: ATA interface
78 * @adev: ATA device 64 * @adev: ATA device
@@ -159,7 +145,7 @@ static struct ata_port_operations mpiix_port_ops = {
159 .qc_issue = mpiix_qc_issue_prot, 145 .qc_issue = mpiix_qc_issue_prot,
160 .cable_detect = ata_cable_40wire, 146 .cable_detect = ata_cable_40wire,
161 .set_piomode = mpiix_set_piomode, 147 .set_piomode = mpiix_set_piomode,
162 .error_handler = mpiix_error_handler, 148 .prereset = mpiix_pre_reset,
163}; 149};
164 150
165static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 151static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 5a043e426480..4d2eefee7387 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -54,20 +54,6 @@ static int ns87410_pre_reset(struct ata_link *link, unsigned long deadline)
54} 54}
55 55
56/** 56/**
57 * ns87410_error_handler - probe reset
58 * @ap: ATA port
59 *
60 * Perform the ATA probe and bus reset sequence plus specific handling
61 * for this hardware. The MPIIX has the enable bits in a different place
62 * to PIIX4 and friends. As a pure PIO device it has no cable detect
63 */
64
65static void ns87410_error_handler(struct ata_port *ap)
66{
67 ata_bmdma_drive_eh(ap, ns87410_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
68}
69
70/**
71 * ns87410_set_piomode - set initial PIO mode data 57 * ns87410_set_piomode - set initial PIO mode data
72 * @ap: ATA interface 58 * @ap: ATA interface
73 * @adev: ATA device 59 * @adev: ATA device
@@ -152,7 +138,7 @@ static struct ata_port_operations ns87410_port_ops = {
152 .qc_issue = ns87410_qc_issue_prot, 138 .qc_issue = ns87410_qc_issue_prot,
153 .cable_detect = ata_cable_40wire, 139 .cable_detect = ata_cable_40wire,
154 .set_piomode = ns87410_set_piomode, 140 .set_piomode = ns87410_set_piomode,
155 .error_handler = ns87410_error_handler, 141 .prereset = ns87410_pre_reset,
156}; 142};
157 143
158static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) 144static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index 7001b756819e..c1da79a76439 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -51,20 +51,6 @@ static int oldpiix_pre_reset(struct ata_link *link, unsigned long deadline)
51} 51}
52 52
53/** 53/**
54 * oldpiix_pata_error_handler - Probe specified port on PATA host controller
55 * @ap: Port to probe
56 * @classes:
57 *
58 * LOCKING:
59 * None (inherited from caller).
60 */
61
62static void oldpiix_pata_error_handler(struct ata_port *ap)
63{
64 ata_bmdma_drive_eh(ap, oldpiix_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
65}
66
67/**
68 * oldpiix_set_piomode - Initialize host controller PATA PIO timings 54 * oldpiix_set_piomode - Initialize host controller PATA PIO timings
69 * @ap: Port whose timings we are configuring 55 * @ap: Port whose timings we are configuring
70 * @adev: Device whose timings we are configuring 56 * @adev: Device whose timings we are configuring
@@ -229,7 +215,7 @@ static struct ata_port_operations oldpiix_pata_ops = {
229 .cable_detect = ata_cable_40wire, 215 .cable_detect = ata_cable_40wire,
230 .set_piomode = oldpiix_set_piomode, 216 .set_piomode = oldpiix_set_piomode,
231 .set_dmamode = oldpiix_set_dmamode, 217 .set_dmamode = oldpiix_set_dmamode,
232 .error_handler = oldpiix_pata_error_handler, 218 .prereset = oldpiix_pre_reset,
233}; 219};
234 220
235 221
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 5a5f20e03fc0..4ddd03a67775 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -68,21 +68,6 @@ static int opti_pre_reset(struct ata_link *link, unsigned long deadline)
68} 68}
69 69
70/** 70/**
71 * opti_probe_reset - probe reset
72 * @ap: ATA port
73 *
74 * Perform the ATA probe and bus reset sequence plus specific handling
75 * for this hardware. The Opti needs little handling - we have no UDMA66
76 * capability that needs cable detection. All we must do is check the port
77 * is enabled.
78 */
79
80static void opti_error_handler(struct ata_port *ap)
81{
82 ata_bmdma_drive_eh(ap, opti_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
83}
84
85/**
86 * opti_write_reg - control register setup 71 * opti_write_reg - control register setup
87 * @ap: ATA port 72 * @ap: ATA port
88 * @value: value 73 * @value: value
@@ -172,7 +157,7 @@ static struct ata_port_operations opti_port_ops = {
172 .inherits = &ata_sff_port_ops, 157 .inherits = &ata_sff_port_ops,
173 .cable_detect = ata_cable_40wire, 158 .cable_detect = ata_cable_40wire,
174 .set_piomode = opti_set_piomode, 159 .set_piomode = opti_set_piomode,
175 .error_handler = opti_error_handler, 160 .prereset = opti_pre_reset,
176}; 161};
177 162
178static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) 163static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index ba2819ff964b..36ac147de178 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -68,21 +68,6 @@ static int optidma_pre_reset(struct ata_link *link, unsigned long deadline)
68} 68}
69 69
70/** 70/**
71 * optidma_probe_reset - probe reset
72 * @ap: ATA port
73 *
74 * Perform the ATA probe and bus reset sequence plus specific handling
75 * for this hardware. The Opti needs little handling - we have no UDMA66
76 * capability that needs cable detection. All we must do is check the port
77 * is enabled.
78 */
79
80static void optidma_error_handler(struct ata_port *ap)
81{
82 ata_bmdma_drive_eh(ap, optidma_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
83}
84
85/**
86 * optidma_unlock - unlock control registers 71 * optidma_unlock - unlock control registers
87 * @ap: ATA port 72 * @ap: ATA port
88 * 73 *
@@ -359,7 +344,7 @@ static struct ata_port_operations optidma_port_ops = {
359 .set_piomode = optidma_set_pio_mode, 344 .set_piomode = optidma_set_pio_mode,
360 .set_dmamode = optidma_set_dma_mode, 345 .set_dmamode = optidma_set_dma_mode,
361 .set_mode = optidma_set_mode, 346 .set_mode = optidma_set_mode,
362 .error_handler = optidma_error_handler, 347 .prereset = optidma_pre_reset,
363}; 348};
364 349
365static struct ata_port_operations optiplus_port_ops = { 350static struct ata_port_operations optiplus_port_ops = {
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index f619c20dd192..d235c9f92d09 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -63,7 +63,7 @@ enum {
63}; 63};
64 64
65static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 65static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
66static void pdc2027x_error_handler(struct ata_port *ap); 66static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline);
67static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); 67static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev);
68static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); 68static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev);
69static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); 69static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc);
@@ -136,7 +136,7 @@ static struct ata_port_operations pdc2027x_pata100_ops = {
136 .inherits = &ata_bmdma_port_ops, 136 .inherits = &ata_bmdma_port_ops,
137 .check_atapi_dma = pdc2027x_check_atapi_dma, 137 .check_atapi_dma = pdc2027x_check_atapi_dma,
138 .cable_detect = pdc2027x_cable_detect, 138 .cable_detect = pdc2027x_cable_detect,
139 .error_handler = pdc2027x_error_handler, 139 .prereset = pdc2027x_prereset,
140}; 140};
141 141
142static struct ata_port_operations pdc2027x_pata133_ops = { 142static struct ata_port_operations pdc2027x_pata133_ops = {
@@ -252,21 +252,6 @@ static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline)
252} 252}
253 253
254/** 254/**
255 * pdc2027x_error_handler - Perform reset on PATA port and classify
256 * @ap: Port to reset
257 *
258 * Reset PATA phy and classify attached devices.
259 *
260 * LOCKING:
261 * None (inherited from caller).
262 */
263
264static void pdc2027x_error_handler(struct ata_port *ap)
265{
266 ata_bmdma_drive_eh(ap, pdc2027x_prereset, ata_std_softreset, NULL, ata_std_postreset);
267}
268
269/**
270 * pdc2720x_mode_filter - mode selection filter 255 * pdc2720x_mode_filter - mode selection filter
271 * @adev: ATA device 256 * @adev: ATA device
272 * @mask: list of modes proposed 257 * @mask: list of modes proposed
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 033d1f3a82de..07f2d7a6f1a8 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -905,17 +905,6 @@ static void scc_std_postreset(struct ata_link *link, unsigned int *classes)
905} 905}
906 906
907/** 907/**
908 * scc_error_handler - Stock error handler for BMDMA controller
909 * @ap: port to handle error for
910 */
911
912static void scc_error_handler (struct ata_port *ap)
913{
914 ata_bmdma_drive_eh(ap, scc_pata_prereset, scc_std_softreset, NULL,
915 scc_std_postreset);
916}
917
918/**
919 * scc_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. 908 * scc_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt.
920 * @ap: Port associated with this ATA transaction. 909 * @ap: Port associated with this ATA transaction.
921 * 910 *
@@ -992,7 +981,9 @@ static const struct ata_port_operations scc_pata_ops = {
992 .data_xfer = scc_data_xfer, 981 .data_xfer = scc_data_xfer,
993 982
994 .freeze = scc_bmdma_freeze, 983 .freeze = scc_bmdma_freeze,
995 .error_handler = scc_error_handler, 984 .prereset = scc_pata_prereset,
985 .softreset = scc_std_softreset,
986 .postreset = scc_std_postreset,
996 .post_internal_cmd = scc_bmdma_stop, 987 .post_internal_cmd = scc_bmdma_stop,
997 988
998 .irq_clear = scc_bmdma_irq_clear, 989 .irq_clear = scc_bmdma_irq_clear,
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 28abfc26e7a4..793e6714df8c 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -161,19 +161,6 @@ static int sis_pre_reset(struct ata_link *link, unsigned long deadline)
161 161
162 162
163/** 163/**
164 * sis_error_handler - Probe specified port on PATA host controller
165 * @ap: Port to probe
166 *
167 * LOCKING:
168 * None (inherited from caller).
169 */
170
171static void sis_error_handler(struct ata_port *ap)
172{
173 ata_bmdma_drive_eh(ap, sis_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
174}
175
176/**
177 * sis_set_fifo - Set RWP fifo bits for this device 164 * sis_set_fifo - Set RWP fifo bits for this device
178 * @ap: Port 165 * @ap: Port
179 * @adev: Device 166 * @adev: Device
@@ -526,7 +513,7 @@ static struct ata_port_operations sis_133_for_sata_ops = {
526 513
527static struct ata_port_operations sis_base_ops = { 514static struct ata_port_operations sis_base_ops = {
528 .inherits = &ata_bmdma_port_ops, 515 .inherits = &ata_bmdma_port_ops,
529 .error_handler = sis_error_handler, 516 .prereset = sis_pre_reset,
530}; 517};
531 518
532static struct ata_port_operations sis_133_ops = { 519static struct ata_port_operations sis_133_ops = {
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 1d97f920bd2b..bee11ca8f55a 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -64,12 +64,6 @@ static int sl82c105_pre_reset(struct ata_link *link, unsigned long deadline)
64} 64}
65 65
66 66
67static void sl82c105_error_handler(struct ata_port *ap)
68{
69 ata_bmdma_drive_eh(ap, sl82c105_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
70}
71
72
73/** 67/**
74 * sl82c105_configure_piomode - set chip PIO timing 68 * sl82c105_configure_piomode - set chip PIO timing
75 * @ap: ATA interface 69 * @ap: ATA interface
@@ -245,7 +239,7 @@ static struct ata_port_operations sl82c105_port_ops = {
245 .bmdma_stop = sl82c105_bmdma_stop, 239 .bmdma_stop = sl82c105_bmdma_stop,
246 .cable_detect = ata_cable_40wire, 240 .cable_detect = ata_cable_40wire,
247 .set_piomode = sl82c105_set_piomode, 241 .set_piomode = sl82c105_set_piomode,
248 .error_handler = sl82c105_error_handler, 242 .prereset = sl82c105_pre_reset,
249}; 243};
250 244
251/** 245/**
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index f07b0e5df222..bd546a389ce1 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -71,11 +71,6 @@ static int triflex_prereset(struct ata_link *link, unsigned long deadline)
71 71
72 72
73 73
74static void triflex_error_handler(struct ata_port *ap)
75{
76 ata_bmdma_drive_eh(ap, triflex_prereset, ata_std_softreset, NULL, ata_std_postreset);
77}
78
79/** 74/**
80 * triflex_load_timing - timing configuration 75 * triflex_load_timing - timing configuration
81 * @ap: ATA interface 76 * @ap: ATA interface
@@ -189,7 +184,7 @@ static struct ata_port_operations triflex_port_ops = {
189 .bmdma_stop = triflex_bmdma_stop, 184 .bmdma_stop = triflex_bmdma_stop,
190 .cable_detect = ata_cable_40wire, 185 .cable_detect = ata_cable_40wire,
191 .set_piomode = triflex_set_piomode, 186 .set_piomode = triflex_set_piomode,
192 .error_handler = triflex_error_handler, 187 .prereset = triflex_prereset,
193}; 188};
194 189
195static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) 190static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f4092cbd566f..2928fa173132 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -215,18 +215,6 @@ static int via_pre_reset(struct ata_link *link, unsigned long deadline)
215 215
216 216
217/** 217/**
218 * via_error_handler - reset for VIA chips
219 * @ap: ATA port
220 *
221 * Handle the reset callback for the later chips with cable detect
222 */
223
224static void via_error_handler(struct ata_port *ap)
225{
226 ata_bmdma_drive_eh(ap, via_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
227}
228
229/**
230 * via_do_set_mode - set initial PIO mode data 218 * via_do_set_mode - set initial PIO mode data
231 * @ap: ATA interface 219 * @ap: ATA interface
232 * @adev: ATA device 220 * @adev: ATA device
@@ -343,7 +331,7 @@ static struct ata_port_operations via_port_ops = {
343 .cable_detect = via_cable_detect, 331 .cable_detect = via_cable_detect,
344 .set_piomode = via_set_piomode, 332 .set_piomode = via_set_piomode,
345 .set_dmamode = via_set_dmamode, 333 .set_dmamode = via_set_dmamode,
346 .error_handler = via_error_handler, 334 .prereset = via_pre_reset,
347}; 335};
348 336
349static struct ata_port_operations via_port_ops_noirq = { 337static struct ata_port_operations via_port_ops_noirq = {
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index a5706149af6b..5ed065d0ab4c 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -140,7 +140,7 @@ static void adma_bmdma_stop(struct ata_queued_cmd *qc);
140static u8 adma_bmdma_status(struct ata_port *ap); 140static u8 adma_bmdma_status(struct ata_port *ap);
141static void adma_freeze(struct ata_port *ap); 141static void adma_freeze(struct ata_port *ap);
142static void adma_thaw(struct ata_port *ap); 142static void adma_thaw(struct ata_port *ap);
143static void adma_error_handler(struct ata_port *ap); 143static int adma_prereset(struct ata_link *link, unsigned long deadline);
144 144
145static struct scsi_host_template adma_ata_sht = { 145static struct scsi_host_template adma_ata_sht = {
146 ATA_BASE_SHT(DRV_NAME), 146 ATA_BASE_SHT(DRV_NAME),
@@ -166,7 +166,8 @@ static struct ata_port_operations adma_ata_ops = {
166 166
167 .freeze = adma_freeze, 167 .freeze = adma_freeze,
168 .thaw = adma_thaw, 168 .thaw = adma_thaw,
169 .error_handler = adma_error_handler, 169 .prereset = adma_prereset,
170 .softreset = ata_std_softreset,
170 171
171 .port_start = adma_port_start, 172 .port_start = adma_port_start,
172 .port_stop = adma_port_stop, 173 .port_stop = adma_port_stop,
@@ -292,12 +293,6 @@ static int adma_prereset(struct ata_link *link, unsigned long deadline)
292 return ata_std_prereset(link, deadline); 293 return ata_std_prereset(link, deadline);
293} 294}
294 295
295static void adma_error_handler(struct ata_port *ap)
296{
297 ata_do_eh(ap, adma_prereset, ata_std_softreset, NULL,
298 ata_std_postreset);
299}
300
301static int adma_fill_sg(struct ata_queued_cmd *qc) 296static int adma_fill_sg(struct ata_queued_cmd *qc)
302{ 297{
303 struct scatterlist *sg; 298 struct scatterlist *sg;
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 865030ae8f8a..676302fdaa97 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -912,16 +912,6 @@ err:
912 return -EIO; 912 return -EIO;
913} 913}
914 914
915static void sata_fsl_error_handler(struct ata_port *ap)
916{
917
918 DPRINTK("in xx_error_handler\n");
919
920 /* perform recovery */
921 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset,
922 ata_std_postreset);
923}
924
925static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) 915static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc)
926{ 916{
927 if (qc->flags & ATA_QCFLAG_FAILED) 917 if (qc->flags & ATA_QCFLAG_FAILED)
@@ -1213,7 +1203,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1213 1203
1214 .freeze = sata_fsl_freeze, 1204 .freeze = sata_fsl_freeze,
1215 .thaw = sata_fsl_thaw, 1205 .thaw = sata_fsl_thaw,
1216 .error_handler = sata_fsl_error_handler, 1206 .softreset = sata_fsl_softreset,
1217 .post_internal_cmd = sata_fsl_post_internal_cmd, 1207 .post_internal_cmd = sata_fsl_post_internal_cmd,
1218 1208
1219 .port_start = sata_fsl_port_start, 1209 .port_start = sata_fsl_port_start,
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 047f80f5825c..ba1c09953517 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -452,8 +452,7 @@ static void inic_error_handler(struct ata_port *ap)
452 spin_unlock_irqrestore(ap->lock, flags); 452 spin_unlock_irqrestore(ap->lock, flags);
453 453
454 /* PIO and DMA engines have been stopped, perform recovery */ 454 /* PIO and DMA engines have been stopped, perform recovery */
455 ata_do_eh(ap, ata_std_prereset, NULL, inic_hardreset, 455 ata_std_error_handler(ap);
456 ata_std_postreset);
457} 456}
458 457
459static void inic_post_internal_cmd(struct ata_queued_cmd *qc) 458static void inic_post_internal_cmd(struct ata_queued_cmd *qc)
@@ -532,6 +531,8 @@ static struct ata_port_operations inic_port_ops = {
532 531
533 .freeze = inic_freeze, 532 .freeze = inic_freeze,
534 .thaw = inic_thaw, 533 .thaw = inic_thaw,
534 .softreset = ATA_OP_NULL, /* softreset is broken */
535 .hardreset = inic_hardreset,
535 .error_handler = inic_error_handler, 536 .error_handler = inic_error_handler,
536 .post_internal_cmd = inic_post_internal_cmd, 537 .post_internal_cmd = inic_post_internal_cmd,
537 .dev_config = inic_dev_config, 538 .dev_config = inic_dev_config,
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index f341a82d27bf..9a89390531b1 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -470,7 +470,10 @@ static void mv_port_stop(struct ata_port *ap);
470static void mv_qc_prep(struct ata_queued_cmd *qc); 470static void mv_qc_prep(struct ata_queued_cmd *qc);
471static void mv_qc_prep_iie(struct ata_queued_cmd *qc); 471static void mv_qc_prep_iie(struct ata_queued_cmd *qc);
472static unsigned int mv_qc_issue(struct ata_queued_cmd *qc); 472static unsigned int mv_qc_issue(struct ata_queued_cmd *qc);
473static void mv_error_handler(struct ata_port *ap); 473static int mv_prereset(struct ata_link *link, unsigned long deadline);
474static int mv_hardreset(struct ata_link *link, unsigned int *class,
475 unsigned long deadline);
476static void mv_postreset(struct ata_link *link, unsigned int *classes);
474static void mv_eh_freeze(struct ata_port *ap); 477static void mv_eh_freeze(struct ata_port *ap);
475static void mv_eh_thaw(struct ata_port *ap); 478static void mv_eh_thaw(struct ata_port *ap);
476static void mv6_dev_config(struct ata_device *dev); 479static void mv6_dev_config(struct ata_device *dev);
@@ -534,7 +537,10 @@ static struct ata_port_operations mv5_ops = {
534 537
535 .freeze = mv_eh_freeze, 538 .freeze = mv_eh_freeze,
536 .thaw = mv_eh_thaw, 539 .thaw = mv_eh_thaw,
537 .error_handler = mv_error_handler, 540 .prereset = mv_prereset,
541 .hardreset = mv_hardreset,
542 .postreset = mv_postreset,
543 .error_handler = ata_std_error_handler, /* avoid SFF EH */
538 .post_internal_cmd = ATA_OP_NULL, 544 .post_internal_cmd = ATA_OP_NULL,
539 545
540 .scr_read = mv5_scr_read, 546 .scr_read = mv5_scr_read,
@@ -2415,12 +2421,6 @@ static void mv_postreset(struct ata_link *link, unsigned int *classes)
2415 iowrite8(ap->ctl, ap->ioaddr.ctl_addr); 2421 iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
2416} 2422}
2417 2423
2418static void mv_error_handler(struct ata_port *ap)
2419{
2420 ata_do_eh(ap, mv_prereset, ata_std_softreset,
2421 mv_hardreset, mv_postreset);
2422}
2423
2424static void mv_eh_freeze(struct ata_port *ap) 2424static void mv_eh_freeze(struct ata_port *ap)
2425{ 2425{
2426 struct mv_host_priv *hpriv = ap->host->private_data; 2426 struct mv_host_priv *hpriv = ap->host->private_data;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 5637b082bc85..b2eb5724cf85 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -309,7 +309,8 @@ static void nv_nf2_freeze(struct ata_port *ap);
309static void nv_nf2_thaw(struct ata_port *ap); 309static void nv_nf2_thaw(struct ata_port *ap);
310static void nv_ck804_freeze(struct ata_port *ap); 310static void nv_ck804_freeze(struct ata_port *ap);
311static void nv_ck804_thaw(struct ata_port *ap); 311static void nv_ck804_thaw(struct ata_port *ap);
312static void nv_error_handler(struct ata_port *ap); 312static int nv_hardreset(struct ata_link *link, unsigned int *class,
313 unsigned long deadline);
313static int nv_adma_slave_config(struct scsi_device *sdev); 314static int nv_adma_slave_config(struct scsi_device *sdev);
314static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); 315static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
315static void nv_adma_qc_prep(struct ata_queued_cmd *qc); 316static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
@@ -406,7 +407,7 @@ static struct scsi_host_template nv_swncq_sht = {
406 407
407static struct ata_port_operations nv_generic_ops = { 408static struct ata_port_operations nv_generic_ops = {
408 .inherits = &ata_bmdma_port_ops, 409 .inherits = &ata_bmdma_port_ops,
409 .error_handler = nv_error_handler, 410 .hardreset = nv_hardreset,
410 .scr_read = nv_scr_read, 411 .scr_read = nv_scr_read,
411 .scr_write = nv_scr_write, 412 .scr_write = nv_scr_write,
412}; 413};
@@ -1599,12 +1600,6 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
1599 return sata_std_hardreset(link, &dummy, deadline); 1600 return sata_std_hardreset(link, &dummy, deadline);
1600} 1601}
1601 1602
1602static void nv_error_handler(struct ata_port *ap)
1603{
1604 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset,
1605 nv_hardreset, ata_std_postreset);
1606}
1607
1608static void nv_adma_error_handler(struct ata_port *ap) 1603static void nv_adma_error_handler(struct ata_port *ap)
1609{ 1604{
1610 struct nv_adma_port_priv *pp = ap->private_data; 1605 struct nv_adma_port_priv *pp = ap->private_data;
@@ -1658,8 +1653,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1658 readw(mmio + NV_ADMA_CTL); /* flush posted write */ 1653 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1659 } 1654 }
1660 1655
1661 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, 1656 ata_bmdma_error_handler(ap);
1662 nv_hardreset, ata_std_postreset);
1663} 1657}
1664 1658
1665static void nv_swncq_qc_to_dq(struct ata_port *ap, struct ata_queued_cmd *qc) 1659static void nv_swncq_qc_to_dq(struct ata_port *ap, struct ata_queued_cmd *qc)
@@ -1785,8 +1779,7 @@ static void nv_swncq_error_handler(struct ata_port *ap)
1785 ehc->i.action |= ATA_EH_RESET; 1779 ehc->i.action |= ATA_EH_RESET;
1786 } 1780 }
1787 1781
1788 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, 1782 ata_bmdma_error_handler(ap);
1789 nv_hardreset, ata_std_postreset);
1790} 1783}
1791 1784
1792#ifdef CONFIG_PM 1785#ifdef CONFIG_PM
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index e09b975c973d..91659dc15caf 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -148,8 +148,7 @@ static void pdc_freeze(struct ata_port *ap);
148static void pdc_sata_freeze(struct ata_port *ap); 148static void pdc_sata_freeze(struct ata_port *ap);
149static void pdc_thaw(struct ata_port *ap); 149static void pdc_thaw(struct ata_port *ap);
150static void pdc_sata_thaw(struct ata_port *ap); 150static void pdc_sata_thaw(struct ata_port *ap);
151static void pdc_pata_error_handler(struct ata_port *ap); 151static void pdc_error_handler(struct ata_port *ap);
152static void pdc_sata_error_handler(struct ata_port *ap);
153static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); 152static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
154static int pdc_pata_cable_detect(struct ata_port *ap); 153static int pdc_pata_cable_detect(struct ata_port *ap);
155static int pdc_sata_cable_detect(struct ata_port *ap); 154static int pdc_sata_cable_detect(struct ata_port *ap);
@@ -171,6 +170,7 @@ static const struct ata_port_operations pdc_common_ops = {
171 .irq_clear = pdc_irq_clear, 170 .irq_clear = pdc_irq_clear,
172 171
173 .post_internal_cmd = pdc_post_internal_cmd, 172 .post_internal_cmd = pdc_post_internal_cmd,
173 .error_handler = pdc_error_handler,
174}; 174};
175 175
176static struct ata_port_operations pdc_sata_ops = { 176static struct ata_port_operations pdc_sata_ops = {
@@ -178,7 +178,6 @@ static struct ata_port_operations pdc_sata_ops = {
178 .cable_detect = pdc_sata_cable_detect, 178 .cable_detect = pdc_sata_cable_detect,
179 .freeze = pdc_sata_freeze, 179 .freeze = pdc_sata_freeze,
180 .thaw = pdc_sata_thaw, 180 .thaw = pdc_sata_thaw,
181 .error_handler = pdc_sata_error_handler,
182 .scr_read = pdc_sata_scr_read, 181 .scr_read = pdc_sata_scr_read,
183 .scr_write = pdc_sata_scr_write, 182 .scr_write = pdc_sata_scr_write,
184 .port_start = pdc_sata_port_start, 183 .port_start = pdc_sata_port_start,
@@ -195,7 +194,6 @@ static struct ata_port_operations pdc_pata_ops = {
195 .cable_detect = pdc_pata_cable_detect, 194 .cable_detect = pdc_pata_cable_detect,
196 .freeze = pdc_freeze, 195 .freeze = pdc_freeze,
197 .thaw = pdc_thaw, 196 .thaw = pdc_thaw,
198 .error_handler = pdc_pata_error_handler,
199 .port_start = pdc_common_port_start, 197 .port_start = pdc_common_port_start,
200}; 198};
201 199
@@ -694,24 +692,12 @@ static void pdc_sata_thaw(struct ata_port *ap)
694 readl(host_mmio + hotplug_offset); /* flush */ 692 readl(host_mmio + hotplug_offset); /* flush */
695} 693}
696 694
697static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset) 695static void pdc_error_handler(struct ata_port *ap)
698{ 696{
699 if (!(ap->pflags & ATA_PFLAG_FROZEN)) 697 if (!(ap->pflags & ATA_PFLAG_FROZEN))
700 pdc_reset_port(ap); 698 pdc_reset_port(ap);
701 699
702 /* perform recovery */ 700 ata_std_error_handler(ap);
703 ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
704 ata_std_postreset);
705}
706
707static void pdc_pata_error_handler(struct ata_port *ap)
708{
709 pdc_common_error_handler(ap, NULL);
710}
711
712static void pdc_sata_error_handler(struct ata_port *ap)
713{
714 pdc_common_error_handler(ap, sata_std_hardreset);
715} 701}
716 702
717static void pdc_post_internal_cmd(struct ata_queued_cmd *qc) 703static void pdc_post_internal_cmd(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 107ef09814de..2ceb0990bcd8 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -123,6 +123,7 @@ static void qs_bmdma_stop(struct ata_queued_cmd *qc);
123static u8 qs_bmdma_status(struct ata_port *ap); 123static u8 qs_bmdma_status(struct ata_port *ap);
124static void qs_freeze(struct ata_port *ap); 124static void qs_freeze(struct ata_port *ap);
125static void qs_thaw(struct ata_port *ap); 125static void qs_thaw(struct ata_port *ap);
126static int qs_prereset(struct ata_link *link, unsigned long deadline);
126static void qs_error_handler(struct ata_port *ap); 127static void qs_error_handler(struct ata_port *ap);
127 128
128static struct scsi_host_template qs_ata_sht = { 129static struct scsi_host_template qs_ata_sht = {
@@ -142,6 +143,8 @@ static struct ata_port_operations qs_ata_ops = {
142 143
143 .freeze = qs_freeze, 144 .freeze = qs_freeze,
144 .thaw = qs_thaw, 145 .thaw = qs_thaw,
146 .prereset = qs_prereset,
147 .softreset = ATA_OP_NULL,
145 .error_handler = qs_error_handler, 148 .error_handler = qs_error_handler,
146 .post_internal_cmd = ATA_OP_NULL, 149 .post_internal_cmd = ATA_OP_NULL,
147 150
@@ -250,8 +253,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
250static void qs_error_handler(struct ata_port *ap) 253static void qs_error_handler(struct ata_port *ap)
251{ 254{
252 qs_enter_reg_mode(ap); 255 qs_enter_reg_mode(ap);
253 ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset, 256 ata_std_error_handler(ap);
254 ata_std_postreset);
255} 257}
256 258
257static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 259static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 363fb90e1047..67df1d753305 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -352,6 +352,14 @@ static void sil24_pmp_attach(struct ata_port *ap);
352static void sil24_pmp_detach(struct ata_port *ap); 352static void sil24_pmp_detach(struct ata_port *ap);
353static void sil24_freeze(struct ata_port *ap); 353static void sil24_freeze(struct ata_port *ap);
354static void sil24_thaw(struct ata_port *ap); 354static void sil24_thaw(struct ata_port *ap);
355static int sil24_softreset(struct ata_link *link, unsigned int *class,
356 unsigned long deadline);
357static int sil24_hardreset(struct ata_link *link, unsigned int *class,
358 unsigned long deadline);
359static int sil24_pmp_softreset(struct ata_link *link, unsigned int *class,
360 unsigned long deadline);
361static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class,
362 unsigned long deadline);
355static void sil24_error_handler(struct ata_port *ap); 363static void sil24_error_handler(struct ata_port *ap);
356static void sil24_post_internal_cmd(struct ata_queued_cmd *qc); 364static void sil24_post_internal_cmd(struct ata_queued_cmd *qc);
357static int sil24_port_start(struct ata_port *ap); 365static int sil24_port_start(struct ata_port *ap);
@@ -402,6 +410,10 @@ static struct ata_port_operations sil24_ops = {
402 410
403 .freeze = sil24_freeze, 411 .freeze = sil24_freeze,
404 .thaw = sil24_thaw, 412 .thaw = sil24_thaw,
413 .softreset = sil24_softreset,
414 .hardreset = sil24_hardreset,
415 .pmp_softreset = sil24_pmp_softreset,
416 .pmp_hardreset = sil24_pmp_hardreset,
405 .error_handler = sil24_error_handler, 417 .error_handler = sil24_error_handler,
406 .post_internal_cmd = sil24_post_internal_cmd, 418 .post_internal_cmd = sil24_post_internal_cmd,
407 .dev_config = sil24_dev_config, 419 .dev_config = sil24_dev_config,
@@ -1181,11 +1193,7 @@ static void sil24_error_handler(struct ata_port *ap)
1181 if (sil24_init_port(ap)) 1193 if (sil24_init_port(ap))
1182 ata_eh_freeze_port(ap); 1194 ata_eh_freeze_port(ap);
1183 1195
1184 /* perform recovery */ 1196 sata_pmp_error_handler(ap);
1185 sata_pmp_do_eh(ap, ata_std_prereset, sil24_softreset, sil24_hardreset,
1186 ata_std_postreset, sata_pmp_std_prereset,
1187 sil24_pmp_softreset, sil24_pmp_hardreset,
1188 sata_pmp_std_postreset);
1189 1197
1190 pp->do_port_rst = 0; 1198 pp->do_port_rst = 0;
1191} 1199}
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 6326bcf8ea5d..402fd7333d48 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -71,7 +71,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
71static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 71static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
72static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 72static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
73static void svia_noop_freeze(struct ata_port *ap); 73static void svia_noop_freeze(struct ata_port *ap);
74static void vt6420_error_handler(struct ata_port *ap); 74static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
75static int vt6421_pata_cable_detect(struct ata_port *ap); 75static int vt6421_pata_cable_detect(struct ata_port *ap);
76static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); 76static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev);
77static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); 77static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);
@@ -106,7 +106,7 @@ static struct scsi_host_template svia_sht = {
106static struct ata_port_operations vt6420_sata_ops = { 106static struct ata_port_operations vt6420_sata_ops = {
107 .inherits = &ata_bmdma_port_ops, 107 .inherits = &ata_bmdma_port_ops,
108 .freeze = svia_noop_freeze, 108 .freeze = svia_noop_freeze,
109 .error_handler = vt6420_error_handler, 109 .prereset = vt6420_prereset,
110}; 110};
111 111
112static struct ata_port_operations vt6421_pata_ops = { 112static struct ata_port_operations vt6421_pata_ops = {
@@ -247,12 +247,6 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
247 return 0; 247 return 0;
248} 248}
249 249
250static void vt6420_error_handler(struct ata_port *ap)
251{
252 ata_bmdma_drive_eh(ap, vt6420_prereset, ata_std_softreset, NULL,
253 ata_std_postreset);
254}
255
256static int vt6421_pata_cable_detect(struct ata_port *ap) 250static int vt6421_pata_cable_detect(struct ata_port *ap)
257{ 251{
258 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 252 struct pci_dev *pdev = to_pci_dev(ap->host->dev);