mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
9dd2781b87
commit
3664d382e0
3 changed files with 3 additions and 3 deletions
|
@ -1445,7 +1445,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
sector_size = SECTOR_SIZE;
|
sector_size = 512;
|
||||||
|
|
||||||
total_sectors *= sector_size; /* Convert to bytes */
|
total_sectors *= sector_size; /* Convert to bytes */
|
||||||
total_sectors /= (1024 * 1024); /* Convert to MB */
|
total_sectors /= (1024 * 1024); /* Convert to MB */
|
||||||
|
|
|
@ -1116,7 +1116,7 @@ int STORAGE_INIT_ATTR ata_init(void)
|
||||||
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
log_sector_size = SECTOR_SIZE;
|
log_sector_size = 512;
|
||||||
|
|
||||||
rc = freeze_lock();
|
rc = freeze_lock();
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ int ata_init(void)
|
||||||
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
log_sector_size = SECTOR_SIZE;
|
log_sector_size = 512;
|
||||||
|
|
||||||
#ifdef MAX_PHYS_SECTOR_SIZE
|
#ifdef MAX_PHYS_SECTOR_SIZE
|
||||||
rc = ata_get_phys_sector_mult();
|
rc = ata_get_phys_sector_mult();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue