diff options
-rw-r--r-- | drivers/ata/libata-core.c | 12 | ||||
-rw-r--r-- | drivers/ata/libata.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 9121cc443be8..4d78f5debb6c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1211,7 +1211,7 @@ static u64 ata_id_n_sectors(const u16 *id) | |||
1211 | } | 1211 | } |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | static u64 ata_tf_to_lba48(struct ata_taskfile *tf) | 1214 | u64 ata_tf_to_lba48(const struct ata_taskfile *tf) |
1215 | { | 1215 | { |
1216 | u64 sectors = 0; | 1216 | u64 sectors = 0; |
1217 | 1217 | ||
@@ -1222,10 +1222,10 @@ static u64 ata_tf_to_lba48(struct ata_taskfile *tf) | |||
1222 | sectors |= (tf->lbam & 0xff) << 8; | 1222 | sectors |= (tf->lbam & 0xff) << 8; |
1223 | sectors |= (tf->lbal & 0xff); | 1223 | sectors |= (tf->lbal & 0xff); |
1224 | 1224 | ||
1225 | return ++sectors; | 1225 | return sectors; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | static u64 ata_tf_to_lba(struct ata_taskfile *tf) | 1228 | u64 ata_tf_to_lba(const struct ata_taskfile *tf) |
1229 | { | 1229 | { |
1230 | u64 sectors = 0; | 1230 | u64 sectors = 0; |
1231 | 1231 | ||
@@ -1234,7 +1234,7 @@ static u64 ata_tf_to_lba(struct ata_taskfile *tf) | |||
1234 | sectors |= (tf->lbam & 0xff) << 8; | 1234 | sectors |= (tf->lbam & 0xff) << 8; |
1235 | sectors |= (tf->lbal & 0xff); | 1235 | sectors |= (tf->lbal & 0xff); |
1236 | 1236 | ||
1237 | return ++sectors; | 1237 | return sectors; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | /** | 1240 | /** |
@@ -1279,9 +1279,9 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors) | |||
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | if (lba48) | 1281 | if (lba48) |
1282 | *max_sectors = ata_tf_to_lba48(&tf); | 1282 | *max_sectors = ata_tf_to_lba48(&tf) + 1; |
1283 | else | 1283 | else |
1284 | *max_sectors = ata_tf_to_lba(&tf); | 1284 | *max_sectors = ata_tf_to_lba(&tf) + 1; |
1285 | if (dev->horkage & ATA_HORKAGE_HPA_SIZE) | 1285 | if (dev->horkage & ATA_HORKAGE_HPA_SIZE) |
1286 | (*max_sectors)--; | 1286 | (*max_sectors)--; |
1287 | return 0; | 1287 | return 0; |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index a69f663c7402..5e8d0359bccb 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -61,6 +61,8 @@ extern int libata_fua; | |||
61 | extern int libata_noacpi; | 61 | extern int libata_noacpi; |
62 | extern int libata_allow_tpm; | 62 | extern int libata_allow_tpm; |
63 | extern void ata_force_cbl(struct ata_port *ap); | 63 | extern void ata_force_cbl(struct ata_port *ap); |
64 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | ||
65 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | ||
64 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); | 66 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
65 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 67 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
66 | u64 block, u32 n_block, unsigned int tf_flags, | 68 | u64 block, u32 n_block, unsigned int tf_flags, |