diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-11-24 22:45:05 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-24 23:26:09 -0500 |
commit | 87e55baaad182262e84463960ef9b1427c7dd900 (patch) | |
tree | 8c2ac20452d71fdabfa3f04755211b2cff1932c2 | |
parent | 375a6bc9b1e6a7fa14daff1e82a4b82547f7d9bc (diff) | |
download | rockbox-87e55baaad.tar.gz rockbox-87e55baaad.zip |
ata: Use a better default for SET_MULTIPLE_MODE
* If the device returns a valid upper limit (word 47) use that.
* If the current limit (word 59) is valid, use that.
* Fall back to 1 as a default, not 16!
Note this is only used for PIO transfers!
Change-Id: I269b751466242bbcce91ee991d9ade449cc84b6b
-rw-r--r-- | firmware/drivers/ata.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 04b6b15b08..2baa444762 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -112,7 +112,7 @@ static long power_off_tick = 0; static sector_t total_sectors; static uint32_t log_sector_size; -static int multisectors; /* number of supported multisectors */ +static uint8_t multisectors; /* number of supported multisectors */ static unsigned short identify_info[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR; @@ -1097,10 +1097,12 @@ int STORAGE_INIT_ATTR ata_init(void) } multisectors = identify_info[47] & 0xff; - if (multisectors == 0) /* Invalid multisector info, try with 16 */ - multisectors = 16; + if (!multisectors && (identify_info[59] & 0x100) == 0x100) + multisectors = identify_info[59] & 0xff; + if (!multisectors) + multisectors = 1; /* One transfer per REQ */ - DEBUGF("ata: %d sectors per ata request\n", multisectors); + DEBUGF("ata: max %d sectors per DRQ\n", multisectors); total_sectors = (identify_info[61] << 16) | identify_info[60]; @@ -1142,6 +1144,7 @@ int STORAGE_INIT_ATTR ata_init(void) ata_state = ATA_ON; keep_ata_active(); } + rc = set_multiple_mode(multisectors); if (rc) rc = -100 + rc; |