1
0
Fork 0
forked from len0rd/rockbox

ATA: Fix regression when trying to set power management mode with CF cards

Some CF cards claim to support Advanced Power Management, but error
out when the command is issued.  There is a special case in the
code that ignored errors when issuing the APM command, but was referenced
against a specific index in the feature table.

When the tagle was reorganized, the index was wrong depending
on if ATA_DMA was enabled or not.

The fix is to test against the specific subcommand ID instead of the
table index.

Change-Id: I2ef7a05b2d70675c38e41d70b5189b394056cb74
This commit is contained in:
Solomon Peachy 2024-06-14 10:52:13 -04:00
parent de4a08f319
commit ae25a425b6

View file

@ -1151,7 +1151,7 @@ static int set_features(void)
return -10 - i;
}
if((ATA_IN8(ATA_ALT_STATUS) & STATUS_ERR) && (i != 1)) {
if((ATA_IN8(ATA_ALT_STATUS) & STATUS_ERR) && (features[i].subcommand != 0x05)) {
/* some CF cards don't like advanced powermanagement
even if they mark it as supported - go figure... */
if(ATA_IN8(ATA_ERROR) & ERROR_ABRT) {