From 56a1e87501007188df9160b76bfb0c1118097fe0 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 4 Mar 2021 17:37:51 -0500 Subject: ata: Make ata_disk_is_active() only special-case powermgmt-less devices. SSDs that respect powermgmt commands should be treated the same, as the powermgmt commands are an important part of ensuring it's safe to shut down. And greatly expand the comment explaining things. Change-Id: Ia52b99fca802f495422b5ee097390a72dbc28f61 --- firmware/drivers/ata.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'firmware/drivers/ata.c') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 56dc7d74fe..7d306084e4 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -809,16 +809,17 @@ void ata_spindown(int seconds) bool ata_disk_is_active(void) { - /* "active" here means "spinning and needs to be shut down" */ - - /* SSDs are considered always "inactive" */ - if (ata_disk_isssd()) - return false; - - /* We can't directly detect the common iFlash adapters, but they - don't claim to support powermanagement. Without ATA power - management we can never spin down anyway, so there's - no point in even trying. */ + /* "active" here means "spinning / not sleeping" + we normally leave active state by putting the device to + sleep (using ATA powersave commands) which flushes all writes + and puts the device into an inactive/quiescent state. + + Unfortuantely the CF->SD chipset used by the common iFlash + adapters does not support ATA powersave, which makes the + "active/not" distinction irrelevant, so insead we just mirror + the sd/mmc/flash storage drivers and claim that we're always + inactive. + */ if (!(identify_info[82] & (1 << 3))) return false; @@ -828,7 +829,7 @@ bool ata_disk_is_active(void) void ata_sleepnow(void) { /* Don't enter sleep if the device doesn't support - power management. */ + power management. See comment in ata_disk_is_active() */ if (!(identify_info[82] & (1 << 3))) return; -- cgit v1.2.3