Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

AHCI: Fix softreset failed issue of Port Multiplier

Current code doesn't update port value of Port Multiplier(PM) when
sending FIS of softreset to device, command will fail if FBS is
enabled.

There are two ways to fix the issue: the first is to disable FBS
before sending softreset command to PM device and the second is
to update port value of PM when sending command.

For the first way, i can't find any related rule in AHCI Spec. The
second way can avoid disabling FBS and has better performance.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org

authored by

Xiangliang Yu and committed by
Tejun Heo
023113d2 4f1dd973

+9
+9
drivers/ata/libahci.c
··· 1273 1273 ata_tf_to_fis(tf, pmp, is_cmd, fis); 1274 1274 ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12)); 1275 1275 1276 + /* set port value for softreset of Port Multiplier */ 1277 + if (pp->fbs_enabled && pp->fbs_last_dev != pmp) { 1278 + tmp = readl(port_mmio + PORT_FBS); 1279 + tmp &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); 1280 + tmp |= pmp << PORT_FBS_DEV_OFFSET; 1281 + writel(tmp, port_mmio + PORT_FBS); 1282 + pp->fbs_last_dev = pmp; 1283 + } 1284 + 1276 1285 /* issue & wait */ 1277 1286 writel(1, port_mmio + PORT_CMD_ISSUE); 1278 1287