aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 05:36:22 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:30 -0400
commit9af5c9c97dc9d599281778864c72b385f0c63341 (patch)
tree8359986bd42c4a9a5b1993078aa9ee4c7971ac3d /drivers/ata/libata-eh.c
parent640fdb504941fa2b9f6f274716fc9f97f2bf6bff (diff)
libata-link: introduce ata_link
Introduce ata_link. It abstracts PHY and sits between ata_port and ata_device. This new level of abstraction is necessary to support SATA Port Multiplier, which basically adds a bunch of links (PHYs) to a ATA host port. Fields related to command execution, spd_limit and EH are per-link and thus moved to ata_link. This patch only defines the host link. Multiple link handling will be added later. Also, a lot of ap->link derefences are added but many of them will be removed as each part is converted to deal directly with ata_link instead of ata_port. This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c100
1 files changed, 51 insertions, 49 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index ac6ceed4bb60..e2681f56ed44 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -195,7 +195,7 @@ static int ata_ering_map(struct ata_ering *ering,
195 195
196static unsigned int ata_eh_dev_action(struct ata_device *dev) 196static unsigned int ata_eh_dev_action(struct ata_device *dev)
197{ 197{
198 struct ata_eh_context *ehc = &dev->ap->eh_context; 198 struct ata_eh_context *ehc = &dev->link->eh_context;
199 199
200 return ehc->i.action | ehc->i.dev_action[dev->devno]; 200 return ehc->i.action | ehc->i.dev_action[dev->devno];
201} 201}
@@ -261,7 +261,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
261 261
262 ret = EH_HANDLED; 262 ret = EH_HANDLED;
263 spin_lock_irqsave(ap->lock, flags); 263 spin_lock_irqsave(ap->lock, flags);
264 qc = ata_qc_from_tag(ap, ap->active_tag); 264 qc = ata_qc_from_tag(ap, ap->link.active_tag);
265 if (qc) { 265 if (qc) {
266 WARN_ON(qc->scsicmd != cmd); 266 WARN_ON(qc->scsicmd != cmd);
267 qc->flags |= ATA_QCFLAG_EH_SCHEDULED; 267 qc->flags |= ATA_QCFLAG_EH_SCHEDULED;
@@ -371,9 +371,9 @@ void ata_scsi_error(struct Scsi_Host *host)
371 /* fetch & clear EH info */ 371 /* fetch & clear EH info */
372 spin_lock_irqsave(ap->lock, flags); 372 spin_lock_irqsave(ap->lock, flags);
373 373
374 memset(&ap->eh_context, 0, sizeof(ap->eh_context)); 374 memset(&ap->link.eh_context, 0, sizeof(ap->link.eh_context));
375 ap->eh_context.i = ap->eh_info; 375 ap->link.eh_context.i = ap->link.eh_info;
376 memset(&ap->eh_info, 0, sizeof(ap->eh_info)); 376 memset(&ap->link.eh_info, 0, sizeof(ap->link.eh_info));
377 377
378 ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; 378 ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS;
379 ap->pflags &= ~ATA_PFLAG_EH_PENDING; 379 ap->pflags &= ~ATA_PFLAG_EH_PENDING;
@@ -409,7 +409,7 @@ void ata_scsi_error(struct Scsi_Host *host)
409 } 409 }
410 410
411 /* this run is complete, make sure EH info is clear */ 411 /* this run is complete, make sure EH info is clear */
412 memset(&ap->eh_info, 0, sizeof(ap->eh_info)); 412 memset(&ap->link.eh_info, 0, sizeof(ap->link.eh_info));
413 413
414 /* Clear host_eh_scheduled while holding ap->lock such 414 /* Clear host_eh_scheduled while holding ap->lock such
415 * that if exception occurs after this point but 415 * that if exception occurs after this point but
@@ -420,7 +420,7 @@ void ata_scsi_error(struct Scsi_Host *host)
420 420
421 spin_unlock_irqrestore(ap->lock, flags); 421 spin_unlock_irqrestore(ap->lock, flags);
422 } else { 422 } else {
423 WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL); 423 WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL);
424 ap->ops->eng_timeout(ap); 424 ap->ops->eng_timeout(ap);
425 } 425 }
426 426
@@ -575,7 +575,7 @@ void ata_eng_timeout(struct ata_port *ap)
575{ 575{
576 DPRINTK("ENTER\n"); 576 DPRINTK("ENTER\n");
577 577
578 ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag)); 578 ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag));
579 579
580 DPRINTK("EXIT\n"); 580 DPRINTK("EXIT\n");
581} 581}
@@ -922,7 +922,7 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc)
922 */ 922 */
923static void ata_eh_detach_dev(struct ata_device *dev) 923static void ata_eh_detach_dev(struct ata_device *dev)
924{ 924{
925 struct ata_port *ap = dev->ap; 925 struct ata_port *ap = dev->link->ap;
926 unsigned long flags; 926 unsigned long flags;
927 927
928 ata_dev_disable(dev); 928 ata_dev_disable(dev);
@@ -937,8 +937,8 @@ static void ata_eh_detach_dev(struct ata_device *dev)
937 } 937 }
938 938
939 /* clear per-dev EH actions */ 939 /* clear per-dev EH actions */
940 ata_eh_clear_action(dev, &ap->eh_info, ATA_EH_PERDEV_MASK); 940 ata_eh_clear_action(dev, &dev->link->eh_info, ATA_EH_PERDEV_MASK);
941 ata_eh_clear_action(dev, &ap->eh_context.i, ATA_EH_PERDEV_MASK); 941 ata_eh_clear_action(dev, &dev->link->eh_context.i, ATA_EH_PERDEV_MASK);
942 942
943 spin_unlock_irqrestore(ap->lock, flags); 943 spin_unlock_irqrestore(ap->lock, flags);
944} 944}
@@ -950,8 +950,8 @@ static void ata_eh_detach_dev(struct ata_device *dev)
950 * @action: action about to be performed 950 * @action: action about to be performed
951 * 951 *
952 * Called just before performing EH actions to clear related bits 952 * Called just before performing EH actions to clear related bits
953 * in @ap->eh_info such that eh actions are not unnecessarily 953 * in @ap->link.eh_info such that eh actions are not
954 * repeated. 954 * unnecessarily repeated.
955 * 955 *
956 * LOCKING: 956 * LOCKING:
957 * None. 957 * None.
@@ -960,8 +960,8 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev,
960 unsigned int action) 960 unsigned int action)
961{ 961{
962 unsigned long flags; 962 unsigned long flags;
963 struct ata_eh_info *ehi = &ap->eh_info; 963 struct ata_eh_info *ehi = &ap->link.eh_info;
964 struct ata_eh_context *ehc = &ap->eh_context; 964 struct ata_eh_context *ehc = &ap->link.eh_context;
965 965
966 spin_lock_irqsave(ap->lock, flags); 966 spin_lock_irqsave(ap->lock, flags);
967 967
@@ -993,7 +993,7 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev,
993 * @action: action just completed 993 * @action: action just completed
994 * 994 *
995 * Called right after performing EH actions to clear related bits 995 * Called right after performing EH actions to clear related bits
996 * in @ap->eh_context. 996 * in @ap->link.eh_context.
997 * 997 *
998 * LOCKING: 998 * LOCKING:
999 * None. 999 * None.
@@ -1001,13 +1001,15 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev,
1001static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, 1001static void ata_eh_done(struct ata_port *ap, struct ata_device *dev,
1002 unsigned int action) 1002 unsigned int action)
1003{ 1003{
1004 struct ata_eh_context *ehc = &ap->link.eh_context;
1005
1004 /* if reset is complete, clear all reset actions & reset modifier */ 1006 /* if reset is complete, clear all reset actions & reset modifier */
1005 if (action & ATA_EH_RESET_MASK) { 1007 if (action & ATA_EH_RESET_MASK) {
1006 action |= ATA_EH_RESET_MASK; 1008 action |= ATA_EH_RESET_MASK;
1007 ap->eh_context.i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; 1009 ehc->i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK;
1008 } 1010 }
1009 1011
1010 ata_eh_clear_action(dev, &ap->eh_context.i, action); 1012 ata_eh_clear_action(dev, &ehc->i, action);
1011} 1013}
1012 1014
1013/** 1015/**
@@ -1101,7 +1103,7 @@ static unsigned int ata_read_log_page(struct ata_device *dev,
1101static int ata_eh_read_log_10h(struct ata_device *dev, 1103static int ata_eh_read_log_10h(struct ata_device *dev,
1102 int *tag, struct ata_taskfile *tf) 1104 int *tag, struct ata_taskfile *tf)
1103{ 1105{
1104 u8 *buf = dev->ap->sector_buf; 1106 u8 *buf = dev->link->ap->sector_buf;
1105 unsigned int err_mask; 1107 unsigned int err_mask;
1106 u8 csum; 1108 u8 csum;
1107 int i; 1109 int i;
@@ -1155,7 +1157,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
1155{ 1157{
1156 struct ata_device *dev = qc->dev; 1158 struct ata_device *dev = qc->dev;
1157 unsigned char *sense_buf = qc->scsicmd->sense_buffer; 1159 unsigned char *sense_buf = qc->scsicmd->sense_buffer;
1158 struct ata_port *ap = dev->ap; 1160 struct ata_port *ap = dev->link->ap;
1159 struct ata_taskfile tf; 1161 struct ata_taskfile tf;
1160 u8 cdb[ATAPI_CDB_LEN]; 1162 u8 cdb[ATAPI_CDB_LEN];
1161 1163
@@ -1206,7 +1208,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
1206 */ 1208 */
1207static void ata_eh_analyze_serror(struct ata_port *ap) 1209static void ata_eh_analyze_serror(struct ata_port *ap)
1208{ 1210{
1209 struct ata_eh_context *ehc = &ap->eh_context; 1211 struct ata_eh_context *ehc = &ap->link.eh_context;
1210 u32 serror = ehc->i.serror; 1212 u32 serror = ehc->i.serror;
1211 unsigned int err_mask = 0, action = 0; 1213 unsigned int err_mask = 0, action = 0;
1212 1214
@@ -1248,8 +1250,8 @@ static void ata_eh_analyze_serror(struct ata_port *ap)
1248 */ 1250 */
1249static void ata_eh_analyze_ncq_error(struct ata_port *ap) 1251static void ata_eh_analyze_ncq_error(struct ata_port *ap)
1250{ 1252{
1251 struct ata_eh_context *ehc = &ap->eh_context; 1253 struct ata_eh_context *ehc = &ap->link.eh_context;
1252 struct ata_device *dev = ap->device; 1254 struct ata_device *dev = ap->link.device;
1253 struct ata_queued_cmd *qc; 1255 struct ata_queued_cmd *qc;
1254 struct ata_taskfile tf; 1256 struct ata_taskfile tf;
1255 int tag, rc; 1257 int tag, rc;
@@ -1259,7 +1261,7 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap)
1259 return; 1261 return;
1260 1262
1261 /* is it NCQ device error? */ 1263 /* is it NCQ device error? */
1262 if (!ap->sactive || !(ehc->i.err_mask & AC_ERR_DEV)) 1264 if (!ap->link.sactive || !(ehc->i.err_mask & AC_ERR_DEV))
1263 return; 1265 return;
1264 1266
1265 /* has LLDD analyzed already? */ 1267 /* has LLDD analyzed already? */
@@ -1281,7 +1283,7 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap)
1281 return; 1283 return;
1282 } 1284 }
1283 1285
1284 if (!(ap->sactive & (1 << tag))) { 1286 if (!(ap->link.sactive & (1 << tag))) {
1285 ata_port_printk(ap, KERN_ERR, "log page 10h reported " 1287 ata_port_printk(ap, KERN_ERR, "log page 10h reported "
1286 "inactive tag %d\n", tag); 1288 "inactive tag %d\n", tag);
1287 return; 1289 return;
@@ -1497,7 +1499,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io,
1497 /* speed down? */ 1499 /* speed down? */
1498 if (verdict & ATA_EH_SPDN_SPEED_DOWN) { 1500 if (verdict & ATA_EH_SPDN_SPEED_DOWN) {
1499 /* speed down SATA link speed if possible */ 1501 /* speed down SATA link speed if possible */
1500 if (sata_down_spd_limit(dev->ap) == 0) { 1502 if (sata_down_spd_limit(dev->link->ap) == 0) {
1501 action |= ATA_EH_HARDRESET; 1503 action |= ATA_EH_HARDRESET;
1502 goto done; 1504 goto done;
1503 } 1505 }
@@ -1528,7 +1530,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io,
1528 * SATA. Consider it only for PATA. 1530 * SATA. Consider it only for PATA.
1529 */ 1531 */
1530 if ((verdict & ATA_EH_SPDN_FALLBACK_TO_PIO) && (dev->spdn_cnt >= 2) && 1532 if ((verdict & ATA_EH_SPDN_FALLBACK_TO_PIO) && (dev->spdn_cnt >= 2) &&
1531 (dev->ap->cbl != ATA_CBL_SATA) && 1533 (dev->link->ap->cbl != ATA_CBL_SATA) &&
1532 (dev->xfer_shift != ATA_SHIFT_PIO)) { 1534 (dev->xfer_shift != ATA_SHIFT_PIO)) {
1533 if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) { 1535 if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) {
1534 dev->spdn_cnt = 0; 1536 dev->spdn_cnt = 0;
@@ -1557,7 +1559,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io,
1557 */ 1559 */
1558static void ata_eh_autopsy(struct ata_port *ap) 1560static void ata_eh_autopsy(struct ata_port *ap)
1559{ 1561{
1560 struct ata_eh_context *ehc = &ap->eh_context; 1562 struct ata_eh_context *ehc = &ap->link.eh_context;
1561 unsigned int all_err_mask = 0; 1563 unsigned int all_err_mask = 0;
1562 int tag, is_io = 0; 1564 int tag, is_io = 0;
1563 u32 serror; 1565 u32 serror;
@@ -1656,7 +1658,7 @@ static void ata_eh_autopsy(struct ata_port *ap)
1656 */ 1658 */
1657static void ata_eh_report(struct ata_port *ap) 1659static void ata_eh_report(struct ata_port *ap)
1658{ 1660{
1659 struct ata_eh_context *ehc = &ap->eh_context; 1661 struct ata_eh_context *ehc = &ap->link.eh_context;
1660 const char *frozen, *desc; 1662 const char *frozen, *desc;
1661 int tag, nr_failed = 0; 1663 int tag, nr_failed = 0;
1662 1664
@@ -1685,15 +1687,15 @@ static void ata_eh_report(struct ata_port *ap)
1685 if (ehc->i.dev) { 1687 if (ehc->i.dev) {
1686 ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " 1688 ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x "
1687 "SAct 0x%x SErr 0x%x action 0x%x%s\n", 1689 "SAct 0x%x SErr 0x%x action 0x%x%s\n",
1688 ehc->i.err_mask, ap->sactive, ehc->i.serror, 1690 ehc->i.err_mask, ap->link.sactive,
1689 ehc->i.action, frozen); 1691 ehc->i.serror, ehc->i.action, frozen);
1690 if (desc) 1692 if (desc)
1691 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); 1693 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc);
1692 } else { 1694 } else {
1693 ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x " 1695 ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x "
1694 "SAct 0x%x SErr 0x%x action 0x%x%s\n", 1696 "SAct 0x%x SErr 0x%x action 0x%x%s\n",
1695 ehc->i.err_mask, ap->sactive, ehc->i.serror, 1697 ehc->i.err_mask, ap->link.sactive,
1696 ehc->i.action, frozen); 1698 ehc->i.serror, ehc->i.action, frozen);
1697 if (desc) 1699 if (desc)
1698 ata_port_printk(ap, KERN_ERR, "%s\n", desc); 1700 ata_port_printk(ap, KERN_ERR, "%s\n", desc);
1699 } 1701 }
@@ -1775,7 +1777,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1775 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 1777 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1776 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 1778 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
1777{ 1779{
1778 struct ata_eh_context *ehc = &ap->eh_context; 1780 struct ata_eh_context *ehc = &ap->link.eh_context;
1779 unsigned int *classes = ehc->classes; 1781 unsigned int *classes = ehc->classes;
1780 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 1782 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
1781 int try = 0; 1783 int try = 0;
@@ -1804,7 +1806,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1804 if (rc == -ENOENT) { 1806 if (rc == -ENOENT) {
1805 ata_port_printk(ap, KERN_DEBUG, 1807 ata_port_printk(ap, KERN_DEBUG,
1806 "port disabled. ignoring.\n"); 1808 "port disabled. ignoring.\n");
1807 ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; 1809 ehc->i.action &= ~ATA_EH_RESET_MASK;
1808 1810
1809 for (i = 0; i < ATA_MAX_DEVICES; i++) 1811 for (i = 0; i < ATA_MAX_DEVICES; i++)
1810 classes[i] = ATA_DEV_NONE; 1812 classes[i] = ATA_DEV_NONE;
@@ -1907,11 +1909,11 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1907 * controller state is undefined. Record the mode. 1909 * controller state is undefined. Record the mode.
1908 */ 1910 */
1909 for (i = 0; i < ATA_MAX_DEVICES; i++) 1911 for (i = 0; i < ATA_MAX_DEVICES; i++)
1910 ap->device[i].pio_mode = XFER_PIO_0; 1912 ap->link.device[i].pio_mode = XFER_PIO_0;
1911 1913
1912 /* record current link speed */ 1914 /* record current link speed */
1913 if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0) 1915 if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0)
1914 ap->sata_spd = (sstatus >> 4) & 0xf; 1916 ap->link.sata_spd = (sstatus >> 4) & 0xf;
1915 1917
1916 if (postreset) 1918 if (postreset)
1917 postreset(ap, classes); 1919 postreset(ap, classes);
@@ -1929,7 +1931,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1929static int ata_eh_revalidate_and_attach(struct ata_port *ap, 1931static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1930 struct ata_device **r_failed_dev) 1932 struct ata_device **r_failed_dev)
1931{ 1933{
1932 struct ata_eh_context *ehc = &ap->eh_context; 1934 struct ata_eh_context *ehc = &ap->link.eh_context;
1933 struct ata_device *dev; 1935 struct ata_device *dev;
1934 unsigned int new_mask = 0; 1936 unsigned int new_mask = 0;
1935 unsigned long flags; 1937 unsigned long flags;
@@ -1944,7 +1946,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1944 for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { 1946 for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) {
1945 unsigned int action, readid_flags = 0; 1947 unsigned int action, readid_flags = 0;
1946 1948
1947 dev = &ap->device[i]; 1949 dev = &ap->link.device[i];
1948 action = ata_eh_dev_action(dev); 1950 action = ata_eh_dev_action(dev);
1949 1951
1950 if (ehc->i.flags & ATA_EHI_DID_RESET) 1952 if (ehc->i.flags & ATA_EHI_DID_RESET)
@@ -2004,7 +2006,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
2004 * device detection messages backwards. 2006 * device detection messages backwards.
2005 */ 2007 */
2006 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2008 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2007 dev = &ap->device[i]; 2009 dev = &ap->link.device[i];
2008 2010
2009 if (!(new_mask & (1 << i))) 2011 if (!(new_mask & (1 << i)))
2010 continue; 2012 continue;
@@ -2036,7 +2038,7 @@ static int ata_port_nr_enabled(struct ata_port *ap)
2036 int i, cnt = 0; 2038 int i, cnt = 0;
2037 2039
2038 for (i = 0; i < ATA_MAX_DEVICES; i++) 2040 for (i = 0; i < ATA_MAX_DEVICES; i++)
2039 if (ata_dev_enabled(&ap->device[i])) 2041 if (ata_dev_enabled(&ap->link.device[i]))
2040 cnt++; 2042 cnt++;
2041 return cnt; 2043 return cnt;
2042} 2044}
@@ -2046,14 +2048,14 @@ static int ata_port_nr_vacant(struct ata_port *ap)
2046 int i, cnt = 0; 2048 int i, cnt = 0;
2047 2049
2048 for (i = 0; i < ATA_MAX_DEVICES; i++) 2050 for (i = 0; i < ATA_MAX_DEVICES; i++)
2049 if (ap->device[i].class == ATA_DEV_UNKNOWN) 2051 if (ap->link.device[i].class == ATA_DEV_UNKNOWN)
2050 cnt++; 2052 cnt++;
2051 return cnt; 2053 return cnt;
2052} 2054}
2053 2055
2054static int ata_eh_skip_recovery(struct ata_port *ap) 2056static int ata_eh_skip_recovery(struct ata_port *ap)
2055{ 2057{
2056 struct ata_eh_context *ehc = &ap->eh_context; 2058 struct ata_eh_context *ehc = &ap->link.eh_context;
2057 int i; 2059 int i;
2058 2060
2059 /* thaw frozen port, resume link and recover failed devices */ 2061 /* thaw frozen port, resume link and recover failed devices */
@@ -2063,7 +2065,7 @@ static int ata_eh_skip_recovery(struct ata_port *ap)
2063 2065
2064 /* skip if class codes for all vacant slots are ATA_DEV_NONE */ 2066 /* skip if class codes for all vacant slots are ATA_DEV_NONE */
2065 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2067 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2066 struct ata_device *dev = &ap->device[i]; 2068 struct ata_device *dev = &ap->link.device[i];
2067 2069
2068 if (dev->class == ATA_DEV_UNKNOWN && 2070 if (dev->class == ATA_DEV_UNKNOWN &&
2069 ehc->classes[dev->devno] != ATA_DEV_NONE) 2071 ehc->classes[dev->devno] != ATA_DEV_NONE)
@@ -2075,8 +2077,8 @@ static int ata_eh_skip_recovery(struct ata_port *ap)
2075 2077
2076static void ata_eh_handle_dev_fail(struct ata_device *dev, int err) 2078static void ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2077{ 2079{
2078 struct ata_port *ap = dev->ap; 2080 struct ata_port *ap = dev->link->ap;
2079 struct ata_eh_context *ehc = &ap->eh_context; 2081 struct ata_eh_context *ehc = &dev->link->eh_context;
2080 2082
2081 ehc->tries[dev->devno]--; 2083 ehc->tries[dev->devno]--;
2082 2084
@@ -2149,7 +2151,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2149 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 2151 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
2150 ata_postreset_fn_t postreset) 2152 ata_postreset_fn_t postreset)
2151{ 2153{
2152 struct ata_eh_context *ehc = &ap->eh_context; 2154 struct ata_eh_context *ehc = &ap->link.eh_context;
2153 struct ata_device *dev; 2155 struct ata_device *dev;
2154 int i, rc; 2156 int i, rc;
2155 2157
@@ -2157,7 +2159,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2157 2159
2158 /* prep for recovery */ 2160 /* prep for recovery */
2159 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2161 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2160 dev = &ap->device[i]; 2162 dev = &ap->link.device[i];
2161 2163
2162 ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; 2164 ehc->tries[dev->devno] = ATA_EH_DEV_TRIES;
2163 2165
@@ -2240,7 +2242,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2240 out: 2242 out:
2241 if (rc) { 2243 if (rc) {
2242 for (i = 0; i < ATA_MAX_DEVICES; i++) 2244 for (i = 0; i < ATA_MAX_DEVICES; i++)
2243 ata_dev_disable(&ap->device[i]); 2245 ata_dev_disable(&ap->link.device[i]);
2244 } 2246 }
2245 2247
2246 DPRINTK("EXIT, rc=%d\n", rc); 2248 DPRINTK("EXIT, rc=%d\n", rc);