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
This commit is contained in:
Christian Soffke 2021-02-15 14:31:50 +01:00 committed by Solomon Peachy
parent fb99d890a8
commit be99033cbb
1 changed files with 13 additions and 0 deletions

View File

@ -809,6 +809,19 @@ 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. */
if (!(identify_info[82] & (1 << 3)))
return false;
return ata_state >= ATA_SPINUP;
}