提交 3b61e512 编写于 作者: S Stefan Roese 提交者: Tejun Heo

ahci: Add check for device presence (PCIe hot unplug) in ahci_stop_engine()

Exit directly with ENODEV, if the AHCI controller is not available
anymore. Otherwise a delay of 500ms for each port is added to the remove
function while trying to issue a command on the non-existent controller.
Signed-off-by: NStefan Roese <sr@denx.de>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 0d3e45bc
...@@ -665,6 +665,16 @@ int ahci_stop_engine(struct ata_port *ap) ...@@ -665,6 +665,16 @@ int ahci_stop_engine(struct ata_port *ap)
if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0) if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0)
return 0; return 0;
/*
* Don't try to issue commands but return with ENODEV if the
* AHCI controller not available anymore (e.g. due to PCIe hot
* unplugging). Otherwise a 500ms delay for each port is added.
*/
if (tmp == 0xffffffff) {
dev_err(ap->host->dev, "AHCI controller unavailable!\n");
return -ENODEV;
}
/* setting HBA to idle */ /* setting HBA to idle */
tmp &= ~PORT_CMD_START; tmp &= ~PORT_CMD_START;
writel(tmp, port_mmio + PORT_CMD); writel(tmp, port_mmio + PORT_CMD);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册