bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Recognize DVD drive during boot


From: Andrea Monaco
Subject: [PATCH] Recognize DVD drive during boot
Date: Sun, 12 Sep 2021 19:36:22 +0200

During boot I had this error message
 
  sd0: TOSHIBA MQ01ABF050, 465GB w/8192kB Cache
  sd1: timeout waiting for ready
  sd1: timeout waiting for ready


so the SATA DVD drive was not identified. I saw that ahci.c tries a SATA
identify first, and then an ATAPI one if the first fails.
But I also discovered that after a first failed identify my drive won't
respond to a second one, even if it would accept it as first.

There's a PxCMD bit that shoud be set in ATAPI drives. Here's the
patch. Now at boot I get

  sd0: TOSHIBA MQ01ABF050, 465GB w/8192kB Cache
  sd1: Slimtype DVD A DA8AESH, ATAPI unsupported CDROM drive


The drive still doesn't work, but it's a step forward...
I also changed an error message to make it different from another one in
the same function.




diff --git a/linux/dev/drivers/block/ahci.c b/linux/dev/drivers/block/ahci.c
index b8fd9dae..dc471367 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,12 @@ 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 first */
+       if (readl(&ahci_port->cmd) & PORT_CMD_ATAPI)
+               ahci_identify(ahci_host, ahci_port, port, WIN_PIDENTIFY);
+       else if (ahci_identify(ahci_host, ahci_port, port, WIN_IDENTIFY) >= 2)
+               /* Try ATAPI anyway as last resort */
+               ahci_identify(ahci_host, ahci_port, port, WIN_PIDENTIFY);
 }
 
 /* Probe one AHCI PCI device */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]