diff options
-rw-r--r-- | drivers/ata/libata-core.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 2b222700d9bb..b33aea3638dc 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -821,6 +821,21 @@ void ata_id_c_string(const u16 *id, unsigned char *s, | |||
821 | *p = '\0'; | 821 | *p = '\0'; |
822 | } | 822 | } |
823 | 823 | ||
824 | static u64 ata_id_n_sectors(const u16 *id) | ||
825 | { | ||
826 | if (ata_id_has_lba(id)) { | ||
827 | if (ata_id_has_lba48(id)) | ||
828 | return ata_id_u64(id, 100); | ||
829 | else | ||
830 | return ata_id_u32(id, 60); | ||
831 | } else { | ||
832 | if (ata_id_current_chs_valid(id)) | ||
833 | return ata_id_u32(id, 57); | ||
834 | else | ||
835 | return id[1] * id[3] * id[6]; | ||
836 | } | ||
837 | } | ||
838 | |||
824 | static u64 ata_tf_to_lba48(struct ata_taskfile *tf) | 839 | static u64 ata_tf_to_lba48(struct ata_taskfile *tf) |
825 | { | 840 | { |
826 | u64 sectors = 0; | 841 | u64 sectors = 0; |
@@ -1021,21 +1036,6 @@ static u64 ata_hpa_resize(struct ata_device *dev) | |||
1021 | return sectors; | 1036 | return sectors; |
1022 | } | 1037 | } |
1023 | 1038 | ||
1024 | static u64 ata_id_n_sectors(const u16 *id) | ||
1025 | { | ||
1026 | if (ata_id_has_lba(id)) { | ||
1027 | if (ata_id_has_lba48(id)) | ||
1028 | return ata_id_u64(id, 100); | ||
1029 | else | ||
1030 | return ata_id_u32(id, 60); | ||
1031 | } else { | ||
1032 | if (ata_id_current_chs_valid(id)) | ||
1033 | return ata_id_u32(id, 57); | ||
1034 | else | ||
1035 | return id[1] * id[3] * id[6]; | ||
1036 | } | ||
1037 | } | ||
1038 | |||
1039 | /** | 1039 | /** |
1040 | * ata_id_to_dma_mode - Identify DMA mode from id block | 1040 | * ata_id_to_dma_mode - Identify DMA mode from id block |
1041 | * @dev: device to identify | 1041 | * @dev: device to identify |