ide: fix drive side 80c cable check
PATCH 1/1 ide: fix drive side 80c cable check
The 80c wire bit is bit 13, not 14. This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.
---
Please consider for -stable.
drivers/ide/ide-iops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ide/ide-iops.c +1 -1
@@ -604,7 +604,7 @@ u8 eighty_ninty_three (ide_drive_t *drivif (!(drive->id->hw_config &0x6000 ))return 0 ;#ifndef CONFIG_IDEDMA_IVB -if (!(drive->id->hw_config &0x4000 )) +if (!(drive->id->hw_config &0x2000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ return 1 ;
Alan
NAKQuoted 17 lines · On Mon, 5 Feb 2007 16:47:13 +0900 Tejun Heo <[email protected]> wrote:
The 80c wire bit is bit 13, not 14. This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.
Signed-off-by Tejun Heo <[email protected]>---
Please consider for -stable.drivers/ide/ide-iops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
work/drivers/ide/ide-iops.c
===================================================================
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *driv · line 609
Quoted 7 lines
drivers/ide/ide-iops.c +1
-1@@ -604,7 +604,7 @@ u8 eighty_ninty_three (ide_drive_t *drivif (!(drive->id->hw_config &0x6000 ))return 0 ;#ifndef CONFIG_IDEDMA_IVB -if (!(drive->id->hw_config &0x4000 )) +if (!(drive->id->hw_config &0x2000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */
NAK
While the old code is a mess, your changes don't fix it. The code above is correct before you touch it as far as I can tell. Incomplete but correct as far as it went.
The logic in the function as far as it goes is correct
If neither valid bit nor 80pin bit set -> 40pin [00]
If checking valid bit && valid bit clear -> 40pin [0x]
The 0x2000 test is needed as an additional test (as per theide_ata66_check function directly below) [10] v [11]
Without this an id value of 0x2000 will trigger 80pin but is not valid.
(the IDEDMA_IVB check is more relaxted to handle some confused ATA4 drives, and is probably something we don't want in libata anyway, or should blacklist the afflicted for this)
Alan
PATCH 1/1 ide: fix drive side 80c cable check, take 2
eighty_ninty_three() had word 93 validitity check but not the 80c bit test itself (bit 12). This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.
---
Ah... thanks. That explains the code much better. Fixed accordingly.
drivers/ide/ide-iops.c +2 -0
@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)if (!(drive->id->hw_config &0x4000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ +if (!(drive->id->hw_config &0x2000 )) +return 0 ;return 1 ; }
Re: [PATCH] ide: fix drive side 80c cable check, take 2
Quoted 15 lines · On Mon, 5 Feb 2007 21:47:13 +0900 Tejun Heo <[email protected]> wrote:
eighty_ninty_three()had word 93 validitity check but not the 80c bit test itself (bit 12). This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.Signed-off-by Tejun Heo <[email protected]>---
Ah... thanks. That explains the code much better. Fixed accordingly.drivers/ide/ide-iops.c +0
-0
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 612
Quoted 6 lines
drivers/ide/ide-iops.c +2
-0@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)if (!(drive->id->hw_config &0x4000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ +if (!(drive->id->hw_config &0x2000 )) +return 0 ;return 1 ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH] ide: fix drive side 80c cable check, take 2
Quoted 13 lines · Alan
Quoted 10 lines · On Mon, 5 Feb 2007 21:47:13 +0900 Tejun Heo <[email protected]> wrote:
eighty_ninty_three()had word 93 validitity check but not the 80c bit test itself (bit 12). This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.Signed-off-by Tejun Heo <[email protected]>---
Ah... thanks. That explains the code much better. Fixed accordingly.
Quoted 13 lines
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 612
Quoted 11 lines
drivers/ide/ide-iops.c +2
-0@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)if (!(drive->id->hw_config &0x4000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ +if (!(drive->id->hw_config &0x2000 )) +return 0 ;return 1 ;Acked-by Alan Cox <[email protected]>
applied
Re: [PATCH] ide: fix drive side 80c cable check, take 2
In reply to Tejun HeoHello.
Quoted 13 lines · Tejun Heo
eighty_ninty_three()had word 93 validitity check but not the 80c bit test itself (bit 12). This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.Signed-off-by Tejun Heo <[email protected]>drivers/ide/ide-iops.c +0
-0
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 611
Quoted 5 lines
drivers/ide/ide-iops.c +2
-0@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)if (!(drive->id->hw_config &0x4000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ +if (!(drive->id->hw_config &0x2000 )) +return 0 ;
Haha, you know just *why* this was wrong? Bit 13 of the word 93 when *set*
means 40c cable, not 80c! Look at the table 9 in ATA/PI-6, for example, and then into the bit description in the table 27.
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 613
Quoted 2 lines
drivers/ide/ide-iops.c +0
-0return 1 ; }
MBR, Sergei
Re: [PATCH] ide: fix drive side 80c cable check, take 2
Quoted 8 lines · Hello, I wrote:
Quoted 7 lines
eighty_ninty_three()had word 93 validitity check but not the 80c bit test itself (bit 12). This increases the chance of incorrect wire detection especially because host side cable detection is often unreliable and we sometimes soley depend on drive side cable detection. Fix it.Signed-off-by Tejun Heo <[email protected]>
Quoted 13 lines
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 611
Quoted 10 lines
drivers/ide/ide-iops.c +2
-0@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)if (!(drive->id->hw_config &0x4000 ))return 0 ;#endif /* CONFIG_IDEDMA_IVB */ +if (!(drive->id->hw_config &0x2000 )) +return 0 ;Haha, you know just *why* this was wrong? Bit 13 of the word 93 when
*set* means 40c cable, not 80c! Look at the table 9 in ATA/PI-6, for example, and then into the bit description in the table 27.
Oops, that's a host side detection, the device side CBLID- seems to have
the opposite levels. Should have really be looking at the table 8. :-<
Quoted 2 lines
drivers/ide/ide-iops.c u8 eighty_ninty_three (ide_drive_t *drive) · line 613
Quoted 2 lines
drivers/ide/ide-iops.c +0
-0return 1 ; }
Actually, trying to find out why 'hdparm -i' clips the modes to udma2
sometimes...
MBR, Sergei