From ca77329fb713b7fea6a307068e0dd0248e7aa640 Mon Sep 17 00:00:00 2001 From: Kristen Carlson Accardi Date: Thu, 25 Oct 2007 00:58:59 -0400 Subject: [libata] Link power management infrastructure 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. Documentation/scsi/link_power_management_policy.txt has additional information. Signed-off-by: Kristen Carlson Accardi Signed-off-by: Jeff Garzik --- include/linux/ata.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/linux/ata.h') diff --git a/include/linux/ata.h b/include/linux/ata.h index e21c002..128dc7a 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -236,6 +236,7 @@ enum { /* SETFEATURE Sector counts for SATA features */ SATA_AN = 0x05, /* Asynchronous Notification */ + SATA_DIPM = 0x03, /* Device Initiated Power Management */ /* ATAPI stuff */ ATAPI_PKT_DMA = (1 << 0), @@ -378,6 +379,26 @@ struct ata_taskfile { #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) +static inline bool ata_id_has_hipm(const u16 *id) +{ + u16 val = id[76]; + + if (val == 0 || val == 0xffff) + return false; + + return val & (1 << 9); +} + +static inline bool ata_id_has_dipm(const u16 *id) +{ + u16 val = id[78]; + + if (val == 0 || val == 0xffff) + return false; + + return val & (1 << 3); +} + static inline int ata_id_has_fua(const u16 *id) { if ((id[84] & 0xC000) != 0x4000) -- cgit v1.1