summaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorShane Huang <shane.huang@amd.com>2010-03-16 18:08:55 +0800
committerJeff Garzik <jgarzik@redhat.com>2010-03-17 15:54:55 -0400
commit5db5b0215af94a36d4bf10900ff9707b6d5c1610 (patch)
tree282907c4f5cc0b9193f2c863351f025f3bc1d1a1 /drivers/ata/ahci.c
parent9deb343189b3cf45e84dd08480f330575ffe2004 (diff)
ahci: pp->active_link is not reliable when FBS is enabled
pp->active_link is not reliable when FBS is enabled. Both PORT_SCR_ACT and PORT_CMD_ISSUE should be checked because mixed NCQ and non-NCQ commands may be in flight. Signed-off-by: Shane Huang <shane.huang@amd.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e7e2c7a147f..fdc9bcbe55a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -2278,7 +2278,7 @@ static void ahci_port_intr(struct ata_port *ap)
struct ahci_port_priv *pp = ap->private_data;
struct ahci_host_priv *hpriv = ap->host->private_data;
int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING);
- u32 status, qc_active;
+ u32 status, qc_active = 0;
int rc;
status = readl(port_mmio + PORT_IRQ_STAT);
@@ -2336,11 +2336,22 @@ static void ahci_port_intr(struct ata_port *ap)
}
}
- /* pp->active_link is valid iff any command is in flight */
- if (ap->qc_active && pp->active_link->sactive)
- qc_active = readl(port_mmio + PORT_SCR_ACT);
- else
- qc_active = readl(port_mmio + PORT_CMD_ISSUE);
+ /* pp->active_link is not reliable once FBS is enabled, both
+ * PORT_SCR_ACT and PORT_CMD_ISSUE should be checked because
+ * NCQ and non-NCQ commands may be in flight at the same time.
+ */
+ if (pp->fbs_enabled) {
+ if (ap->qc_active) {
+ qc_active = readl(port_mmio + PORT_SCR_ACT);
+ qc_active |= readl(port_mmio + PORT_CMD_ISSUE);
+ }
+ } else {
+ /* pp->active_link is valid iff any command is in flight */
+ if (ap->qc_active && pp->active_link->sactive)
+ qc_active = readl(port_mmio + PORT_SCR_ACT);
+ else
+ qc_active = readl(port_mmio + PORT_CMD_ISSUE);
+ }
rc = ata_qc_complete_multiple(ap, qc_active);