From ae25a425b6dc1689f35afd77e8064912e4b30a60 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 14 Jun 2024 10:52:13 -0400 Subject: 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 --- firmware/drivers/ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index bb87357a1a..b245cbc09e 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -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) { -- cgit v1.2.3