提交 8a745f1f 编写于 作者: K Kristen Carlson Accardi 提交者: Jeff Garzik

libata: Power off empty ports

Give users the option of completely powering off unoccupied
SATA ports using the existing min_power link_power_management_policy
option.  When the use selects this option on an empty port, we
will power the port off by setting DET to off.  For occupied ports,
behavior is unchanged.
Signed-off-by: NKristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 0afc6f5b
...@@ -3619,8 +3619,14 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, ...@@ -3619,8 +3619,14 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
scontrol |= (0x2 << 8); scontrol |= (0x2 << 8);
break; break;
case ATA_LPM_MIN_POWER: case ATA_LPM_MIN_POWER:
/* no restrictions on LPM transitions */ if (ata_link_nr_enabled(link) > 0)
scontrol &= ~(0x3 << 8); /* no restrictions on LPM transitions */
scontrol &= ~(0x3 << 8);
else {
/* empty port, power off */
scontrol &= ~0xf;
scontrol |= (0x1 << 2);
}
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
......
...@@ -3423,7 +3423,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, ...@@ -3423,7 +3423,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
return rc; return rc;
} }
static int ata_link_nr_enabled(struct ata_link *link) int ata_link_nr_enabled(struct ata_link *link)
{ {
struct ata_device *dev; struct ata_device *dev;
int cnt = 0; int cnt = 0;
......
...@@ -1151,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, ...@@ -1151,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
ata_postreset_fn_t postreset); ata_postreset_fn_t postreset);
extern void ata_std_error_handler(struct ata_port *ap); extern void ata_std_error_handler(struct ata_port *ap);
extern int ata_link_nr_enabled(struct ata_link *link);
/* /*
* Base operations to inherit from and initializers for sht * Base operations to inherit from and initializers for sht
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册