diff --git a/linux/dev/drivers/block/ahci.c b/linux/dev/drivers/block/ahci.c
index b8fd9dae..0fd8d795 100644
--- a/linux/dev/drivers/block/ahci.c
+++ b/linux/dev/drivers/block/ahci.c
@@ -645,7 +645,7 @@ static int ahci_identify(const volatile struct ahci_host 
*ahci_host, const volat
        add_timer(&identify_timer);
        while (!port->status) {
                if (jiffies >= timeout) {
-                       printk("sd%u: timeout waiting for ready\n", port-ports);
+                       printk("sd%u: timeout waiting for identify\n", 
port-ports);
                        port->ahci_host = NULL;
                        port->ahci_port = NULL;
                        del_timer(&identify_timer);
@@ -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 */

Reply via email to