forked from len0rd/rockbox
ata: Correct parsing of the logical sector size in the IDENTIFY DEVICE
....It's specified in 16-bit words, not bytes. So multiply it by 2. (This hasn't been a problem in practice as everything uses 512B logical sectors so far..) Change-Id: I0b1abd0f6184330f0b7f5c000c5ad547038f7c95
This commit is contained in:
parent
d401501fda
commit
0a11b06d93
3 changed files with 8 additions and 8 deletions
|
@ -1442,8 +1442,8 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
uint32_t sector_size;
|
uint32_t sector_size;
|
||||||
|
|
||||||
/* Logical sector size > 512B ? */
|
/* Logical sector size > 512B ? */
|
||||||
if ((identify_info[106] & 0xd000) == 0x5000)
|
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
sector_size = identify_info[117] | (identify_info[118] << 16);
|
sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
sector_size = SECTOR_SIZE;
|
sector_size = SECTOR_SIZE;
|
||||||
|
|
||||||
|
@ -1456,7 +1456,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier());
|
simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((identify_info[106] & 0xe000) == 0x6000)
|
if((identify_info[106] & 0xe000) == 0x6000) /* B14, B13 */
|
||||||
sector_size *= BIT_N(identify_info[106] & 0x000f);
|
sector_size *= BIT_N(identify_info[106] & 0x000f);
|
||||||
simplelist_addline(
|
simplelist_addline(
|
||||||
"Physical sector size: %lu B", sector_size);
|
"Physical sector size: %lu B", sector_size);
|
||||||
|
|
|
@ -1310,7 +1310,7 @@ int STORAGE_INIT_ATTR ata_init(void)
|
||||||
|
|
||||||
#ifdef MAX_PHYS_SECTOR_SIZE
|
#ifdef MAX_PHYS_SECTOR_SIZE
|
||||||
/* Find out the physical sector size */
|
/* Find out the physical sector size */
|
||||||
if((identify_info[106] & 0xe000) == 0x6000)
|
if((identify_info[106] & 0xe000) == 0x6000) /* B14, B13 */
|
||||||
phys_sector_mult = BIT_N(identify_info[106] & 0x000f);
|
phys_sector_mult = BIT_N(identify_info[106] & 0x000f);
|
||||||
else
|
else
|
||||||
phys_sector_mult = 1;
|
phys_sector_mult = 1;
|
||||||
|
@ -1386,8 +1386,8 @@ void ata_get_info(IF_MD(int drive,)struct storage_info *info)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Logical sector size > 512B ? */
|
/* Logical sector size > 512B ? */
|
||||||
if ((identify_info[106] & 0xd000) == 0x5000)
|
if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
info->sector_size = identify_info[117] | (identify_info[118] << 16);
|
info->sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
info->sector_size = SECTOR_SIZE;
|
info->sector_size = SECTOR_SIZE;
|
||||||
|
|
||||||
|
|
|
@ -1145,8 +1145,8 @@ void ata_spin(void)
|
||||||
void ata_get_info(IF_MD(int drive,) struct storage_info *info)
|
void ata_get_info(IF_MD(int drive,) struct storage_info *info)
|
||||||
{
|
{
|
||||||
/* Logical sector size */
|
/* Logical sector size */
|
||||||
if ((ata_identify_data[106] & 0xd000) == 0x5000)
|
if ((ata_identify_data[106] & 0xd000) == 0x5000) /* B14, B12 */
|
||||||
info->sector_size = ata_identify_data[117] | (ata_identify_data[118] << 16);
|
info->sector_size = (ata_identify_data[117] | (ata_identify_data[118] << 16)) * 2;
|
||||||
else
|
else
|
||||||
info->sector_size = SECTOR_SIZE;
|
info->sector_size = SECTOR_SIZE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue