linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check
@ 2007-02-05  7:45 Tejun Heo
  2007-02-05 10:57 ` Alan
  0 siblings, 1 reply; 10+ messages in thread
From: Tejun Heo @ 2007-02-05  7:45 UTC (permalink / raw)
  To: Jeff Garzik, linux-ide, Alan Cox; +Cc: stable

The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
implemented.  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 <htejun@gmail.com>
---
Please consider for -stable.  This bug has been copied from ide and
it's just amazing how long this has gone unnoticed.  Will post
separate patch for ide.

 include/linux/ata.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: work/include/linux/ata.h
===================================================================
--- work.orig/include/linux/ata.h
+++ work/include/linux/ata.h
@@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const
 {
 	if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
 		return 0;	/* SATA */
-	if (dev_id[93] & 0x4000)
+	if (dev_id[93] & (1 << 13))
 		return 0;	/* 80 wire */
 	return 1;
 }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check
  2007-02-05  7:45 [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check Tejun Heo
@ 2007-02-05 10:57 ` Alan
  2007-02-05 12:41   ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 2 Tejun Heo
  0 siblings, 1 reply; 10+ messages in thread
From: Alan @ 2007-02-05 10:57 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, stable

On Mon, 5 Feb 2007 16:45:35 +0900
Tejun Heo <htejun@gmail.com> wrote:

> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
> implemented.  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.

NAK to the fix but not the report

We must check bits 15 and 14 to know if bit 13 is valid. The old code is
wrong (follows the old IDE bits) but your change is probably no better as
you remove the needed validity check.

	if ((dev_id[93] & 0xC000) == 0x4000) && (dev_id[93] & 0x2000))
		return 0;

Alan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 2
  2007-02-05 10:57 ` Alan
@ 2007-02-05 12:41   ` Tejun Heo
  2007-02-05 13:27     ` Alan
  0 siblings, 1 reply; 10+ messages in thread
From: Tejun Heo @ 2007-02-05 12:41 UTC (permalink / raw)
  To: Alan; +Cc: Jeff Garzik, linux-ide, stable

The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
implemented.  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 the test
and add word93 validity check.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Thanks for pointing out, fixed accordingly.

diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1df9416..ea2d597 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
 {
 	if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
 		return 0;	/* SATA */
-	if (dev_id[93] & 0x4000)
+	if ((dev_id[93] & 0xC000) == 0x4000 && (dev_id[93] & 0x2000))
 		return 0;	/* 80 wire */
 	return 1;
 }

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 2
  2007-02-05 12:41   ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 2 Tejun Heo
@ 2007-02-05 13:27     ` Alan
  2007-02-05 14:21       ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3 Tejun Heo
  0 siblings, 1 reply; 10+ messages in thread
From: Alan @ 2007-02-05 13:27 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, stable

On Mon, 5 Feb 2007 21:41:06 +0900
Tejun Heo <htejun@gmail.com> wrote:

> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
> implemented.  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 the test
> and add word93 validity check.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> Thanks for pointing out, fixed accordingly.

Acked-by: Alan Cox <alan@redhat.com>

> -	if (dev_id[93] & 0x4000)
> +	if ((dev_id[93] & 0xC000) == 0x4000 && (dev_id[93] & 0x2000))
>  		return 0;	/* 80 wire */
>  	return 1;

Can we do 

	if ((dev_id[93] & 0xE000) == 0x6000)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-02-05 13:27     ` Alan
@ 2007-02-05 14:21       ` Tejun Heo
  2007-02-05 14:36         ` Alan
                           ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tejun Heo @ 2007-02-05 14:21 UTC (permalink / raw)
  To: Alan; +Cc: Jeff Garzik, linux-ide, stable

The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
implemented.  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 the test
and add word93 validity check.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Sure, updated as suggested.

diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1df9416..939be94 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
 {
 	if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
 		return 0;	/* SATA */
-	if (dev_id[93] & 0x4000)
+	if ((dev_id[93] & 0xE000) == 0x6000)
 		return 0;	/* 80 wire */
 	return 1;
 }

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-02-05 14:21       ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3 Tejun Heo
@ 2007-02-05 14:36         ` Alan
  2007-02-15 23:08         ` Jeff Garzik
  2007-07-12 18:40         ` Sergei Shtylyov
  2 siblings, 0 replies; 10+ messages in thread
From: Alan @ 2007-02-05 14:36 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, stable

On Mon, 5 Feb 2007 23:21:19 +0900
Tejun Heo <htejun@gmail.com> wrote:

> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
> implemented.  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 the test
> and add word93 validity check.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> Sure, updated as suggested.

Acked-by: Alan Cox <alan@redhat.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-02-05 14:21       ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3 Tejun Heo
  2007-02-05 14:36         ` Alan
@ 2007-02-15 23:08         ` Jeff Garzik
  2007-07-12 18:40         ` Sergei Shtylyov
  2 siblings, 0 replies; 10+ messages in thread
From: Jeff Garzik @ 2007-02-15 23:08 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Alan, linux-ide, stable

Tejun Heo wrote:
> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
> implemented.  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 the test
> and add word93 validity check.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> Sure, updated as suggested.
> 
> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index 1df9416..939be94 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
>  {
>  	if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
>  		return 0;	/* SATA */
> -	if (dev_id[93] & 0x4000)
> +	if ((dev_id[93] & 0xE000) == 0x6000)
>  		return 0;	/* 80 wire */

applied



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-02-05 14:21       ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3 Tejun Heo
  2007-02-05 14:36         ` Alan
  2007-02-15 23:08         ` Jeff Garzik
@ 2007-07-12 18:40         ` Sergei Shtylyov
  2007-07-12 18:50           ` Sergei Shtylyov
  2 siblings, 1 reply; 10+ messages in thread
From: Sergei Shtylyov @ 2007-07-12 18:40 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Alan, Jeff Garzik, linux-ide, stable

Tejun Heo wrote:

> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
> implemented.  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 the test
> and add word93 validity check.

> Signed-off-by: Tejun Heo <htejun@gmail.com>

> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index 1df9416..939be94 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
>  {
>  	if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
>  		return 0;	/* SATA */
> -	if (dev_id[93] & 0x4000)
> +	if ((dev_id[93] & 0xE000) == 0x6000)
>  		return 0;	/* 80 wire */
>  	return 1;
>  }

    Wrong, wrong as well! The correct value to compare with would be 0x4000.

MBR, Sergei

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-07-12 18:40         ` Sergei Shtylyov
@ 2007-07-12 18:50           ` Sergei Shtylyov
  2007-07-13  4:12             ` Tejun Heo
  0 siblings, 1 reply; 10+ messages in thread
From: Sergei Shtylyov @ 2007-07-12 18:50 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Alan, Jeff Garzik, linux-ide, stable

Hello, I wrote:

>> The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
>> implemented.  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 the test
>> and add word93 validity check.

>> Signed-off-by: Tejun Heo <htejun@gmail.com>

>> diff --git a/include/linux/ata.h b/include/linux/ata.h
>> index 1df9416..939be94 100644
>> --- a/include/linux/ata.h
>> +++ b/include/linux/ata.h
>> @@ -347,7 +347,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
>>  {
>>      if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
>>          return 0;    /* SATA */
>> -    if (dev_id[93] & 0x4000)
>> +    if ((dev_id[93] & 0xE000) == 0x6000)
>>          return 0;    /* 80 wire */
>>      return 1;
>>  }

>    Wrong, wrong as well! The correct value to compare with would be 0x4000.

    Sorry for the false alarm -- those opposite senses on CBLID- have really 
confused me. :-<

MBR, Sergei

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3
  2007-07-12 18:50           ` Sergei Shtylyov
@ 2007-07-13  4:12             ` Tejun Heo
  0 siblings, 0 replies; 10+ messages in thread
From: Tejun Heo @ 2007-07-13  4:12 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Alan, Jeff Garzik, linux-ide, stable

Sergei Shtylyov wrote:
>>    Wrong, wrong as well! The correct value to compare with would be
>> 0x4000.
> 
>    Sorry for the false alarm -- those opposite senses on CBLID- have
> really confused me. :-<

Yeah, all those cable detection mess plays tricks on minds.  PATA is
really screwed up in that area.

-- 
tejun

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-07-13  4:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-05  7:45 [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check Tejun Heo
2007-02-05 10:57 ` Alan
2007-02-05 12:41   ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 2 Tejun Heo
2007-02-05 13:27     ` Alan
2007-02-05 14:21       ` [PATCH libata-dev#upstream-fixes] libata: fix drive side 80c cable check, take 3 Tejun Heo
2007-02-05 14:36         ` Alan
2007-02-15 23:08         ` Jeff Garzik
2007-07-12 18:40         ` Sergei Shtylyov
2007-07-12 18:50           ` Sergei Shtylyov
2007-07-13  4:12             ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).