From f10244db598fce618f403488c73bd3e0d8142237 Mon Sep 17 00:00:00 2001 From: Andrea Monaco Date: Sun, 12 Sep 2021 21:08:24 +0200 Subject: ahci: Do not even try AHCI identify when device is ATAPI * linux/dev/drivers/block/ahci.c (ahci_probe_port): Avoid trying AHCI identify when PxCMD.ATAPI is set. --- linux/dev/drivers/block/ahci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'linux') diff --git a/linux/dev/drivers/block/ahci.c b/linux/dev/drivers/block/ahci.c index 866618f1..751c7ca2 100644 --- a/linux/dev/drivers/block/ahci.c +++ b/linux/dev/drivers/block/ahci.c @@ -815,9 +815,10 @@ static void ahci_probe_port(const volatile struct ahci_host *ahci_host, const vo writel(readl(&ahci_port->cmd) | PORT_CMD_FIS_RX | PORT_CMD_START, &ahci_port->cmd); - if (ahci_identify(ahci_host, ahci_port, port, WIN_IDENTIFY) >= 2) - /* Try ATAPI */ - ahci_identify(ahci_host, ahci_port, port, WIN_PIDENTIFY); + /* if PxCMD.ATAPI is set, try ATAPI identify; otherwise try AHCI, then ATAPI */ + if (readl(&ahci_port->cmd) & PORT_CMD_ATAPI || + ahci_identify(ahci_host, ahci_port, port, WIN_IDENTIFY) >= 2) + ahci_identify(ahci_host, ahci_port, port, WIN_PIDENTIFY); } /* Probe one AHCI PCI device */ -- cgit v1.2.3