All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@rainbow-software.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pata_isapnp: Don't use invalid I/O ports
Date: Sun, 22 Sep 2013 21:33:29 +0200	[thread overview]
Message-ID: <201309222133.29741.linux@rainbow-software.org> (raw)
In-Reply-To: <20130922164942.GA30946@htj.dyndns.org>



On Sunday 22 September 2013 18:49:42 Tejun Heo wrote:
> Hello, Ondrej.
>
> On Fri, Sep 13, 2013 at 11:44:27PM +0200, Ondrej Zary wrote:
> > This is caused by skipping ata_sff_softreset() when ap->ioaddr.ctl_addr
> > is unset so ata_devchk() is never called. This patch seems to fix the
> > problem. Is it OK or can it cause more problems?
> >
> > --- a/drivers/ata/libata-sff.c
> > +++ b/drivers/ata/libata-sff.c
> > @@ -2008,13 +2008,15 @@ static int ata_bus_softreset(struct ata_port *ap,
> > unsigned int devmask,
> >
> >  	DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
> >
> > -	/* software reset.  causes dev0 to be selected */
> > -	iowrite8(ap->ctl, ioaddr->ctl_addr);
> > -	udelay(20);	/* FIXME: flush */
> > -	iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
> > -	udelay(20);	/* FIXME: flush */
> > -	iowrite8(ap->ctl, ioaddr->ctl_addr);
> > -	ap->last_ctl = ap->ctl;
> > +	if (ap->ioaddr.ctl_addr) {
> > +		/* software reset.  causes dev0 to be selected */
> > +		iowrite8(ap->ctl, ioaddr->ctl_addr);
> > +		udelay(20);	/* FIXME: flush */
> > +		iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
> > +		udelay(20);	/* FIXME: flush */
> > +		iowrite8(ap->ctl, ioaddr->ctl_addr);
> > +		ap->last_ctl = ap->ctl;
> > +	}
> >
> >  	/* wait the port to become ready */
> >  	return ata_sff_wait_after_reset(&ap->link, devmask, deadline);
> > @@ -2215,10 +2217,6 @@ void ata_sff_error_handler(struct ata_port *ap)
> >
> >  	spin_unlock_irqrestore(ap->lock, flags);
> >
> > -	/* ignore ata_sff_softreset if ctl isn't accessible */
> > -	if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr)
> > -		softreset = NULL;
> > -
> >  	/* ignore built-in hardresets if SCR access is not available */
> >  	if ((hardreset == sata_std_hardreset ||
> >  	     hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link))
>
> Hmm... I'm unsure what to do with these patches.  It's a mostly dead
> driver, so I don't wanna mess with it too much unless it's an obvious
> fix.  What hardware are you playing with?

IMHO, the first patch (invalid I/O ports) is an obvious fix. That bug causes 
problems with ES968 sound cards.

The second patch is not-so-obvious. Only few ATA controllers don't have 
control register, but they're all broken now. I'm not sure if the patch is 
100% correct but it seems to work fine and it does not affect most 
controllers.

-- 
Ondrej Zary

  reply	other threads:[~2013-09-22 19:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 21:01 [PATCH] pata_isapnp: Don't use invalid I/O ports Ondrej Zary
2013-09-13 18:54 ` Ondrej Zary
2013-09-13 21:44   ` Ondrej Zary
2013-09-22 16:49     ` Tejun Heo
2013-09-22 19:33       ` Ondrej Zary [this message]
2013-09-22 21:42 ` Tejun Heo
2013-09-23 12:51   ` Sergei Shtylyov
2013-09-23 13:00     ` Tejun Heo
2013-09-23 17:12       ` Ondrej Zary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201309222133.29741.linux@rainbow-software.org \
    --to=linux@rainbow-software.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.