[PATCH]: Sanity checking for drives that claim to be LBA-48, but aren't!

From: James Finnie (jf1@IMERGE.co.uk)
Date: Thu Oct 17 2002 - 04:02:00 EST

Hi guys,

I had previously posted about a relatively new Seagate drive that had worked
prior to 2.4.19, but in 2.4.19 failed to identify it's geometry properly.


Upon investigation of this with Seagate, it turns out that the firmware
version in question is for CE (consumer electronics) use. They have used
bit 10 of word 86 (0x56) of the IDENTIFY DEVICE information to indicate some
feature in their "AV streaming data transfer set". This breaks ATA-7, which
says this bit indicates that the drive understands LBA-48 commands.

The kernel sees this bit set, tries to use LBA-48 commands, and the drive
errors, complaining that it doesn't understand! Meaning this drive is
unusable with the >=2.4.19 kernels. I think at least one other person has
reported something very similar, IIRC with a very old Maxtor IDE drive.

Here is a patch that does some basic sanity checking. If the drive has an
lba_capacity_2==0, and has the bit set claiming to be LBA-48, it ignores
this claim.

I think this should go into the kernel, but I don't have any LBA-48 kit to
check that I'm not breaking things for other people. Hope this helps anyone
else scratching their heads with drives that used to work.

James Finnie

Standard disclaimer: it works for me, use at your own risk.


diff -Naur linux-2.4.19/drivers/ide/ide-disk.c
--- linux-2.4.19/drivers/ide/ide-disk.c Sat Aug 3 01:39:44 2002
+++ linux-2.4.19-lba48sanity/drivers/ide/ide-disk.c Thu Oct 17 09:51:10
@@ -924,6 +924,15 @@
        unsigned long long capacity_2 = capacity;
        unsigned long long set_max_ext;

+ // if the disk claims to be LBA-48, and yet has a capacity of 0,
+ // it's fairly safe to say that the firmware doesn't comply with
+ if ((id->cfs_enable_2 & 0x0400) && (id->lba_capacity_2==0)) {
+ printk ("%s: Broken firmware - this is NOT an LBA-48
+ printk ("%s: Disabling LBA-48 addressing for this
+ //reset bit 10 so that we can use the disk in a non LBA-48
+ id->cfs_enable_2 &= ~ 0x0400;
+ }
        drive->capacity48 = 0;
        drive->select.b.lba = 0;


Imerge Limited Tel :- +44 (0)1954 783600
Unit 6 Bar Hill Business Park Fax :- +44 (0)1954 783601
Saxon Way Web :- http://www.imerge.co.uk
Bar Hill
United Kingdom

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:33 EST