Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[libata] sata_promise: comment out duplicate PCI ID
[PATCH] libata: improve EH action and EHI flag handling
[PATCH] libata: fix eh_skip_recovery condition
[PATCH] libata: fix autopsy ehc->i.action and ehc->i.dev handling

+54 -26
+44 -25
drivers/scsi/libata-eh.c
··· 764 764 unsigned int action) 765 765 { 766 766 unsigned long flags; 767 + struct ata_eh_info *ehi = &ap->eh_info; 768 + struct ata_eh_context *ehc = &ap->eh_context; 767 769 768 770 spin_lock_irqsave(ap->lock, flags); 769 771 770 - ata_eh_clear_action(dev, &ap->eh_info, action); 772 + /* Reset is represented by combination of actions and EHI 773 + * flags. Suck in all related bits before clearing eh_info to 774 + * avoid losing requested action. 775 + */ 776 + if (action & ATA_EH_RESET_MASK) { 777 + ehc->i.action |= ehi->action & ATA_EH_RESET_MASK; 778 + ehc->i.flags |= ehi->flags & ATA_EHI_RESET_MODIFIER_MASK; 771 779 772 - if (!(ap->eh_context.i.flags & ATA_EHI_QUIET)) 780 + /* make sure all reset actions are cleared & clear EHI flags */ 781 + action |= ATA_EH_RESET_MASK; 782 + ehi->flags &= ~ATA_EHI_RESET_MODIFIER_MASK; 783 + } 784 + 785 + ata_eh_clear_action(dev, ehi, action); 786 + 787 + if (!(ehc->i.flags & ATA_EHI_QUIET)) 773 788 ap->pflags |= ATA_PFLAG_RECOVERED; 774 789 775 790 spin_unlock_irqrestore(ap->lock, flags); ··· 805 790 static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, 806 791 unsigned int action) 807 792 { 793 + /* if reset is complete, clear all reset actions & reset modifier */ 794 + if (action & ATA_EH_RESET_MASK) { 795 + action |= ATA_EH_RESET_MASK; 796 + ap->eh_context.i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; 797 + } 798 + 808 799 ata_eh_clear_action(dev, &ap->eh_context.i, action); 809 800 } 810 801 ··· 1297 1276 static void ata_eh_autopsy(struct ata_port *ap) 1298 1277 { 1299 1278 struct ata_eh_context *ehc = &ap->eh_context; 1300 - unsigned int action = ehc->i.action; 1301 - struct ata_device *failed_dev = NULL; 1302 1279 unsigned int all_err_mask = 0; 1303 1280 int tag, is_io = 0; 1304 1281 u32 serror; ··· 1313 1294 ehc->i.serror |= serror; 1314 1295 ata_eh_analyze_serror(ap); 1315 1296 } else if (rc != -EOPNOTSUPP) 1316 - action |= ATA_EH_HARDRESET; 1297 + ehc->i.action |= ATA_EH_HARDRESET; 1317 1298 1318 1299 /* analyze NCQ failure */ 1319 1300 ata_eh_analyze_ncq_error(ap); ··· 1334 1315 qc->err_mask |= ehc->i.err_mask; 1335 1316 1336 1317 /* analyze TF */ 1337 - action |= ata_eh_analyze_tf(qc, &qc->result_tf); 1318 + ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); 1338 1319 1339 1320 /* DEV errors are probably spurious in case of ATA_BUS error */ 1340 1321 if (qc->err_mask & AC_ERR_ATA_BUS) ··· 1348 1329 /* SENSE_VALID trumps dev/unknown error and revalidation */ 1349 1330 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { 1350 1331 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); 1351 - action &= ~ATA_EH_REVALIDATE; 1332 + ehc->i.action &= ~ATA_EH_REVALIDATE; 1352 1333 } 1353 1334 1354 1335 /* accumulate error info */ 1355 - failed_dev = qc->dev; 1336 + ehc->i.dev = qc->dev; 1356 1337 all_err_mask |= qc->err_mask; 1357 1338 if (qc->flags & ATA_QCFLAG_IO) 1358 1339 is_io = 1; ··· 1361 1342 /* enforce default EH actions */ 1362 1343 if (ap->pflags & ATA_PFLAG_FROZEN || 1363 1344 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) 1364 - action |= ATA_EH_SOFTRESET; 1345 + ehc->i.action |= ATA_EH_SOFTRESET; 1365 1346 else if (all_err_mask) 1366 - action |= ATA_EH_REVALIDATE; 1347 + ehc->i.action |= ATA_EH_REVALIDATE; 1367 1348 1368 1349 /* if we have offending qcs and the associated failed device */ 1369 - if (failed_dev) { 1350 + if (ehc->i.dev) { 1370 1351 /* speed down */ 1371 - action |= ata_eh_speed_down(failed_dev, is_io, all_err_mask); 1352 + ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io, 1353 + all_err_mask); 1372 1354 1373 1355 /* perform per-dev EH action only on the offending device */ 1374 - ehc->i.dev_action[failed_dev->devno] |= 1375 - action & ATA_EH_PERDEV_MASK; 1376 - action &= ~ATA_EH_PERDEV_MASK; 1356 + ehc->i.dev_action[ehc->i.dev->devno] |= 1357 + ehc->i.action & ATA_EH_PERDEV_MASK; 1358 + ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1377 1359 } 1378 - 1379 - /* record autopsy result */ 1380 - ehc->i.dev = failed_dev; 1381 - ehc->i.action |= action; 1382 1360 1383 1361 DPRINTK("EXIT\n"); 1384 1362 } ··· 1499 1483 ata_reset_fn_t reset; 1500 1484 int i, did_followup_srst, rc; 1501 1485 1486 + /* about to reset */ 1487 + ata_eh_about_to_do(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK); 1488 + 1502 1489 /* Determine which reset to use and record in ehc->i.action. 1503 1490 * prereset() may examine and modify it. 1504 1491 */ ··· 1550 1531 ata_port_printk(ap, KERN_INFO, "%s resetting port\n", 1551 1532 reset == softreset ? "soft" : "hard"); 1552 1533 1553 - /* reset */ 1554 - ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK); 1534 + /* mark that this EH session started with reset */ 1555 1535 ehc->i.flags |= ATA_EHI_DID_RESET; 1556 1536 1557 1537 rc = ata_do_reset(ap, reset, classes); ··· 1613 1595 postreset(ap, classes); 1614 1596 1615 1597 /* reset successful, schedule revalidation */ 1616 - ata_eh_done(ap, NULL, ATA_EH_RESET_MASK); 1598 + ata_eh_done(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK); 1617 1599 ehc->i.action |= ATA_EH_REVALIDATE; 1618 1600 } 1619 1601 ··· 1866 1848 for (i = 0; i < ata_port_max_devices(ap); i++) { 1867 1849 struct ata_device *dev = &ap->device[i]; 1868 1850 1869 - if (ata_dev_absent(dev) || ata_dev_ready(dev)) 1851 + if (!(dev->flags & ATA_DFLAG_SUSPENDED)) 1870 1852 break; 1871 1853 } 1872 1854 1873 1855 if (i == ata_port_max_devices(ap)) 1874 1856 return 1; 1875 1857 1876 - /* always thaw frozen port and recover failed devices */ 1877 - if (ap->pflags & ATA_PFLAG_FROZEN || ata_port_nr_enabled(ap)) 1858 + /* thaw frozen port, resume link and recover failed devices */ 1859 + if ((ap->pflags & ATA_PFLAG_FROZEN) || 1860 + (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) 1878 1861 return 0; 1879 1862 1880 1863 /* skip if class codes for all vacant slots are ATA_DEV_NONE */
+7
drivers/scsi/sata_promise.c
··· 269 269 { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 270 270 board_20619 }, 271 271 272 + /* TODO: remove all associated board_20771 code, as it completely 273 + * duplicates board_2037x code, unless reason for separation can be 274 + * divined. 275 + */ 276 + #if 0 272 277 { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 273 278 board_20771 }, 279 + #endif 280 + 274 281 { } /* terminate list */ 275 282 }; 276 283
+3 -1
include/linux/libata.h
··· 265 265 266 266 /* ata_eh_info->flags */ 267 267 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 268 - ATA_EHI_RESUME_LINK = (1 << 1), /* need to resume link */ 268 + ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */ 269 269 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 270 270 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 271 271 272 272 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 273 + 274 + ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 273 275 274 276 /* max repeat if error condition is still set after ->error_handler */ 275 277 ATA_EH_MAX_REPEAT = 5,