ahci: kill @force_restart and refine CLO for ahci_kick_engine()
This patch refines ahci_kick_engine() after discussion with Tejun about FBS(FIS-based switching) support preparation: a. Kill @force_restart and always kick the engine. The only case where @force_restart is zero is when it's called from ahci_p5wdh_hardreset() Actually at that point, BSY is pretty much guaranteed to be set. b. If PMP is attached, ignore busy and always do CLO. (AHCI-1.3 9.2) Signed-off-by: Shane Huang <shane.huang@amd.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
02cb009bb9
commit
78d5ae39af
@ -1634,7 +1634,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
|
|||||||
pp->cmd_slot[tag].tbl_addr_hi = cpu_to_le32((cmd_tbl_dma >> 16) >> 16);
|
pp->cmd_slot[tag].tbl_addr_hi = cpu_to_le32((cmd_tbl_dma >> 16) >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ahci_kick_engine(struct ata_port *ap, int force_restart)
|
static int ahci_kick_engine(struct ata_port *ap)
|
||||||
{
|
{
|
||||||
void __iomem *port_mmio = ahci_port_base(ap);
|
void __iomem *port_mmio = ahci_port_base(ap);
|
||||||
struct ahci_host_priv *hpriv = ap->host->private_data;
|
struct ahci_host_priv *hpriv = ap->host->private_data;
|
||||||
@ -1642,18 +1642,16 @@ static int ahci_kick_engine(struct ata_port *ap, int force_restart)
|
|||||||
u32 tmp;
|
u32 tmp;
|
||||||
int busy, rc;
|
int busy, rc;
|
||||||
|
|
||||||
/* do we need to kick the port? */
|
|
||||||
busy = status & (ATA_BUSY | ATA_DRQ);
|
|
||||||
if (!busy && !force_restart)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* stop engine */
|
/* stop engine */
|
||||||
rc = ahci_stop_engine(ap);
|
rc = ahci_stop_engine(ap);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_restart;
|
goto out_restart;
|
||||||
|
|
||||||
/* need to do CLO? */
|
/* need to do CLO?
|
||||||
if (!busy) {
|
* always do CLO if PMP is attached (AHCI-1.3 9.2)
|
||||||
|
*/
|
||||||
|
busy = status & (ATA_BUSY | ATA_DRQ);
|
||||||
|
if (!busy && !sata_pmp_attached(ap)) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_restart;
|
goto out_restart;
|
||||||
}
|
}
|
||||||
@ -1701,7 +1699,7 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
|
|||||||
tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1,
|
tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1,
|
||||||
1, timeout_msec);
|
1, timeout_msec);
|
||||||
if (tmp & 0x1) {
|
if (tmp & 0x1) {
|
||||||
ahci_kick_engine(ap, 1);
|
ahci_kick_engine(ap);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -1724,7 +1722,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
|
|||||||
DPRINTK("ENTER\n");
|
DPRINTK("ENTER\n");
|
||||||
|
|
||||||
/* prepare for SRST (AHCI-1.1 10.4.1) */
|
/* prepare for SRST (AHCI-1.1 10.4.1) */
|
||||||
rc = ahci_kick_engine(ap, 1);
|
rc = ahci_kick_engine(ap);
|
||||||
if (rc && rc != -EOPNOTSUPP)
|
if (rc && rc != -EOPNOTSUPP)
|
||||||
ata_link_printk(link, KERN_WARNING,
|
ata_link_printk(link, KERN_WARNING,
|
||||||
"failed to reset engine (errno=%d)\n", rc);
|
"failed to reset engine (errno=%d)\n", rc);
|
||||||
@ -1940,7 +1938,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
|
|||||||
rc = ata_wait_after_reset(link, jiffies + 2 * HZ,
|
rc = ata_wait_after_reset(link, jiffies + 2 * HZ,
|
||||||
ahci_check_ready);
|
ahci_check_ready);
|
||||||
if (rc)
|
if (rc)
|
||||||
ahci_kick_engine(ap, 0);
|
ahci_kick_engine(ap);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -2321,7 +2319,7 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
|
|||||||
|
|
||||||
/* make DMA engine forget about the failed command */
|
/* make DMA engine forget about the failed command */
|
||||||
if (qc->flags & ATA_QCFLAG_FAILED)
|
if (qc->flags & ATA_QCFLAG_FAILED)
|
||||||
ahci_kick_engine(ap, 1);
|
ahci_kick_engine(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ahci_pmp_attach(struct ata_port *ap)
|
static void ahci_pmp_attach(struct ata_port *ap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user