diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-03-04 17:37:51 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-03-04 17:37:51 -0500 |
commit | 56a1e87501007188df9160b76bfb0c1118097fe0 (patch) | |
tree | 53c4cffba16104dc1a858e3dd40f4c0cd32b35a3 /firmware/drivers/ata.c | |
parent | be99033cbb98444bd8bca8926502f20c45c5b430 (diff) | |
download | rockbox-56a1e87501007188df9160b76bfb0c1118097fe0.tar.gz rockbox-56a1e87501007188df9160b76bfb0c1118097fe0.zip |
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
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r-- | firmware/drivers/ata.c | 23 |
1 files changed, 12 insertions, 11 deletions
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) | |||
809 | 809 | ||
810 | bool ata_disk_is_active(void) | 810 | bool ata_disk_is_active(void) |
811 | { | 811 | { |
812 | /* "active" here means "spinning and needs to be shut down" */ | 812 | /* "active" here means "spinning / not sleeping" |
813 | 813 | we normally leave active state by putting the device to | |
814 | /* SSDs are considered always "inactive" */ | 814 | sleep (using ATA powersave commands) which flushes all writes |
815 | if (ata_disk_isssd()) | 815 | and puts the device into an inactive/quiescent state. |
816 | return false; | 816 | |
817 | 817 | Unfortuantely the CF->SD chipset used by the common iFlash | |
818 | /* We can't directly detect the common iFlash adapters, but they | 818 | adapters does not support ATA powersave, which makes the |
819 | don't claim to support powermanagement. Without ATA power | 819 | "active/not" distinction irrelevant, so insead we just mirror |
820 | management we can never spin down anyway, so there's | 820 | the sd/mmc/flash storage drivers and claim that we're always |
821 | no point in even trying. */ | 821 | inactive. |
822 | */ | ||
822 | if (!(identify_info[82] & (1 << 3))) | 823 | if (!(identify_info[82] & (1 << 3))) |
823 | return false; | 824 | return false; |
824 | 825 | ||
@@ -828,7 +829,7 @@ bool ata_disk_is_active(void) | |||
828 | void ata_sleepnow(void) | 829 | void ata_sleepnow(void) |
829 | { | 830 | { |
830 | /* Don't enter sleep if the device doesn't support | 831 | /* Don't enter sleep if the device doesn't support |
831 | power management. */ | 832 | power management. See comment in ata_disk_is_active() */ |
832 | if (!(identify_info[82] & (1 << 3))) | 833 | if (!(identify_info[82] & (1 << 3))) |
833 | return; | 834 | return; |
834 | 835 | ||