diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:30 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:30 -0400 |
commit | 942dcd85bf8edf38cdc3745306ca250684d99a61 (patch) | |
tree | 4d43552e3805c1df8585bb4056d6076dc56e5f09 /drivers/ide | |
parent | 367d7e78dd48cf6ad35182a99d97abb5486e040e (diff) |
ide: idedisk_supports_lba48() -> ata_id_lba48_enabled()
* Add ata_id_lba48_enabled() inline helper to <linux/ata.h>.
* idedisk_supports_lba48() -> ata_id_lba48_enabled()
The latter one also checks validity of words 83 & 86.
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-disk.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 08f47cb13425..8f49bc0ecbf8 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -384,16 +384,6 @@ static unsigned long long sectors_to_MB(unsigned long long n) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * The same here. | ||
388 | */ | ||
389 | static inline int idedisk_supports_lba48(const u16 *id) | ||
390 | { | ||
391 | return (id[ATA_ID_COMMAND_SET_2] & 0x0400) && | ||
392 | (id[ATA_ID_CFS_ENABLE_2] & 0x0400) && | ||
393 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
394 | } | ||
395 | |||
396 | /* | ||
397 | * Some disks report total number of sectors instead of | 387 | * Some disks report total number of sectors instead of |
398 | * maximum sector address. We list them here. | 388 | * maximum sector address. We list them here. |
399 | */ | 389 | */ |
@@ -407,7 +397,7 @@ static const struct drive_list_entry hpa_list[] = { | |||
407 | static void idedisk_check_hpa(ide_drive_t *drive) | 397 | static void idedisk_check_hpa(ide_drive_t *drive) |
408 | { | 398 | { |
409 | unsigned long long capacity, set_max; | 399 | unsigned long long capacity, set_max; |
410 | int lba48 = idedisk_supports_lba48(drive->id); | 400 | int lba48 = ata_id_lba48_enabled(drive->id); |
411 | 401 | ||
412 | capacity = drive->capacity64; | 402 | capacity = drive->capacity64; |
413 | 403 | ||
@@ -450,7 +440,7 @@ static void init_idedisk_capacity(ide_drive_t *drive) | |||
450 | */ | 440 | */ |
451 | int hpa = ata_id_hpa_enabled(id); | 441 | int hpa = ata_id_hpa_enabled(id); |
452 | 442 | ||
453 | if (idedisk_supports_lba48(id)) { | 443 | if (ata_id_lba48_enabled(id)) { |
454 | /* drive speaks 48-bit LBA */ | 444 | /* drive speaks 48-bit LBA */ |
455 | drive->select.b.lba = 1; | 445 | drive->select.b.lba = 1; |
456 | drive->capacity64 = ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | 446 | drive->capacity64 = ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); |
@@ -754,9 +744,11 @@ static int set_lba_addressing(ide_drive_t *drive, int arg) | |||
754 | if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) | 744 | if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) |
755 | return 0; | 745 | return 0; |
756 | 746 | ||
757 | if (!idedisk_supports_lba48(drive->id)) | 747 | if (ata_id_lba48_enabled(drive->id) == 0) |
758 | return -EIO; | 748 | return -EIO; |
749 | |||
759 | drive->addressing = arg; | 750 | drive->addressing = arg; |
751 | |||
760 | return 0; | 752 | return 0; |
761 | } | 753 | } |
762 | 754 | ||
@@ -853,8 +845,7 @@ static void idedisk_setup(ide_drive_t *drive) | |||
853 | capacity = idedisk_capacity(drive); | 845 | capacity = idedisk_capacity(drive); |
854 | 846 | ||
855 | if (!drive->forced_geom) { | 847 | if (!drive->forced_geom) { |
856 | 848 | if (ata_id_lba48_enabled(drive->id)) { | |
857 | if (idedisk_supports_lba48(drive->id)) { | ||
858 | /* compatibility */ | 849 | /* compatibility */ |
859 | drive->bios_sect = 63; | 850 | drive->bios_sect = 63; |
860 | drive->bios_head = 255; | 851 | drive->bios_head = 255; |