libata-eh.c (91de76e661a266731fc2889a398ad1694df9d523) | libata-eh.c (f1601113ddc0339a745e702f4fb1ca37d4875e65) |
---|---|
1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Tejun Heo <tj@kernel.org> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 2250 unchanged lines hidden (view full) --- 2259 if (!dev && ((ata_link_max_devices(link) == 1 && 2260 ata_dev_enabled(link->device)))) 2261 dev = link->device; 2262 2263 if (dev) { 2264 if (dev->flags & ATA_DFLAG_DUBIOUS_XFER) 2265 eflags |= ATA_EFLAG_DUBIOUS_XFER; 2266 ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); | 1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Tejun Heo <tj@kernel.org> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 2250 unchanged lines hidden (view full) --- 2259 if (!dev && ((ata_link_max_devices(link) == 1 && 2260 ata_dev_enabled(link->device)))) 2261 dev = link->device; 2262 2263 if (dev) { 2264 if (dev->flags & ATA_DFLAG_DUBIOUS_XFER) 2265 eflags |= ATA_EFLAG_DUBIOUS_XFER; 2266 ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); |
2267 trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); |
|
2267 } | 2268 } |
2268 trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); | |
2269 DPRINTK("EXIT\n"); 2270} 2271 2272/** 2273 * ata_eh_autopsy - analyze error and determine recovery action 2274 * @ap: host port to perform autopsy on 2275 * 2276 * Analyze all links of @ap and determine why they failed and --- 1172 unchanged lines hidden (view full) --- 3449 3450/** 3451 * ata_eh_set_lpm - configure SATA interface power management 3452 * @link: link to configure power management 3453 * @policy: the link power management policy 3454 * @r_failed_dev: out parameter for failed device 3455 * 3456 * Enable SATA Interface power management. This will enable | 2269 DPRINTK("EXIT\n"); 2270} 2271 2272/** 2273 * ata_eh_autopsy - analyze error and determine recovery action 2274 * @ap: host port to perform autopsy on 2275 * 2276 * Analyze all links of @ap and determine why they failed and --- 1172 unchanged lines hidden (view full) --- 3449 3450/** 3451 * ata_eh_set_lpm - configure SATA interface power management 3452 * @link: link to configure power management 3453 * @policy: the link power management policy 3454 * @r_failed_dev: out parameter for failed device 3455 * 3456 * Enable SATA Interface power management. This will enable |
3457 * Device Interface Power Management (DIPM) for min_power 3458 * policy, and then call driver specific callbacks for 3459 * enabling Host Initiated Power management. | 3457 * Device Interface Power Management (DIPM) for min_power and 3458 * medium_power_with_dipm policies, and then call driver specific 3459 * callbacks for enabling Host Initiated Power management. |
3460 * 3461 * LOCKING: 3462 * EH context. 3463 * 3464 * RETURNS: 3465 * 0 on success, -errno on failure. 3466 */ 3467static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, --- 29 unchanged lines hidden (view full) --- 3497 if (!lpm_dev && (hipm || dipm)) 3498 lpm_dev = dev; 3499 3500 hints &= ~ATA_LPM_EMPTY; 3501 if (!hipm) 3502 hints &= ~ATA_LPM_HIPM; 3503 3504 /* disable DIPM before changing link config */ | 3460 * 3461 * LOCKING: 3462 * EH context. 3463 * 3464 * RETURNS: 3465 * 0 on success, -errno on failure. 3466 */ 3467static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, --- 29 unchanged lines hidden (view full) --- 3497 if (!lpm_dev && (hipm || dipm)) 3498 lpm_dev = dev; 3499 3500 hints &= ~ATA_LPM_EMPTY; 3501 if (!hipm) 3502 hints &= ~ATA_LPM_HIPM; 3503 3504 /* disable DIPM before changing link config */ |
3505 if (policy != ATA_LPM_MIN_POWER && dipm) { | 3505 if (policy < ATA_LPM_MED_POWER_WITH_DIPM && dipm) { |
3506 err_mask = ata_dev_set_feature(dev, 3507 SETFEATURES_SATA_DISABLE, SATA_DIPM); 3508 if (err_mask && err_mask != AC_ERR_DEV) { 3509 ata_dev_warn(dev, 3510 "failed to disable DIPM, Emask 0x%x\n", 3511 err_mask); 3512 rc = -EIO; 3513 goto fail; --- 26 unchanged lines hidden (view full) --- 3540 * with the new policy set. 3541 */ 3542 link->lpm_policy = policy; 3543 if (ap && ap->slave_link) 3544 ap->slave_link->lpm_policy = policy; 3545 3546 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3547 ata_for_each_dev(dev, link, ENABLED) { | 3506 err_mask = ata_dev_set_feature(dev, 3507 SETFEATURES_SATA_DISABLE, SATA_DIPM); 3508 if (err_mask && err_mask != AC_ERR_DEV) { 3509 ata_dev_warn(dev, 3510 "failed to disable DIPM, Emask 0x%x\n", 3511 err_mask); 3512 rc = -EIO; 3513 goto fail; --- 26 unchanged lines hidden (view full) --- 3540 * with the new policy set. 3541 */ 3542 link->lpm_policy = policy; 3543 if (ap && ap->slave_link) 3544 ap->slave_link->lpm_policy = policy; 3545 3546 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3547 ata_for_each_dev(dev, link, ENABLED) { |
3548 if (policy == ATA_LPM_MIN_POWER && !no_dipm && | 3548 if (policy >= ATA_LPM_MED_POWER_WITH_DIPM && !no_dipm && |
3549 ata_id_has_dipm(dev->id)) { 3550 err_mask = ata_dev_set_feature(dev, 3551 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3552 if (err_mask && err_mask != AC_ERR_DEV) { 3553 ata_dev_warn(dev, 3554 "failed to enable DIPM, Emask 0x%x\n", 3555 err_mask); 3556 rc = -EIO; --- 149 unchanged lines hidden (view full) --- 3706 */ 3707 if (err != -EAGAIN) 3708 ehc->tries[dev->devno]--; 3709 3710 switch (err) { 3711 case -ENODEV: 3712 /* device missing or wrong IDENTIFY data, schedule probing */ 3713 ehc->i.probe_mask |= (1 << dev->devno); | 3549 ata_id_has_dipm(dev->id)) { 3550 err_mask = ata_dev_set_feature(dev, 3551 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3552 if (err_mask && err_mask != AC_ERR_DEV) { 3553 ata_dev_warn(dev, 3554 "failed to enable DIPM, Emask 0x%x\n", 3555 err_mask); 3556 rc = -EIO; --- 149 unchanged lines hidden (view full) --- 3706 */ 3707 if (err != -EAGAIN) 3708 ehc->tries[dev->devno]--; 3709 3710 switch (err) { 3711 case -ENODEV: 3712 /* device missing or wrong IDENTIFY data, schedule probing */ 3713 ehc->i.probe_mask |= (1 << dev->devno); |
3714 /* fall through */ |
|
3714 case -EINVAL: 3715 /* give it just one more chance */ 3716 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 3715 case -EINVAL: 3716 /* give it just one more chance */ 3717 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
3718 /* fall through */ |
|
3717 case -EIO: 3718 if (ehc->tries[dev->devno] == 1) { 3719 /* This is the last chance, better to slow 3720 * down than lose it. 3721 */ 3722 sata_down_spd_limit(ata_dev_phys_link(dev), 0); 3723 if (dev->pio_mode > XFER_PIO_0) 3724 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); --- 488 unchanged lines hidden --- | 3719 case -EIO: 3720 if (ehc->tries[dev->devno] == 1) { 3721 /* This is the last chance, better to slow 3722 * down than lose it. 3723 */ 3724 sata_down_spd_limit(ata_dev_phys_link(dev), 0); 3725 if (dev->pio_mode > XFER_PIO_0) 3726 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); --- 488 unchanged lines hidden --- |