Re: [patch 1/2] allow user to power off unused ports via sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried this patch and it doesn't work on ICH8 because it violates AHCI
protocol.

kristen.c.accardi@xxxxxxxxx wrote:
> --- linux-ahci-phy.orig/drivers/ata/libata-core.c	2008-06-27 13:32:51.000000000 -0700
> +++ linux-ahci-phy/drivers/ata/libata-core.c	2008-07-01 16:33:00.000000000 -0700
> @@ -162,6 +162,19 @@ MODULE_DESCRIPTION("Library module for A
>  MODULE_LICENSE("GPL");
>  MODULE_VERSION(DRV_VERSION);
>  
> +static void ata_phy_offline(struct ata_link *link)
> +{
> +	u32 scontrol;
> +	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

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux