diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:31 -0400 |
commit | 0260731f0187840e272bfa10d3ba0f3e417976f5 (patch) | |
tree | d39219275e89ce782f3151b5ac47726957a81e24 /drivers/ata/libata-eh.c | |
parent | cc0680a580b5be81a1ca321b58f8e9b80b5c1052 (diff) |
libata-link: linkify config/EH related functions
Make the following functions deal with ata_link instead of ata_port.
* ata_set_mode()
* ata_eh_autopsy() and related functions
* ata_eh_report() and related functions
* suspend/resume related functions
* ata_eh_recover() and related functions
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 121 |
1 files changed, 63 insertions, 58 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 0a9ce34a0e6..733aa761f3e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1201,7 +1201,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1201 | 1201 | ||
1202 | /** | 1202 | /** |
1203 | * ata_eh_analyze_serror - analyze SError for a failed port | 1203 | * ata_eh_analyze_serror - analyze SError for a failed port |
1204 | * @ap: ATA port to analyze SError for | 1204 | * @link: ATA link to analyze SError for |
1205 | * | 1205 | * |
1206 | * Analyze SError if available and further determine cause of | 1206 | * Analyze SError if available and further determine cause of |
1207 | * failure. | 1207 | * failure. |
@@ -1209,9 +1209,9 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1209 | * LOCKING: | 1209 | * LOCKING: |
1210 | * None. | 1210 | * None. |
1211 | */ | 1211 | */ |
1212 | static void ata_eh_analyze_serror(struct ata_port *ap) | 1212 | static void ata_eh_analyze_serror(struct ata_link *link) |
1213 | { | 1213 | { |
1214 | struct ata_eh_context *ehc = &ap->link.eh_context; | 1214 | struct ata_eh_context *ehc = &link->eh_context; |
1215 | u32 serror = ehc->i.serror; | 1215 | u32 serror = ehc->i.serror; |
1216 | unsigned int err_mask = 0, action = 0; | 1216 | unsigned int err_mask = 0, action = 0; |
1217 | 1217 | ||
@@ -1241,7 +1241,7 @@ static void ata_eh_analyze_serror(struct ata_port *ap) | |||
1241 | 1241 | ||
1242 | /** | 1242 | /** |
1243 | * ata_eh_analyze_ncq_error - analyze NCQ error | 1243 | * ata_eh_analyze_ncq_error - analyze NCQ error |
1244 | * @ap: ATA port to analyze NCQ error for | 1244 | * @link: ATA link to analyze NCQ error for |
1245 | * | 1245 | * |
1246 | * Read log page 10h, determine the offending qc and acquire | 1246 | * Read log page 10h, determine the offending qc and acquire |
1247 | * error status TF. For NCQ device errors, all LLDDs have to do | 1247 | * error status TF. For NCQ device errors, all LLDDs have to do |
@@ -1251,10 +1251,11 @@ static void ata_eh_analyze_serror(struct ata_port *ap) | |||
1251 | * LOCKING: | 1251 | * LOCKING: |
1252 | * Kernel thread context (may sleep). | 1252 | * Kernel thread context (may sleep). |
1253 | */ | 1253 | */ |
1254 | static void ata_eh_analyze_ncq_error(struct ata_port *ap) | 1254 | static void ata_eh_analyze_ncq_error(struct ata_link *link) |
1255 | { | 1255 | { |
1256 | struct ata_eh_context *ehc = &ap->link.eh_context; | 1256 | struct ata_port *ap = link->ap; |
1257 | struct ata_device *dev = ap->link.device; | 1257 | struct ata_eh_context *ehc = &link->eh_context; |
1258 | struct ata_device *dev = link->device; | ||
1258 | struct ata_queued_cmd *qc; | 1259 | struct ata_queued_cmd *qc; |
1259 | struct ata_taskfile tf; | 1260 | struct ata_taskfile tf; |
1260 | int tag, rc; | 1261 | int tag, rc; |
@@ -1264,7 +1265,7 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap) | |||
1264 | return; | 1265 | return; |
1265 | 1266 | ||
1266 | /* is it NCQ device error? */ | 1267 | /* is it NCQ device error? */ |
1267 | if (!ap->link.sactive || !(ehc->i.err_mask & AC_ERR_DEV)) | 1268 | if (!link->sactive || !(ehc->i.err_mask & AC_ERR_DEV)) |
1268 | return; | 1269 | return; |
1269 | 1270 | ||
1270 | /* has LLDD analyzed already? */ | 1271 | /* has LLDD analyzed already? */ |
@@ -1281,13 +1282,13 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap) | |||
1281 | /* okay, this error is ours */ | 1282 | /* okay, this error is ours */ |
1282 | rc = ata_eh_read_log_10h(dev, &tag, &tf); | 1283 | rc = ata_eh_read_log_10h(dev, &tag, &tf); |
1283 | if (rc) { | 1284 | if (rc) { |
1284 | ata_port_printk(ap, KERN_ERR, "failed to read log page 10h " | 1285 | ata_link_printk(link, KERN_ERR, "failed to read log page 10h " |
1285 | "(errno=%d)\n", rc); | 1286 | "(errno=%d)\n", rc); |
1286 | return; | 1287 | return; |
1287 | } | 1288 | } |
1288 | 1289 | ||
1289 | if (!(ap->link.sactive & (1 << tag))) { | 1290 | if (!(link->sactive & (1 << tag))) { |
1290 | ata_port_printk(ap, KERN_ERR, "log page 10h reported " | 1291 | ata_link_printk(link, KERN_ERR, "log page 10h reported " |
1291 | "inactive tag %d\n", tag); | 1292 | "inactive tag %d\n", tag); |
1292 | return; | 1293 | return; |
1293 | } | 1294 | } |
@@ -1551,18 +1552,18 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io, | |||
1551 | 1552 | ||
1552 | /** | 1553 | /** |
1553 | * ata_eh_autopsy - analyze error and determine recovery action | 1554 | * ata_eh_autopsy - analyze error and determine recovery action |
1554 | * @ap: ATA port to perform autopsy on | 1555 | * @link: ATA link to perform autopsy on |
1555 | * | 1556 | * |
1556 | * Analyze why @ap failed and determine which recovery action is | 1557 | * Analyze why @link failed and determine which recovery actions |
1557 | * needed. This function also sets more detailed AC_ERR_* values | 1558 | * are needed. This function also sets more detailed AC_ERR_* |
1558 | * and fills sense data for ATAPI CHECK SENSE. | 1559 | * values and fills sense data for ATAPI CHECK SENSE. |
1559 | * | 1560 | * |
1560 | * LOCKING: | 1561 | * LOCKING: |
1561 | * Kernel thread context (may sleep). | 1562 | * Kernel thread context (may sleep). |
1562 | */ | 1563 | */ |
1563 | static void ata_eh_autopsy(struct ata_port *ap) | 1564 | static void ata_eh_autopsy(struct ata_link *link) |
1564 | { | 1565 | { |
1565 | struct ata_link *link = &ap->link; | 1566 | struct ata_port *ap = link->ap; |
1566 | struct ata_eh_context *ehc = &link->eh_context; | 1567 | struct ata_eh_context *ehc = &link->eh_context; |
1567 | unsigned int all_err_mask = 0; | 1568 | unsigned int all_err_mask = 0; |
1568 | int tag, is_io = 0; | 1569 | int tag, is_io = 0; |
@@ -1578,7 +1579,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1578 | rc = sata_scr_read(link, SCR_ERROR, &serror); | 1579 | rc = sata_scr_read(link, SCR_ERROR, &serror); |
1579 | if (rc == 0) { | 1580 | if (rc == 0) { |
1580 | ehc->i.serror |= serror; | 1581 | ehc->i.serror |= serror; |
1581 | ata_eh_analyze_serror(ap); | 1582 | ata_eh_analyze_serror(link); |
1582 | } else if (rc != -EOPNOTSUPP) { | 1583 | } else if (rc != -EOPNOTSUPP) { |
1583 | /* SError read failed, force hardreset and probing */ | 1584 | /* SError read failed, force hardreset and probing */ |
1584 | ata_ehi_schedule_probe(&ehc->i); | 1585 | ata_ehi_schedule_probe(&ehc->i); |
@@ -1587,7 +1588,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | /* analyze NCQ failure */ | 1590 | /* analyze NCQ failure */ |
1590 | ata_eh_analyze_ncq_error(ap); | 1591 | ata_eh_analyze_ncq_error(link); |
1591 | 1592 | ||
1592 | /* any real error trumps AC_ERR_OTHER */ | 1593 | /* any real error trumps AC_ERR_OTHER */ |
1593 | if (ehc->i.err_mask & ~AC_ERR_OTHER) | 1594 | if (ehc->i.err_mask & ~AC_ERR_OTHER) |
@@ -1598,7 +1599,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1598 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1599 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1599 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1600 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1600 | 1601 | ||
1601 | if (!(qc->flags & ATA_QCFLAG_FAILED)) | 1602 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) |
1602 | continue; | 1603 | continue; |
1603 | 1604 | ||
1604 | /* inherit upper level err_mask */ | 1605 | /* inherit upper level err_mask */ |
@@ -1653,16 +1654,17 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1653 | 1654 | ||
1654 | /** | 1655 | /** |
1655 | * ata_eh_report - report error handling to user | 1656 | * ata_eh_report - report error handling to user |
1656 | * @ap: ATA port EH is going on | 1657 | * @link: ATA link EH is going on |
1657 | * | 1658 | * |
1658 | * Report EH to user. | 1659 | * Report EH to user. |
1659 | * | 1660 | * |
1660 | * LOCKING: | 1661 | * LOCKING: |
1661 | * None. | 1662 | * None. |
1662 | */ | 1663 | */ |
1663 | static void ata_eh_report(struct ata_port *ap) | 1664 | static void ata_eh_report(struct ata_link *link) |
1664 | { | 1665 | { |
1665 | struct ata_eh_context *ehc = &ap->link.eh_context; | 1666 | struct ata_port *ap = link->ap; |
1667 | struct ata_eh_context *ehc = &link->eh_context; | ||
1666 | const char *frozen, *desc; | 1668 | const char *frozen, *desc; |
1667 | int tag, nr_failed = 0; | 1669 | int tag, nr_failed = 0; |
1668 | 1670 | ||
@@ -1673,7 +1675,7 @@ static void ata_eh_report(struct ata_port *ap) | |||
1673 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1675 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1674 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1676 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1675 | 1677 | ||
1676 | if (!(qc->flags & ATA_QCFLAG_FAILED)) | 1678 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) |
1677 | continue; | 1679 | continue; |
1678 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) | 1680 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) |
1679 | continue; | 1681 | continue; |
@@ -1691,17 +1693,17 @@ static void ata_eh_report(struct ata_port *ap) | |||
1691 | if (ehc->i.dev) { | 1693 | if (ehc->i.dev) { |
1692 | ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " | 1694 | ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " |
1693 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", | 1695 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", |
1694 | ehc->i.err_mask, ap->link.sactive, | 1696 | ehc->i.err_mask, link->sactive, |
1695 | ehc->i.serror, ehc->i.action, frozen); | 1697 | ehc->i.serror, ehc->i.action, frozen); |
1696 | if (desc) | 1698 | if (desc) |
1697 | ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); | 1699 | ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); |
1698 | } else { | 1700 | } else { |
1699 | ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x " | 1701 | ata_link_printk(link, KERN_ERR, "exception Emask 0x%x " |
1700 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", | 1702 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", |
1701 | ehc->i.err_mask, ap->link.sactive, | 1703 | ehc->i.err_mask, link->sactive, |
1702 | ehc->i.serror, ehc->i.action, frozen); | 1704 | ehc->i.serror, ehc->i.action, frozen); |
1703 | if (desc) | 1705 | if (desc) |
1704 | ata_port_printk(ap, KERN_ERR, "%s\n", desc); | 1706 | ata_link_printk(link, KERN_ERR, "%s\n", desc); |
1705 | } | 1707 | } |
1706 | 1708 | ||
1707 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1709 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
@@ -1714,7 +1716,8 @@ static void ata_eh_report(struct ata_port *ap) | |||
1714 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1716 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1715 | struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; | 1717 | struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; |
1716 | 1718 | ||
1717 | if (!(qc->flags & ATA_QCFLAG_FAILED) || !qc->err_mask) | 1719 | if (!(qc->flags & ATA_QCFLAG_FAILED) || |
1720 | qc->dev->link != link || !qc->err_mask) | ||
1718 | continue; | 1721 | continue; |
1719 | 1722 | ||
1720 | ata_dev_printk(qc->dev, KERN_ERR, | 1723 | ata_dev_printk(qc->dev, KERN_ERR, |
@@ -1936,10 +1939,11 @@ static int ata_eh_reset(struct ata_link *link, int classify, | |||
1936 | return rc; | 1939 | return rc; |
1937 | } | 1940 | } |
1938 | 1941 | ||
1939 | static int ata_eh_revalidate_and_attach(struct ata_port *ap, | 1942 | static int ata_eh_revalidate_and_attach(struct ata_link *link, |
1940 | struct ata_device **r_failed_dev) | 1943 | struct ata_device **r_failed_dev) |
1941 | { | 1944 | { |
1942 | struct ata_eh_context *ehc = &ap->link.eh_context; | 1945 | struct ata_port *ap = link->ap; |
1946 | struct ata_eh_context *ehc = &link->eh_context; | ||
1943 | struct ata_device *dev; | 1947 | struct ata_device *dev; |
1944 | unsigned int new_mask = 0; | 1948 | unsigned int new_mask = 0; |
1945 | unsigned long flags; | 1949 | unsigned long flags; |
@@ -1951,7 +1955,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1951 | * be done backwards such that PDIAG- is released by the slave | 1955 | * be done backwards such that PDIAG- is released by the slave |
1952 | * device before the master device is identified. | 1956 | * device before the master device is identified. |
1953 | */ | 1957 | */ |
1954 | ata_link_for_each_dev_reverse(dev, &ap->link) { | 1958 | ata_link_for_each_dev_reverse(dev, link) { |
1955 | unsigned int action = ata_eh_dev_action(dev); | 1959 | unsigned int action = ata_eh_dev_action(dev); |
1956 | unsigned int readid_flags = 0; | 1960 | unsigned int readid_flags = 0; |
1957 | 1961 | ||
@@ -1959,17 +1963,17 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1959 | readid_flags |= ATA_READID_POSTRESET; | 1963 | readid_flags |= ATA_READID_POSTRESET; |
1960 | 1964 | ||
1961 | if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { | 1965 | if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { |
1962 | if (ata_link_offline(&ap->link)) { | 1966 | if (ata_link_offline(link)) { |
1963 | rc = -EIO; | 1967 | rc = -EIO; |
1964 | goto err; | 1968 | goto err; |
1965 | } | 1969 | } |
1966 | 1970 | ||
1967 | ata_eh_about_to_do(&ap->link, dev, ATA_EH_REVALIDATE); | 1971 | ata_eh_about_to_do(link, dev, ATA_EH_REVALIDATE); |
1968 | rc = ata_dev_revalidate(dev, readid_flags); | 1972 | rc = ata_dev_revalidate(dev, readid_flags); |
1969 | if (rc) | 1973 | if (rc) |
1970 | goto err; | 1974 | goto err; |
1971 | 1975 | ||
1972 | ata_eh_done(&ap->link, dev, ATA_EH_REVALIDATE); | 1976 | ata_eh_done(link, dev, ATA_EH_REVALIDATE); |
1973 | 1977 | ||
1974 | /* Configuration may have changed, reconfigure | 1978 | /* Configuration may have changed, reconfigure |
1975 | * transfer mode. | 1979 | * transfer mode. |
@@ -2011,7 +2015,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
2011 | /* Configure new devices forward such that user doesn't see | 2015 | /* Configure new devices forward such that user doesn't see |
2012 | * device detection messages backwards. | 2016 | * device detection messages backwards. |
2013 | */ | 2017 | */ |
2014 | ata_link_for_each_dev(dev, &ap->link) { | 2018 | ata_link_for_each_dev(dev, link) { |
2015 | if (!(new_mask & (1 << dev->devno))) | 2019 | if (!(new_mask & (1 << dev->devno))) |
2016 | continue; | 2020 | continue; |
2017 | 2021 | ||
@@ -2037,40 +2041,40 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
2037 | return rc; | 2041 | return rc; |
2038 | } | 2042 | } |
2039 | 2043 | ||
2040 | static int ata_port_nr_enabled(struct ata_port *ap) | 2044 | static int ata_link_nr_enabled(struct ata_link *link) |
2041 | { | 2045 | { |
2042 | struct ata_device *dev; | 2046 | struct ata_device *dev; |
2043 | int cnt = 0; | 2047 | int cnt = 0; |
2044 | 2048 | ||
2045 | ata_link_for_each_dev(dev, &ap->link) | 2049 | ata_link_for_each_dev(dev, link) |
2046 | if (ata_dev_enabled(dev)) | 2050 | if (ata_dev_enabled(dev)) |
2047 | cnt++; | 2051 | cnt++; |
2048 | return cnt; | 2052 | return cnt; |
2049 | } | 2053 | } |
2050 | 2054 | ||
2051 | static int ata_port_nr_vacant(struct ata_port *ap) | 2055 | static int ata_link_nr_vacant(struct ata_link *link) |
2052 | { | 2056 | { |
2053 | struct ata_device *dev; | 2057 | struct ata_device *dev; |
2054 | int cnt = 0; | 2058 | int cnt = 0; |
2055 | 2059 | ||
2056 | ata_link_for_each_dev(dev, &ap->link) | 2060 | ata_link_for_each_dev(dev, link) |
2057 | if (dev->class == ATA_DEV_UNKNOWN) | 2061 | if (dev->class == ATA_DEV_UNKNOWN) |
2058 | cnt++; | 2062 | cnt++; |
2059 | return cnt; | 2063 | return cnt; |
2060 | } | 2064 | } |
2061 | 2065 | ||
2062 | static int ata_eh_skip_recovery(struct ata_port *ap) | 2066 | static int ata_eh_skip_recovery(struct ata_link *link) |
2063 | { | 2067 | { |
2064 | struct ata_eh_context *ehc = &ap->link.eh_context; | 2068 | struct ata_eh_context *ehc = &link->eh_context; |
2065 | struct ata_device *dev; | 2069 | struct ata_device *dev; |
2066 | 2070 | ||
2067 | /* thaw frozen port, resume link and recover failed devices */ | 2071 | /* thaw frozen port, resume link and recover failed devices */ |
2068 | if ((ap->pflags & ATA_PFLAG_FROZEN) || | 2072 | if ((link->ap->pflags & ATA_PFLAG_FROZEN) || |
2069 | (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) | 2073 | (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_link_nr_enabled(link)) |
2070 | return 0; | 2074 | return 0; |
2071 | 2075 | ||
2072 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ | 2076 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ |
2073 | ata_link_for_each_dev(dev, &ap->link) { | 2077 | ata_link_for_each_dev(dev, link) { |
2074 | if (dev->class == ATA_DEV_UNKNOWN && | 2078 | if (dev->class == ATA_DEV_UNKNOWN && |
2075 | ehc->classes[dev->devno] != ATA_DEV_NONE) | 2079 | ehc->classes[dev->devno] != ATA_DEV_NONE) |
2076 | return 0; | 2080 | return 0; |
@@ -2154,14 +2158,15 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2154 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 2158 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
2155 | ata_postreset_fn_t postreset) | 2159 | ata_postreset_fn_t postreset) |
2156 | { | 2160 | { |
2157 | struct ata_eh_context *ehc = &ap->link.eh_context; | 2161 | struct ata_link *link = &ap->link; |
2162 | struct ata_eh_context *ehc = &link->eh_context; | ||
2158 | struct ata_device *dev; | 2163 | struct ata_device *dev; |
2159 | int rc; | 2164 | int rc; |
2160 | 2165 | ||
2161 | DPRINTK("ENTER\n"); | 2166 | DPRINTK("ENTER\n"); |
2162 | 2167 | ||
2163 | /* prep for recovery */ | 2168 | /* prep for recovery */ |
2164 | ata_link_for_each_dev(dev, &ap->link) { | 2169 | ata_link_for_each_dev(dev, link) { |
2165 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; | 2170 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; |
2166 | 2171 | ||
2167 | /* collect port action mask recorded in dev actions */ | 2172 | /* collect port action mask recorded in dev actions */ |
@@ -2191,20 +2196,20 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2191 | goto out; | 2196 | goto out; |
2192 | 2197 | ||
2193 | /* skip EH if possible. */ | 2198 | /* skip EH if possible. */ |
2194 | if (ata_eh_skip_recovery(ap)) | 2199 | if (ata_eh_skip_recovery(link)) |
2195 | ehc->i.action = 0; | 2200 | ehc->i.action = 0; |
2196 | 2201 | ||
2197 | ata_link_for_each_dev(dev, &ap->link) | 2202 | ata_link_for_each_dev(dev, link) |
2198 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; | 2203 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; |
2199 | 2204 | ||
2200 | /* reset */ | 2205 | /* reset */ |
2201 | if (ehc->i.action & ATA_EH_RESET_MASK) { | 2206 | if (ehc->i.action & ATA_EH_RESET_MASK) { |
2202 | ata_eh_freeze_port(ap); | 2207 | ata_eh_freeze_port(ap); |
2203 | 2208 | ||
2204 | rc = ata_eh_reset(&ap->link, ata_port_nr_vacant(ap), prereset, | 2209 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), prereset, |
2205 | softreset, hardreset, postreset); | 2210 | softreset, hardreset, postreset); |
2206 | if (rc) { | 2211 | if (rc) { |
2207 | ata_port_printk(ap, KERN_ERR, | 2212 | ata_link_printk(link, KERN_ERR, |
2208 | "reset failed, giving up\n"); | 2213 | "reset failed, giving up\n"); |
2209 | goto out; | 2214 | goto out; |
2210 | } | 2215 | } |
@@ -2213,13 +2218,13 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2213 | } | 2218 | } |
2214 | 2219 | ||
2215 | /* revalidate existing devices and attach new ones */ | 2220 | /* revalidate existing devices and attach new ones */ |
2216 | rc = ata_eh_revalidate_and_attach(ap, &dev); | 2221 | rc = ata_eh_revalidate_and_attach(link, &dev); |
2217 | if (rc) | 2222 | if (rc) |
2218 | goto dev_fail; | 2223 | goto dev_fail; |
2219 | 2224 | ||
2220 | /* configure transfer mode if necessary */ | 2225 | /* configure transfer mode if necessary */ |
2221 | if (ehc->i.flags & ATA_EHI_SETMODE) { | 2226 | if (ehc->i.flags & ATA_EHI_SETMODE) { |
2222 | rc = ata_set_mode(ap, &dev); | 2227 | rc = ata_set_mode(link, &dev); |
2223 | if (rc) | 2228 | if (rc) |
2224 | goto dev_fail; | 2229 | goto dev_fail; |
2225 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 2230 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
@@ -2230,8 +2235,8 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2230 | dev_fail: | 2235 | dev_fail: |
2231 | ata_eh_handle_dev_fail(dev, rc); | 2236 | ata_eh_handle_dev_fail(dev, rc); |
2232 | 2237 | ||
2233 | if (ata_port_nr_enabled(ap)) { | 2238 | if (ata_link_nr_enabled(link)) { |
2234 | ata_port_printk(ap, KERN_WARNING, "failed to recover some " | 2239 | ata_link_printk(link, KERN_WARNING, "failed to recover some " |
2235 | "devices, retrying in 5 secs\n"); | 2240 | "devices, retrying in 5 secs\n"); |
2236 | ssleep(5); | 2241 | ssleep(5); |
2237 | } else { | 2242 | } else { |
@@ -2243,7 +2248,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2243 | 2248 | ||
2244 | out: | 2249 | out: |
2245 | if (rc) { | 2250 | if (rc) { |
2246 | ata_link_for_each_dev(dev, &ap->link); | 2251 | ata_link_for_each_dev(dev, link); |
2247 | ata_dev_disable(dev); | 2252 | ata_dev_disable(dev); |
2248 | } | 2253 | } |
2249 | 2254 | ||
@@ -2310,8 +2315,8 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2310 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 2315 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
2311 | ata_postreset_fn_t postreset) | 2316 | ata_postreset_fn_t postreset) |
2312 | { | 2317 | { |
2313 | ata_eh_autopsy(ap); | 2318 | ata_eh_autopsy(&ap->link); |
2314 | ata_eh_report(ap); | 2319 | ata_eh_report(&ap->link); |
2315 | ata_eh_recover(ap, prereset, softreset, hardreset, postreset); | 2320 | ata_eh_recover(ap, prereset, softreset, hardreset, postreset); |
2316 | ata_eh_finish(ap); | 2321 | ata_eh_finish(ap); |
2317 | } | 2322 | } |