Device Initiated Power Management, which is defined
in SATA 2.5 can be enabled for disks which support it.
This patch enables DIPM when the user sets the link
power management policy to "min_power".Additionally, libata drivers can define a function
(enable_pm) that will perform hardware specific actions to
enable whatever power management policy the user set up
for Host Initiated Power management (HIPM).
This power management policy will be activated after all
disks have been enumerated and intialized. Drivers should
also define disable_pm, which will turn off link power
management, but not change link power management policy.Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
---
Documentation/scsi/link_power_management_policy.txt | 19 +
drivers/ata/libata-core.c | 194 +++++++++++++++++++-
drivers/ata/libata-eh.c | 5
drivers/ata/libata-scsi.c | 83 ++++++++
include/linux/ata.h | 7
include/linux/libata.h | 25 ++
6 files changed, 322 insertions(+), 11 deletions(-)Index: libata-dev/drivers/ata/libata-scsi.c
===================================================================
--- libata-dev.orig/drivers/ata/libata-scsi.c 2007-09-24 13:43:10.000000000 -0700
+++ libata-dev/drivers/ata/libata-scsi.c 2007-09-24 13:46:22.000000000 -0700
@@ -110,6 +110,78 @@ static struct scsi_transport_template at
};+static const struct {
+ enum link_pm value;
+ char *name;
+} link_pm_policy[] = {
+ { NOT_AVAILABLE, "max_performance" },
+ { MIN_POWER, "min_power" },
+ { MAX_PERFORMANCE, "max_performance" },
+ { MEDIUM_POWER, "medium_power" },
+};
+
+const char *ata_scsi_link_pm_policy(enum link_pm policy)
+{
+ int i;
+ char *name = NULL;
+
+ for (i = 0; i < ARRAY_SIZE(link_pm_policy); i++) {
+ if (link_pm_policy[i].value == policy) {
+ name = link_pm_policy[i].name;
+ break;
+ ...
applied as the attached two patches to jgarzik/libata-dev.git#alpm
open issues:
1) need to check ata_dev_set_feature() return value in
ata_dev_set_dipm() and do something useful with it2) as the name implies, this probably better belongs in ata_link.
3) however, the feature is tightly coupled to the host controller. in
theory PMP -might- do this, but I think its unlikely. as such I was OK
with the present arrangement.4) there has been some discussion of software-initiated device/link
power management, but I think this should go in, in parallel with those
discussions. ALPM
* is quite self-contained
* gives a noticable power savingsI'm definitely interested in seeing somebody pursue software-initiated
link PM as well...Jeff
^
|
are you sure this
should be 76?we can also change the first statement a bit:
and:
-
On Tue, 25 Sep 2007 01:12:32 +0200
I feel this is equivalent functionality and not as readable.
-
Poke around for Alan Cox's cleanup of this area of linux/ata.h.
It converts several macros to inline functions (encouraged), and also
illustrates a nice, clean way of testing an ID word's validity.
[obviously the final implementation varies, depending on that ID word's
history]Alan or Andrew, got a copy somewhere? My feeble search skills don't
seem to turn it up at the moment, even though I had a copy in my hands
quite recently.Jeff
-
Its in -mm and I thought you put a copy in your tree after I said it
hadn't upset anything in -mm ?Alan
-
it didn't apply straightaway to my tree for whatever reason, IIRC
-
int foo(int i, int j) {
return !(i & 8) || !j;
}int moo(int i, int j) {
return !((i & 8) && j);
}gcc -O2 -S:
.globl foo
.type foo, @function
foo:
shrl $3, %edi
xorl $1, %edi
testl %esi, %esi
sete %al
orl %eax, %edi
andl $1, %edi
movl %edi, %eax
ret
.globl moo
.type moo, @function
moo:
shrl $3, %edi
xorl $1, %edi
testl %esi, %esi
sete %al
orl %eax, %edi
andl $1, %edi
movl %edi, %eax
ret- Davide
-
Indeed, no difference, except for the eye.
do you not consider it an improvement or do you not want to change it?
or
don't you consider it an improvement and want to change it?-
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Tarkan Erimer | Re: Slow DOWN, please!!! |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Dave Hansen | Re: [RFC/PATCH] Documentation of kernel messages |
git: | |
| Sander | 'struct task_struct' has no member named 'mems_allowed' (was: Re: 2.6.20-rc4-mm1) |
| Evgeniy Polyakov | Re: [PATCH 3/3] Convert the UDP hash lock to RCU |
| Frans Pop | svc: failed to register lockdv1 RPC service (errno 97). |
| Stephen Hemminger | Re: HTB accuracy for high speed |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
