diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-11-07 18:14:03 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-07 18:15:26 -0500 |
commit | 3664d382e038611c7cd03e594d448df91557ffd4 (patch) | |
tree | 02e2f3af9eb4d81a9e2617666eb4d5eee93ea246 | |
parent | 9dd2781b87450780047b9cdcb78b90c26951473f (diff) | |
download | rockbox-3664d382e0.tar.gz rockbox-3664d382e0.zip |
ata: if drive doesn't advertise a nonstandard sector size, default to 512
...Instead of SECTOR_SIZE, which might be different. This way
we can properly validate the value.
Change-Id: I8e6ae5882792f301ac580a144556af94772f4cfe
-rw-r--r-- | apps/debug_menu.c | 2 | ||||
-rw-r--r-- | firmware/drivers/ata.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 62750a716a..0c4cc386aa 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1445,7 +1445,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; else - sector_size = SECTOR_SIZE; + sector_size = 512; total_sectors *= sector_size; /* Convert to bytes */ total_sectors /= (1024 * 1024); /* Convert to MB */ diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index b688da494e..f73e4c7d5b 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1116,7 +1116,7 @@ int STORAGE_INIT_ATTR ata_init(void) if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; else - log_sector_size = SECTOR_SIZE; + log_sector_size = 512; rc = freeze_lock(); if (rc) { diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c index 3bde5647ba..4fc6489d48 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c @@ -1154,7 +1154,7 @@ int ata_init(void) if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; else - log_sector_size = SECTOR_SIZE; + log_sector_size = 512; #ifdef MAX_PHYS_SECTOR_SIZE rc = ata_get_phys_sector_mult(); |