aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorShane Huang <shane.huang@amd.com>2012-09-07 10:40:01 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-09-13 01:08:53 -0400
commit65fe1f0f66a57380229a4ced844188103135f37b (patch)
treeeb96e6c8de3bf8c4697618c8ee1dce4bd6d6a9ea /include
parent583661a89ed2e484bd295e7b4606099340478c38 (diff)
ahci: implement aggressive SATA device sleep support
Device Sleep is a feature as described in AHCI 1.3.1 Technical Proposal. This feature enables an HBA and SATA storage device to enter the DevSleep interface state, enabling lower power SATA-based systems. Aggressive Device Sleep enables the HBA to assert the DEVSLP signal as soon as there are no commands outstanding to the device and the port specific Device Sleep idle timer has expired. This enables autonomous entry into the DevSleep interface state without waiting for software in power sensitive systems. This patch enables Aggressive Device Sleep only if both host controller and device support it. Tested on AMD reference board together with Device Sleep supported device sample. Signed-off-by: Shane Huang <shane.huang@amd.com> Reviewed-by: Aaron Lu <aaron.lwe@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h9
-rw-r--r--include/linux/libata.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 47a9dbf0215..408da950217 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -295,6 +295,13 @@ enum {
295 295
296 /* READ_LOG_EXT pages */ 296 /* READ_LOG_EXT pages */
297 ATA_LOG_SATA_NCQ = 0x10, 297 ATA_LOG_SATA_NCQ = 0x10,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_MDAT = 0x30,
301 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F,
302 ATA_LOG_DEVSLP_DETO = 0x31,
303 ATA_LOG_DEVSLP_VALID = 0x37,
304 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
298 305
299 /* READ/WRITE LONG (obsolete) */ 306 /* READ/WRITE LONG (obsolete) */
300 ATA_CMD_READ_LONG = 0x22, 307 ATA_CMD_READ_LONG = 0x22,
@@ -348,6 +355,7 @@ enum {
348 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */ 355 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */
349 SATA_AN = 0x05, /* Asynchronous Notification */ 356 SATA_AN = 0x05, /* Asynchronous Notification */
350 SATA_SSP = 0x06, /* Software Settings Preservation */ 357 SATA_SSP = 0x06, /* Software Settings Preservation */
358 SATA_DEVSLP = 0x09, /* Device Sleep */
351 359
352 /* feature values for SET_MAX */ 360 /* feature values for SET_MAX */
353 ATA_SET_MAX_ADDR = 0x00, 361 ATA_SET_MAX_ADDR = 0x00,
@@ -584,6 +592,7 @@ static inline int ata_is_data(u8 prot)
584 592
585#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 593#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
586#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) 594#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
595#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
587 596
588static inline bool ata_id_has_hipm(const u16 *id) 597static inline bool ata_id_has_hipm(const u16 *id)
589{ 598{
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 64f90e17e51..464e67c2e77 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -162,6 +162,7 @@ enum {
162 ATA_DFLAG_DETACHED = (1 << 25), 162 ATA_DFLAG_DETACHED = (1 << 25),
163 163
164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ 164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
165 166
166 ATA_DEV_UNKNOWN = 0, /* unknown device */ 167 ATA_DEV_UNKNOWN = 0, /* unknown device */
167 ATA_DEV_ATA = 1, /* ATA device */ 168 ATA_DEV_ATA = 1, /* ATA device */
@@ -649,6 +650,9 @@ struct ata_device {
649 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 650 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
650 }; 651 };
651 652
653 /* Identify Device Data Log (30h), SATA Settings (page 08h) */
654 u8 sata_settings[ATA_SECT_SIZE];
655
652 /* error history */ 656 /* error history */
653 int spdn_cnt; 657 int spdn_cnt;
654 /* ering is CLEAR_END, read comment above CLEAR_END */ 658 /* ering is CLEAR_END, read comment above CLEAR_END */