summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-08-23 10:43:14 +0100
committerDavid Woodhouse <dwmw2@infradead.org>2007-08-23 10:43:14 +0100
commitac0c955d5048c2c580fa7166a89133f0fd76c125 (patch)
tree041ac4fb544c7244a1a0b35c8ceabc142d5645c1 /drivers/ide/ide-disk.c
parent68d09b1b6780415d82160f6b6d88e82bd724e691 (diff)
parentb377fd3982ad957c796758a90e2988401a884241 (diff)
downloadlinux-ac0c955d5048c2c580fa7166a89133f0fd76c125.tar.bz2
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 5ce4216f72a2..eba1adbc1b6a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -481,6 +481,15 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id)
&& id->lba_capacity_2;
}
+/*
+ * Some disks report total number of sectors instead of
+ * maximum sector address. We list them here.
+ */
+static const struct drive_list_entry hpa_list[] = {
+ { "ST340823A", NULL },
+ { NULL, NULL }
+};
+
static void idedisk_check_hpa(ide_drive_t *drive)
{
unsigned long long capacity, set_max;
@@ -492,6 +501,15 @@ static void idedisk_check_hpa(ide_drive_t *drive)
else
set_max = idedisk_read_native_max_address(drive);
+ if (ide_in_drive_list(drive->id, hpa_list)) {
+ /*
+ * Since we are inclusive wrt to firmware revisions do this
+ * extra check and apply the workaround only when needed.
+ */
+ if (set_max == capacity + 1)
+ set_max--;
+ }
+
if (set_max <= capacity)
return;