diff options
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r-- | firmware/drivers/ata.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index f5b8810d28..1491d2376e 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -78,8 +78,8 @@ static long sleep_timeout = 5*HZ; | |||
78 | #ifdef HAVE_ATA_POWER_OFF | 78 | #ifdef HAVE_ATA_POWER_OFF |
79 | static int poweroff_timeout = 2*HZ; | 79 | static int poweroff_timeout = 2*HZ; |
80 | #endif | 80 | #endif |
81 | #ifdef HAVE_BIGLBA | 81 | #ifdef HAVE_LBA48 |
82 | static bool biglba = false; /* set for 48 bit addressing */ | 82 | static bool lba48 = false; /* set for 48 bit addressing */ |
83 | #endif | 83 | #endif |
84 | static long ata_stack[DEFAULT_STACK_SIZE/sizeof(long)]; | 84 | static long ata_stack[DEFAULT_STACK_SIZE/sizeof(long)]; |
85 | static const char ata_thread_name[] = "ata"; | 85 | static const char ata_thread_name[] = "ata"; |
@@ -257,8 +257,8 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
257 | ret = 0; | 257 | ret = 0; |
258 | last_disk_activity = current_tick; | 258 | last_disk_activity = current_tick; |
259 | 259 | ||
260 | #ifdef HAVE_BIGLBA | 260 | #ifdef HAVE_LBA48 |
261 | if (biglba) | 261 | if (lba48) |
262 | { | 262 | { |
263 | SET_REG(ATA_NSECTOR, count >> 8); | 263 | SET_REG(ATA_NSECTOR, count >> 8); |
264 | SET_REG(ATA_NSECTOR, count & 0xff); | 264 | SET_REG(ATA_NSECTOR, count & 0xff); |
@@ -274,11 +274,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
274 | else | 274 | else |
275 | #endif | 275 | #endif |
276 | { | 276 | { |
277 | if ( count == 256 ) | 277 | SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */ |
278 | SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */ | ||
279 | else | ||
280 | SET_REG(ATA_NSECTOR, (unsigned char)count); | ||
281 | |||
282 | SET_REG(ATA_SECTOR, start & 0xff); | 278 | SET_REG(ATA_SECTOR, start & 0xff); |
283 | SET_REG(ATA_LCYL, (start >> 8) & 0xff); | 279 | SET_REG(ATA_LCYL, (start >> 8) & 0xff); |
284 | SET_REG(ATA_HCYL, (start >> 16) & 0xff); | 280 | SET_REG(ATA_HCYL, (start >> 16) & 0xff); |
@@ -452,8 +448,8 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
452 | return -2; | 448 | return -2; |
453 | } | 449 | } |
454 | 450 | ||
455 | #ifdef HAVE_BIGLBA | 451 | #ifdef HAVE_LBA48 |
456 | if (biglba) | 452 | if (lba48) |
457 | { | 453 | { |
458 | SET_REG(ATA_NSECTOR, count >> 8); | 454 | SET_REG(ATA_NSECTOR, count >> 8); |
459 | SET_REG(ATA_NSECTOR, count & 0xff); | 455 | SET_REG(ATA_NSECTOR, count & 0xff); |
@@ -469,10 +465,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
469 | else | 465 | else |
470 | #endif | 466 | #endif |
471 | { | 467 | { |
472 | if ( count == 256 ) | 468 | SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */ |
473 | SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */ | ||
474 | else | ||
475 | SET_REG(ATA_NSECTOR, (unsigned char)count); | ||
476 | SET_REG(ATA_SECTOR, start & 0xff); | 469 | SET_REG(ATA_SECTOR, start & 0xff); |
477 | SET_REG(ATA_LCYL, (start >> 8) & 0xff); | 470 | SET_REG(ATA_LCYL, (start >> 8) & 0xff); |
478 | SET_REG(ATA_HCYL, (start >> 16) & 0xff); | 471 | SET_REG(ATA_HCYL, (start >> 16) & 0xff); |
@@ -985,12 +978,12 @@ int ata_init(void) | |||
985 | multisectors = identify_info[47] & 0xff; | 978 | multisectors = identify_info[47] & 0xff; |
986 | DEBUGF("ata: %d sectors per ata request\n",multisectors); | 979 | DEBUGF("ata: %d sectors per ata request\n",multisectors); |
987 | 980 | ||
988 | #ifdef HAVE_BIGLBA | 981 | #ifdef HAVE_LBA48 |
989 | if (identify_info[83] & 0x0400 /* 48 bit address support */ | 982 | if (identify_info[83] & 0x0400 /* 48 bit address support */ |
990 | && identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */ | 983 | && identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */ |
991 | && identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */ | 984 | && identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */ |
992 | { | 985 | { |
993 | biglba = true; /* use BigLBA */ | 986 | lba48 = true; /* use BigLBA */ |
994 | } | 987 | } |
995 | #endif | 988 | #endif |
996 | rc = freeze_lock(); | 989 | rc = freeze_lock(); |