Patchwork [4/5] pata: Update experimental tags

login
register
mail settings
Submitter Bartlomiej Zolnierkiewicz
Date Nov. 19, 2009, 5:38 p.m.
Message ID <200911191838.11791.bzolnier@gmail.com>
Download mbox | patch
Permalink /patch/38860/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Bartlomiej Zolnierkiewicz - Nov. 19, 2009, 5:38 p.m.
On Thursday 19 November 2009 17:27:38 Alan Cox wrote:
> > > > already have a buggy cable detection (since ->pre_reset ignores the mandatory
> > > 
> > > Wrong.
> > 
> > You cannot know it unless you know how chip operates internally.  That's it.
> 
> Read the code. How the chip operates is irrelevant.

lol, there is a genuine cable detection bug in pata_hpt3x2n on closer look...

Jeff, please apply the patch below.


From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_hpt3x2n: fix cable detection

The detection was reversed between primary and secondary ports.

Fix it to match hpt366 and the vendor driver.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ata/pata_hpt3x2n.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Cox - Nov. 19, 2009, 5:50 p.m.
On Thu, 19 Nov 2009 18:38:11 +0100
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:

> On Thursday 19 November 2009 17:27:38 Alan Cox wrote:
> > > > > already have a buggy cable detection (since ->pre_reset ignores the mandatory
> > > > 
> > > > Wrong.
> > > 
> > > You cannot know it unless you know how chip operates internally.  That's it.
> > 
> > Read the code. How the chip operates is irrelevant.
> 
> lol, there is a genuine cable detection bug in pata_hpt3x2n on closer look...

Oh you found it now I told you which one was buggy - well done. Already
patched along with adding suspend/resume and fixing a performance funny.
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartlomiej Zolnierkiewicz - Nov. 19, 2009, 5:52 p.m.
On Thursday 19 November 2009 18:50:51 Alan Cox wrote:
> On Thu, 19 Nov 2009 18:38:11 +0100
> Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:
> 
> > On Thursday 19 November 2009 17:27:38 Alan Cox wrote:
> > > > > > already have a buggy cable detection (since ->pre_reset ignores the mandatory
> > > > > 
> > > > > Wrong.
> > > > 
> > > > You cannot know it unless you know how chip operates internally.  That's it.
> > > 
> > > Read the code. How the chip operates is irrelevant.
> > 
> > lol, there is a genuine cable detection bug in pata_hpt3x2n on closer look...
> 
> Oh you found it now I told you which one was buggy - well done. Already
> patched along with adding suspend/resume and fixing a performance funny.

LOL

Fixed where?  I posted the patch as soon as I noticed the problem.

Told me about it?  Now this is extra funny since the bug been there for like
three years and still would be unfixed if it wasn't for this discussion.

The best part is that the bug would never have happened in the first place
if you weren't artificially splitting HPT37x and HPT3xxN support cause cable
detection for all those chipsets (except HPT374 fn 1) is identical!! :)
Jeff Garzik - Nov. 19, 2009, 9:48 p.m.
On 11/19/2009 12:38 PM, Bartlomiej Zolnierkiewicz wrote:
>
> Index: b/drivers/ata/pata_hpt3x2n.c
> ===================================================================
> --- a/drivers/ata/pata_hpt3x2n.c
> +++ b/drivers/ata/pata_hpt3x2n.c
> @@ -133,7 +133,7 @@ static int hpt3x2n_cable_detect(struct a
>   	/* Restore state */
>   	pci_write_config_byte(pdev, 0x5B, scr2);
>
> -	if (ata66&  (1<<  ap->port_no))
> +	if (ata66&  (2>>  ap->port_no))
>   		return ATA_CBL_PATA40;
>   	else
>   		return ATA_CBL_PATA80;


Applied.

Note to Alan -- even if cable detect wants more changes, this is a nice, 
self-contained fix easily backported to stable@, etc.  So I preferred 
the above form of change.

Please do send any updates you guys (Bart | Alan) have on top of 
libata-dev.git#upstream.

Thanks,

	Jeff



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

Patch

Index: b/drivers/ata/pata_hpt3x2n.c
===================================================================
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -133,7 +133,7 @@  static int hpt3x2n_cable_detect(struct a
 	/* Restore state */
 	pci_write_config_byte(pdev, 0x5B, scr2);
 
-	if (ata66 & (1 << ap->port_no))
+	if (ata66 & (2 >> ap->port_no))
 		return ATA_CBL_PATA40;
 	else
 		return ATA_CBL_PATA80;