allow user to power off unused ports via sysfs
I tried this patch and it doesn't work on ICH8 because it violates AHCI protocol.
Quoted 9 lines · [email protected] wrote:
drivers/ata/libata-core.c +3
-0@@ -162,6 +162,19 @@ MODULE_DESCRIPTION("Library module for AMODULE_LICENSE ("GPL" );MODULE_VERSION (DRV_VERSION ); +static void ata_phy_offline (struct ata_link *link) +{ +u32 scontrol;
drivers/ata/libata-core.c MODULE_DESCRIPTION("Library module for A · line 177
Quoted 10 lines
drivers/ata/libata-core.c +10
-0+int rc; + +/* set DET to 4 */ + rc =sata_scr_read (link,SCR_CONTROL , &scontrol); +if (rc) +return ; + scontrol &= ~0xf ; + scontrol |= (1 <<2 ); +sata_scr_write (link,SCR_CONTROL , scontrol); +}
On AHCI, you can't change SCTL.DET when the port is running. This version of ata_phy_offline changes SCTL.DET without regard to CMD.ST.
I would propose something more like this:
static void ata_port_offline(struct ata_port *ap)
{
u32 scontrol;
int rc;
struct ata_link *link = &ap->link;
if (ap->ops->port_stop)
ap->ops->port_stop(ap);
rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
if (rc)
return;
scontrol &= ~0xf;
scontrol |= (1<<2);
sata_scr_write(link, SCR_CONTROL, scontrol);
}I tried the above on ICH8 and by poking around in /dev/mem I believe it works. After I set the ALPM to power_off in sysfs, the port shows CMD.ST == 0, CMD.FRE == 0, and SSTS.DET == 4. So I think this is the way to go, at least with respect to AHCI. I can't say whether this makes sense generally for the other users of libata-core.
The problem is I didn't save any power this way :( ThinkPad X61t was using minimum 7.6W on a one-minute average before power_off, and same power after power_off. I'd been led to believe that disabling these ports would have a substantial power saving effect.
-jwb
Quoted 8 lines · On Sun, 28 Sep 2008 14:58:34 -0700 "Jeffrey W. Baker" <[email protected]> wrote:
The problem is I didn't save any power this way :( ThinkPad X61t was using minimum 7.6W on a one-minute average before
power_off, and same power afterpower_off. I'd been led to believe that disabling these ports would have a substantial power saving effect.-jwb
Hi Jeffrey - the reason you are not seeing any power savings is that this patch isn't actually powering off the ports. I swear this used to work... but I confirmed today it is not doing what it is supposed to do. I'll send out a reworked patch as soon as I figure out what the problem is.
Kristen
Quoted 12 lines · On Mon, 29 Sep 2008 16:49:13 -0700 Kristen Carlson Accardi…
Quoted 8 lines · On Sun, 28 Sep 2008 14:58:34 -0700 "Jeffrey W. Baker" <[email protected]> wrote:
The problem is I didn't save any power this way :( ThinkPad X61t was using minimum 7.6W on a one-minute average before
power_off, and same power afterpower_off. I'd been led to believe that disabling these ports would have a substantial power saving effect.-jwb
Quoted 8 lines
Hi Jeffrey - the reason you are not seeing any power savings is that this patch isn't actually powering off the ports. I swear this used to work... but I confirmed today it is not doing what it is supposed to do. I'll send out a reworked patch as soon as I figure out what the problem is.
Kristen
Hi - I took another look at this patch - and I was wrong, it is working just fine for me. the reason I thought it wasn't working was because I was trying to power off a dummy port (doh). I confirmed with a power meter that you should see .2 Watts per port saved when powering down an unused port. Just keep in mind that you can't power off an occupied port, and don't do like I did and try to power off a dummy port.