From 0a11b06d93c7593350d07e944adc00ab0e1d0108 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 31 Oct 2024 21:50:09 -0400 Subject: 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 --- firmware/drivers/ata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'firmware/drivers/ata.c') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 8df9acb9da..7bb492c39d 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1310,7 +1310,7 @@ int STORAGE_INIT_ATTR ata_init(void) #ifdef MAX_PHYS_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); else phys_sector_mult = 1; @@ -1386,8 +1386,8 @@ void ata_get_info(IF_MD(int drive,)struct storage_info *info) int i; /* Logical sector size > 512B ? */ - if ((identify_info[106] & 0xd000) == 0x5000) - info->sector_size = identify_info[117] | (identify_info[118] << 16); + if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ + info->sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; else info->sector_size = SECTOR_SIZE; -- cgit v1.2.3