summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Monaco <andrea.monaco@autistici.org>2021-09-12 21:08:24 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-09-12 21:08:24 +0200
commitf10244db598fce618f403488c73bd3e0d8142237 (patch)
tree64997217a6bd009464a1b0cd81b01bf6330114d1
parent2c2cadb29393691506510f755ef1d462eb811b22 (diff)
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.
-rw-r--r--linux/dev/drivers/block/ahci.c7
1 files changed, 4 insertions, 3 deletions
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 */