summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/ata.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 2140456e6b..4780cf5c0f 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -1351,20 +1351,6 @@ int ata_init(void)
1351 1351
1352 DEBUGF("ata: %d sectors per ata request\n",multisectors); 1352 DEBUGF("ata: %d sectors per ata request\n",multisectors);
1353 1353
1354#ifdef MAX_PHYS_SECTOR_SIZE
1355 /* Find out the physical sector size */
1356 if((identify_info[106] & 0xe000) == 0x6000)
1357 phys_sector_mult = BIT_N(identify_info[106] & 0x000f);
1358 else
1359 phys_sector_mult = 1;
1360
1361 DEBUGF("ata: %d logical sectors per phys sector", phys_sector_mult);
1362
1363 if (phys_sector_mult > (MAX_PHYS_SECTOR_SIZE/SECTOR_SIZE))
1364 panicf("Unsupported physical sector size: %d",
1365 phys_sector_mult * SECTOR_SIZE);
1366#endif
1367
1368 total_sectors = identify_info[60] | (identify_info[61] << 16); 1354 total_sectors = identify_info[60] | (identify_info[61] << 16);
1369 1355
1370#ifdef HAVE_LBA48 1356#ifdef HAVE_LBA48
@@ -1387,6 +1373,32 @@ int ata_init(void)
1387 if (rc) 1373 if (rc)
1388 return -60 + rc; 1374 return -60 + rc;
1389 1375
1376#ifdef MAX_PHYS_SECTOR_SIZE
1377 /* Find out the physical sector size */
1378 if((identify_info[106] & 0xe000) == 0x6000)
1379 phys_sector_mult = BIT_N(identify_info[106] & 0x000f);
1380 else
1381 phys_sector_mult = 1;
1382
1383 DEBUGF("ata: %d logical sectors per phys sector", phys_sector_mult);
1384
1385 if (phys_sector_mult > 1)
1386 {
1387 /* Check if drive really needs emulation - if we can access
1388 * sector 1 then assume the drive will handle it better than
1389 * us, and ignore the large physical sectors.
1390 */
1391 char throwaway[SECTOR_SIZE];
1392 rc = ata_transfer_sectors(1, 1, &throwaway, false);
1393 if (rc == 0)
1394 phys_sector_mult = 1;
1395 }
1396
1397 if (phys_sector_mult > (MAX_PHYS_SECTOR_SIZE/SECTOR_SIZE))
1398 panicf("Unsupported physical sector size: %d",
1399 phys_sector_mult * SECTOR_SIZE);
1400#endif
1401
1390 mutex_lock(&ata_mtx); /* Balance unlock below */ 1402 mutex_lock(&ata_mtx); /* Balance unlock below */
1391 1403
1392 last_disk_activity = current_tick; 1404 last_disk_activity = current_tick;