Skip to content

Commit 7c5f641

Browse files
superm1Damien Le Moal
authored andcommitted
ata: libahci: Adjust behavior when StorageD3Enable _DSD is set
The StorageD3Enable _DSD is used for the vendor to indicate that the disk should be opted into or out of a different behavior based upon the platform design. For AMD's Renoir and Green Sardine platforms it's important that any attached SATA storage has transitioned into DevSlp when s2idle is used. If the disk is left in active/partial/slumber, then the system is not able to resume properly. When the StorageD3Enable _DSD is detected, check the system is using s2idle and DevSlp is enabled and if so explicitly wait long enough for the disk to enter DevSlp. Cc: Nehal-bakulchandra Shah <[email protected]> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214091 Link: https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/power-management-for-storage-hardware-devices-intro Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 1527f69 commit 7c5f641

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/ata/libahci.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,18 @@ int ahci_port_resume(struct ata_port *ap)
23232323
EXPORT_SYMBOL_GPL(ahci_port_resume);
23242324

23252325
#ifdef CONFIG_PM
2326+
static void ahci_handle_s2idle(struct ata_port *ap)
2327+
{
2328+
void __iomem *port_mmio = ahci_port_base(ap);
2329+
u32 devslp;
2330+
2331+
if (pm_suspend_via_firmware())
2332+
return;
2333+
devslp = readl(port_mmio + PORT_DEVSLP);
2334+
if ((devslp & PORT_DEVSLP_ADSE))
2335+
ata_msleep(ap, devslp_idle_timeout);
2336+
}
2337+
23262338
static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
23272339
{
23282340
const char *emsg = NULL;
@@ -2336,6 +2348,9 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
23362348
ata_port_freeze(ap);
23372349
}
23382350

2351+
if (acpi_storage_d3(ap->host->dev))
2352+
ahci_handle_s2idle(ap);
2353+
23392354
ahci_rpm_put_port(ap);
23402355
return rc;
23412356
}

0 commit comments

Comments
 (0)