aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-08-20 16:42:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-08-20 16:42:57 -0400
commitb0244a00451c1ad64bf0a51f50679f7146786780 (patch)
tree14f7725795ba27712a6d76820dde336ad6a17ef8 /drivers/ide/ide-disk.c
parent76e1faa7cfd464fa06a9c2cafd633d643daafeae (diff)
ide-disk: workaround for buggy HPA support on ST340823A (take 3)
This disk reports total number of sectors instead of maximum sector address in response to READ_NATIVE_MAX_ADDRESS command and also happily accepts SET_MAX_ADDRESS command with the bogus value. This results in +1 sector capacity being used and errors on attempts to use the last sector. ... hdd: Host Protected Area detected.         current capacity is 78165360 sectors (40020 MB)         native  capacity is 78165361 sectors (40020 MB) hdd: Host Protected Area disabled. ... hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000 hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error } hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, sector=78165360 ... Add hpa_list[] table and workaround the issue in idedisk_check_hpa(). v2: * Add missing export and improve patch description a bit. v3: * Add list termination. (From Mikko) Fixes kernel bugzilla bug #8816. Thanks to Mikko for investigating the issue and helping with this patch. Cc: Mikko Rapeli <mikko.rapeli@iki.fi> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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)
481 && id->lba_capacity_2; 481 && id->lba_capacity_2;
482} 482}
483 483
484/*
485 * Some disks report total number of sectors instead of
486 * maximum sector address. We list them here.
487 */
488static const struct drive_list_entry hpa_list[] = {
489 { "ST340823A", NULL },
490 { NULL, NULL }
491};
492
484static void idedisk_check_hpa(ide_drive_t *drive) 493static void idedisk_check_hpa(ide_drive_t *drive)
485{ 494{
486 unsigned long long capacity, set_max; 495 unsigned long long capacity, set_max;
@@ -492,6 +501,15 @@ static void idedisk_check_hpa(ide_drive_t *drive)
492 else 501 else
493 set_max = idedisk_read_native_max_address(drive); 502 set_max = idedisk_read_native_max_address(drive);
494 503
504 if (ide_in_drive_list(drive->id, hpa_list)) {
505 /*
506 * Since we are inclusive wrt to firmware revisions do this
507 * extra check and apply the workaround only when needed.
508 */
509 if (set_max == capacity + 1)
510 set_max--;
511 }
512
495 if (set_max <= capacity) 513 if (set_max <= capacity)
496 return; 514 return;
497 515