summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-02-15 14:31:50 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-03-04 16:50:50 -0500
commitbe99033cbb98444bd8bca8926502f20c45c5b430 (patch)
treed212fcea6a95e42923c1fef420df7a4bfc0657f8 /firmware/drivers/ata.c
parentfb99d890a8ed5da627885da62f85c9f5bcd08d47 (diff)
downloadrockbox-be99033cbb98444bd8bca8926502f20c45c5b430.tar.gz
rockbox-be99033cbb98444bd8bca8926502f20c45c5b430.zip
Always indicate inactive ata disk if device is solid state or doesn't support power management
Commit 5462907 made sure that SLEEP commands weren't issued on devices that don't support ATA power management commands (e.g. certain CF->SD converters including several iFlash models). Since Rockbox waits for the disk to become inactive in shutdown_hw(), which won't happen in this case, the OS would previously stall during the shutdown process until a timeout was reached. Change-Id: I03bb05f6f6401bb8f0da5d0b76bd3f07681fdc06
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r--firmware/drivers/ata.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index ba0d6d169e..56dc7d74fe 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -809,6 +809,19 @@ void ata_spindown(int seconds)
809 809
810bool ata_disk_is_active(void) 810bool ata_disk_is_active(void)
811{ 811{
812 /* "active" here means "spinning and needs to be shut down" */
813
814 /* SSDs are considered always "inactive" */
815 if (ata_disk_isssd())
816 return false;
817
818 /* We can't directly detect the common iFlash adapters, but they
819 don't claim to support powermanagement. Without ATA power
820 management we can never spin down anyway, so there's
821 no point in even trying. */
822 if (!(identify_info[82] & (1 << 3)))
823 return false;
824
812 return ata_state >= ATA_SPINUP; 825 return ata_state >= ATA_SPINUP;
813} 826}
814 827