aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 05:36:23 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:30 -0400
commit936fd7328657884d5a69a55666c74a55aa83ca27 (patch)
tree83a78a02d2c65ce835fe33882dfe5043d3240bff /drivers/ata/libata-eh.c
parentf58229f8060055b08b34008ea08f31de1e2f003c (diff)
libata-link: linkify PHY-related functions
Make the following PHY-related functions to deal with ata_link instead of ata_port. * sata_print_link_status() * sata_down_spd_limit() * ata_set_sata_spd_limit() and friends * sata_link_debounce/resume() * sata_scr_valid/read/write/write_flush() * ata_link_on/offline() This patch introduces no behavior change. 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.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8c37ec0bbf6c..48ca68b3979b 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1501,7 +1501,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io,
1501 /* speed down? */ 1501 /* speed down? */
1502 if (verdict & ATA_EH_SPDN_SPEED_DOWN) { 1502 if (verdict & ATA_EH_SPDN_SPEED_DOWN) {
1503 /* speed down SATA link speed if possible */ 1503 /* speed down SATA link speed if possible */
1504 if (sata_down_spd_limit(dev->link->ap) == 0) { 1504 if (sata_down_spd_limit(dev->link) == 0) {
1505 action |= ATA_EH_HARDRESET; 1505 action |= ATA_EH_HARDRESET;
1506 goto done; 1506 goto done;
1507 } 1507 }
@@ -1561,7 +1561,8 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io,
1561 */ 1561 */
1562static void ata_eh_autopsy(struct ata_port *ap) 1562static void ata_eh_autopsy(struct ata_port *ap)
1563{ 1563{
1564 struct ata_eh_context *ehc = &ap->link.eh_context; 1564 struct ata_link *link = &ap->link;
1565 struct ata_eh_context *ehc = &link->eh_context;
1565 unsigned int all_err_mask = 0; 1566 unsigned int all_err_mask = 0;
1566 int tag, is_io = 0; 1567 int tag, is_io = 0;
1567 u32 serror; 1568 u32 serror;
@@ -1573,7 +1574,7 @@ static void ata_eh_autopsy(struct ata_port *ap)
1573 return; 1574 return;
1574 1575
1575 /* obtain and analyze SError */ 1576 /* obtain and analyze SError */
1576 rc = sata_scr_read(ap, SCR_ERROR, &serror); 1577 rc = sata_scr_read(link, SCR_ERROR, &serror);
1577 if (rc == 0) { 1578 if (rc == 0) {
1578 ehc->i.serror |= serror; 1579 ehc->i.serror |= serror;
1579 ata_eh_analyze_serror(ap); 1580 ata_eh_analyze_serror(ap);
@@ -1782,7 +1783,8 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1782 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 1783 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1783 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 1784 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
1784{ 1785{
1785 struct ata_eh_context *ehc = &ap->link.eh_context; 1786 struct ata_link *link = &ap->link;
1787 struct ata_eh_context *ehc = &link->eh_context;
1786 unsigned int *classes = ehc->classes; 1788 unsigned int *classes = ehc->classes;
1787 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 1789 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
1788 int try = 0; 1790 int try = 0;
@@ -1800,7 +1802,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1800 */ 1802 */
1801 action = ehc->i.action; 1803 action = ehc->i.action;
1802 ehc->i.action &= ~ATA_EH_RESET_MASK; 1804 ehc->i.action &= ~ATA_EH_RESET_MASK;
1803 if (softreset && (!hardreset || (!sata_set_spd_needed(ap) && 1805 if (softreset && (!hardreset || (!sata_set_spd_needed(link) &&
1804 !(action & ATA_EH_HARDRESET)))) 1806 !(action & ATA_EH_HARDRESET))))
1805 ehc->i.action |= ATA_EH_SOFTRESET; 1807 ehc->i.action |= ATA_EH_SOFTRESET;
1806 else 1808 else
@@ -1814,7 +1816,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1814 "port disabled. ignoring.\n"); 1816 "port disabled. ignoring.\n");
1815 ehc->i.action &= ~ATA_EH_RESET_MASK; 1817 ehc->i.action &= ~ATA_EH_RESET_MASK;
1816 1818
1817 ata_link_for_each_dev(dev, &ap->link) 1819 ata_link_for_each_dev(dev, link)
1818 classes[dev->devno] = ATA_DEV_NONE; 1820 classes[dev->devno] = ATA_DEV_NONE;
1819 1821
1820 rc = 0; 1822 rc = 0;
@@ -1832,7 +1834,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1832 reset = softreset; 1834 reset = softreset;
1833 else { 1835 else {
1834 /* prereset told us not to reset, bang classes and return */ 1836 /* prereset told us not to reset, bang classes and return */
1835 ata_link_for_each_dev(dev, &ap->link) 1837 ata_link_for_each_dev(dev, link)
1836 classes[dev->devno] = ATA_DEV_NONE; 1838 classes[dev->devno] = ATA_DEV_NONE;
1837 rc = 0; 1839 rc = 0;
1838 goto out; 1840 goto out;
@@ -1902,7 +1904,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1902 1904
1903 if (rc == -EPIPE || 1905 if (rc == -EPIPE ||
1904 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) 1906 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1)
1905 sata_down_spd_limit(ap); 1907 sata_down_spd_limit(link);
1906 if (hardreset) 1908 if (hardreset)
1907 reset = hardreset; 1909 reset = hardreset;
1908 goto retry; 1910 goto retry;
@@ -1914,12 +1916,12 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1914 /* After the reset, the device state is PIO 0 and the 1916 /* After the reset, the device state is PIO 0 and the
1915 * controller state is undefined. Record the mode. 1917 * controller state is undefined. Record the mode.
1916 */ 1918 */
1917 ata_link_for_each_dev(dev, &ap->link) 1919 ata_link_for_each_dev(dev, link)
1918 dev->pio_mode = XFER_PIO_0; 1920 dev->pio_mode = XFER_PIO_0;
1919 1921
1920 /* record current link speed */ 1922 /* record current link speed */
1921 if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0) 1923 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
1922 ap->link.sata_spd = (sstatus >> 4) & 0xf; 1924 link->sata_spd = (sstatus >> 4) & 0xf;
1923 1925
1924 if (postreset) 1926 if (postreset)
1925 postreset(ap, classes); 1927 postreset(ap, classes);
@@ -1957,7 +1959,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1957 readid_flags |= ATA_READID_POSTRESET; 1959 readid_flags |= ATA_READID_POSTRESET;
1958 1960
1959 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { 1961 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
1960 if (ata_port_offline(ap)) { 1962 if (ata_link_offline(&ap->link)) {
1961 rc = -EIO; 1963 rc = -EIO;
1962 goto err; 1964 goto err;
1963 } 1965 }
@@ -2079,7 +2081,6 @@ static int ata_eh_skip_recovery(struct ata_port *ap)
2079 2081
2080static void ata_eh_handle_dev_fail(struct ata_device *dev, int err) 2082static void ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2081{ 2083{
2082 struct ata_port *ap = dev->link->ap;
2083 struct ata_eh_context *ehc = &dev->link->eh_context; 2084 struct ata_eh_context *ehc = &dev->link->eh_context;
2084 2085
2085 ehc->tries[dev->devno]--; 2086 ehc->tries[dev->devno]--;
@@ -2096,7 +2097,7 @@ static void ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2096 /* This is the last chance, better to slow 2097 /* This is the last chance, better to slow
2097 * down than lose it. 2098 * down than lose it.
2098 */ 2099 */
2099 sata_down_spd_limit(ap); 2100 sata_down_spd_limit(dev->link);
2100 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); 2101 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
2101 } 2102 }
2102 } 2103 }
@@ -2106,7 +2107,7 @@ static void ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2106 ata_dev_disable(dev); 2107 ata_dev_disable(dev);
2107 2108
2108 /* detach if offline */ 2109 /* detach if offline */
2109 if (ata_port_offline(ap)) 2110 if (ata_link_offline(dev->link))
2110 ata_eh_detach_dev(dev); 2111 ata_eh_detach_dev(dev);
2111 2112
2112 /* probe if requested */ 2113 /* probe if requested */