From: Jeff Garzik <jeff@garzik.org>
To: Stuart MENEFY <stuart.menefy@st.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH] libata: Keep shadow last_ctl up to date during resets
Date: Fri, 13 Mar 2009 14:58:01 -0400 [thread overview]
Message-ID: <49BAACB9.2090007@garzik.org> (raw)
In-Reply-To: <49B65125.7030201@st.com>
Stuart MENEFY wrote:
> libata keeps a shadow copy of the ATA CTL register (which is write only),
> and only writes to the hardware when the required value doesn't match
> the shadow. However this copy wasn't being maintained when performing
> reset functions. This could cause problems for the first operation after
> a reset when the correct value might not be written to the CTL register.
>
> This problem was observed when hotplugging a drive: the identify command
> was being issued with interrupts enabled, when they should have been
> disabled.
>
> Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
> ---
> linux-2.6/drivers/ata/libata-sff.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/drivers/ide/ide-dma-sff.c
> ===================================================================
> --- linux-2.6.orig/drivers/ata/libata-sff.c
> +++ linux-2.6/drivers/ata/libata-sff.c
> @@ -2066,6 +2066,7 @@ static int ata_bus_softreset(struct ata_
> 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);
> @@ -2190,8 +2191,10 @@ void ata_sff_postreset(struct ata_link *
> }
>
> /* set up device control */
> - if (ap->ioaddr.ctl_addr)
> + if (ap->ioaddr.ctl_addr) {
> iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
> + ap->last_ctl = ap->ctl;
> + }
> }
> EXPORT_SYMBOL_GPL(ata_sff_postreset);
>
> @@ -2534,6 +2537,7 @@ void ata_bus_reset(struct ata_port *ap)
> if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) {
> /* set up device control for ATA_FLAG_SATA_RESET */
> iowrite8(ap->ctl, ioaddr->ctl_addr);
> + ap->last_ctl = ap->ctl;
> }
applied, good catch!
prev parent reply other threads:[~2009-03-13 18:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 11:38 [PATCH] libata: Keep shadow last_ctl up to date during resets Stuart MENEFY
2009-03-11 7:42 ` Tejun Heo
2009-03-11 12:28 ` Mark Lord
2009-03-11 13:11 ` Tejun Heo
2009-03-13 18:58 ` Jeff Garzik [this message]
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=49BAACB9.2090007@garzik.org \
--to=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=stuart.menefy@st.com \
/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 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).