libata-eh.c (fac56c2df51bc29b07b3c2dcfabf32a015a0522c) | libata-eh.c (ae01b2493c3bf03c504c32ac4ebb01d528508db3) |
---|---|
1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 3302 unchanged lines hidden (view full) --- 3311 */ 3312static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, 3313 struct ata_device **r_failed_dev) 3314{ 3315 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; 3316 struct ata_eh_context *ehc = &link->eh_context; 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3318 enum ata_lpm_policy old_policy = link->lpm_policy; | 1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 3302 unchanged lines hidden (view full) --- 3311 */ 3312static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, 3313 struct ata_device **r_failed_dev) 3314{ 3315 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; 3316 struct ata_eh_context *ehc = &link->eh_context; 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3318 enum ata_lpm_policy old_policy = link->lpm_policy; |
3319 bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; |
|
3319 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3320 unsigned int err_mask; 3321 int rc; 3322 3323 /* if the link or host doesn't do LPM, noop */ 3324 if ((link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm)) 3325 return 0; 3326 3327 /* 3328 * DIPM is enabled only for MIN_POWER as some devices 3329 * misbehave when the host NACKs transition to SLUMBER. Order 3330 * device and link configurations such that the host always 3331 * allows DIPM requests. 3332 */ 3333 ata_for_each_dev(dev, link, ENABLED) { 3334 bool hipm = ata_id_has_hipm(dev->id); | 3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3321 unsigned int err_mask; 3322 int rc; 3323 3324 /* if the link or host doesn't do LPM, noop */ 3325 if ((link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm)) 3326 return 0; 3327 3328 /* 3329 * DIPM is enabled only for MIN_POWER as some devices 3330 * misbehave when the host NACKs transition to SLUMBER. Order 3331 * device and link configurations such that the host always 3332 * allows DIPM requests. 3333 */ 3334 ata_for_each_dev(dev, link, ENABLED) { 3335 bool hipm = ata_id_has_hipm(dev->id); |
3335 bool dipm = ata_id_has_dipm(dev->id); | 3336 bool dipm = ata_id_has_dipm(dev->id) && !no_dipm; |
3336 3337 /* find the first enabled and LPM enabled devices */ 3338 if (!link_dev) 3339 link_dev = dev; 3340 3341 if (!lpm_dev && (hipm || dipm)) 3342 lpm_dev = dev; 3343 --- 40 unchanged lines hidden (view full) --- 3384 * with the new policy set. 3385 */ 3386 link->lpm_policy = policy; 3387 if (ap && ap->slave_link) 3388 ap->slave_link->lpm_policy = policy; 3389 3390 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3391 ata_for_each_dev(dev, link, ENABLED) { | 3337 3338 /* find the first enabled and LPM enabled devices */ 3339 if (!link_dev) 3340 link_dev = dev; 3341 3342 if (!lpm_dev && (hipm || dipm)) 3343 lpm_dev = dev; 3344 --- 40 unchanged lines hidden (view full) --- 3385 * with the new policy set. 3386 */ 3387 link->lpm_policy = policy; 3388 if (ap && ap->slave_link) 3389 ap->slave_link->lpm_policy = policy; 3390 3391 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3392 ata_for_each_dev(dev, link, ENABLED) { |
3392 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { | 3393 if (policy == ATA_LPM_MIN_POWER && !no_dipm && 3394 ata_id_has_dipm(dev->id)) { |
3393 err_mask = ata_dev_set_feature(dev, 3394 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3395 if (err_mask && err_mask != AC_ERR_DEV) { 3396 ata_dev_printk(dev, KERN_WARNING, 3397 "failed to enable DIPM, Emask 0x%x\n", 3398 err_mask); 3399 rc = -EIO; 3400 goto fail; --- 646 unchanged lines hidden --- | 3395 err_mask = ata_dev_set_feature(dev, 3396 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3397 if (err_mask && err_mask != AC_ERR_DEV) { 3398 ata_dev_printk(dev, KERN_WARNING, 3399 "failed to enable DIPM, Emask 0x%x\n", 3400 err_mask); 3401 rc = -EIO; 3402 goto fail; --- 646 unchanged lines hidden --- |