Skip to content

Commit 93328e1

Browse files
Alan CoxJeff Garzik
authored andcommitted
[PATCH] libata: Fix HPA handling regression
Restore the support for handling drives that report one sector too many (ie SCSI not ATA style). This worked before the HPA update but was removed in that process. Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent 54174db commit 93328e1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/ata/libata-core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,8 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
915915
*max_sectors = ata_tf_to_lba48(&tf);
916916
else
917917
*max_sectors = ata_tf_to_lba(&tf);
918-
918+
if (dev->horkage & ATA_HORKAGE_HPA_SIZE)
919+
(*max_sectors)--;
919920
return 0;
920921
}
921922

@@ -3905,6 +3906,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
39053906
{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA },
39063907
{ "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA },
39073908

3909+
/* Devices which report 1 sector over size HPA */
3910+
{ "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, },
3911+
{ "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
3912+
39083913
/* End Marker */
39093914
{ }
39103915
};

include/linux/libata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ enum {
330330
ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
331331
ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
332332
ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
333+
ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
333334
};
334335

335336
enum hsm_task_states {

0 commit comments

Comments
 (0)