aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart MENEFY <stuart.menefy@st.com>2009-03-10 07:38:13 -0400
committerJeff Garzik <jgarzik@redhat.com>2009-03-13 14:55:58 -0400
commite3e4385f6181f434c0d786998ad1d0eef4e21c9b (patch)
treeb5195b312ca7acebe99d0125e60fcc4eebb7e458
parent9d51af7bd2f1d730cb6eeeb9ff837e3441ad4e07 (diff)
libata: Keep shadow last_ctl up to date during resets
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> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/libata-sff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 714cb046b594..f93dc029dfde 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -2066,6 +2066,7 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
2066 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); 2066 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
2067 udelay(20); /* FIXME: flush */ 2067 udelay(20); /* FIXME: flush */
2068 iowrite8(ap->ctl, ioaddr->ctl_addr); 2068 iowrite8(ap->ctl, ioaddr->ctl_addr);
2069 ap->last_ctl = ap->ctl;
2069 2070
2070 /* wait the port to become ready */ 2071 /* wait the port to become ready */
2071 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); 2072 return ata_sff_wait_after_reset(&ap->link, devmask, deadline);
@@ -2190,8 +2191,10 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
2190 } 2191 }
2191 2192
2192 /* set up device control */ 2193 /* set up device control */
2193 if (ap->ioaddr.ctl_addr) 2194 if (ap->ioaddr.ctl_addr) {
2194 iowrite8(ap->ctl, ap->ioaddr.ctl_addr); 2195 iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
2196 ap->last_ctl = ap->ctl;
2197 }
2195} 2198}
2196EXPORT_SYMBOL_GPL(ata_sff_postreset); 2199EXPORT_SYMBOL_GPL(ata_sff_postreset);
2197 2200
@@ -2534,6 +2537,7 @@ void ata_bus_reset(struct ata_port *ap)
2534 if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { 2537 if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) {
2535 /* set up device control for ATA_FLAG_SATA_RESET */ 2538 /* set up device control for ATA_FLAG_SATA_RESET */
2536 iowrite8(ap->ctl, ioaddr->ctl_addr); 2539 iowrite8(ap->ctl, ioaddr->ctl_addr);
2540 ap->last_ctl = ap->ctl;
2537 } 2541 }
2538 2542
2539 DPRINTK("EXIT\n"); 2543 DPRINTK("EXIT\n");