svn commit: r188918 - head/sys/dev/ata/chipsets

Alexander Motin mav at FreeBSD.org
Sun Feb 22 06:08:21 PST 2009


Author: mav
Date: Sun Feb 22 14:08:20 2009
New Revision: 188918
URL: http://svn.freebsd.org/changeset/base/188918

Log:
  Tune AHCI verbose messages to make log more readable.

Modified:
  head/sys/dev/ata/chipsets/ata-ahci.c

Modified: head/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-ahci.c	Sun Feb 22 13:38:16 2009	(r188917)
+++ head/sys/dev/ata/chipsets/ata-ahci.c	Sun Feb 22 14:08:20 2009	(r188918)
@@ -486,11 +486,13 @@ ata_ahci_issue_cmd(device_t dev, u_int16
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset,
 	     ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
 
-    if (bootverbose)
-	device_printf(dev, "ahci_issue_cmd time=%dms cnt=%dms status=%08x\n",
-		      timeout, count, status);
-    if (timeout && (count >= timeout))
+    if (timeout && (count >= timeout)) {
+	if (bootverbose) {
+	    device_printf(dev, "ahci_issue_cmd timeout: %d of %dms, status=%08x\n",
+		      count, timeout, status);
+	}
 	return EIO;
+    }
 
     return 0;
 }
@@ -635,7 +637,7 @@ ata_ahci_wait_ready(device_t dev, int t)
 	(ATA_S_BUSY | ATA_S_DRQ)) {
 	    DELAY(1000);
 	    if (timeout++ > t) {
-		device_printf(dev, "port is not ready\n");
+		device_printf(dev, "port is not ready (timeout %dms)\n", t);
 		return (-1);
 	    }
     } 
@@ -653,6 +655,9 @@ ata_ahci_softreset(device_t dev, int por
     struct ata_ahci_cmd_tab *ctp =
 	(struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET);
 
+    if (bootverbose)
+	device_printf(dev, "software reset port %d...\n", port);
+
     /* kick controller into sane state */
     ata_ahci_stop(dev);
     ata_ahci_clo(dev);
@@ -665,9 +670,10 @@ ata_ahci_softreset(device_t dev, int por
     //ctp->cfis[7] = ATA_D_LBA | ATA_D_IBM;
     ctp->cfis[15] = (ATA_A_4BIT | ATA_A_RESET);
 
-    if (ata_ahci_issue_cmd(dev, ATA_AHCI_CMD_RESET | ATA_AHCI_CMD_CLR_BUSY,100))
-	device_printf(dev, "setting SRST failed ??\n");
-	//return -1;
+    if (ata_ahci_issue_cmd(dev, ATA_AHCI_CMD_RESET | ATA_AHCI_CMD_CLR_BUSY,100)) {
+	device_printf(dev, "software reset set timeout\n");
+	return (-1);
+    }
 
     ata_udelay(50);
 
@@ -680,8 +686,10 @@ ata_ahci_softreset(device_t dev, int por
     if (ata_ahci_issue_cmd(dev, 0, 0))
 	return -1;
 
-    if (ata_ahci_wait_ready(dev, 1000))
+    if (ata_ahci_wait_ready(dev, 1000)) {
+	device_printf(dev, "software reset clear timeout\n");
 	return (-1);
+    }
 
     return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset);
 }
@@ -695,6 +703,9 @@ ata_ahci_reset(device_t dev)
     u_int32_t signature;
     int offset = ch->unit << 7;
 
+    if (bootverbose)
+        device_printf(dev, "AHCI reset...\n");
+
     /* Disable port interrupts */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, 0);
 
@@ -718,7 +729,7 @@ ata_ahci_reset(device_t dev)
 
     if (!ata_sata_phy_reset(dev)) {
 	if (bootverbose)
-	    device_printf(dev, "phy reset found no device\n");
+	    device_printf(dev, "AHCI reset done: phy reset found no device\n");
 	ch->devices = 0;
 
 	/* enable wanted port interrupts */
@@ -767,11 +778,11 @@ ata_ahci_reset(device_t dev)
 	break;
     default: /* SOS XXX */
 	if (bootverbose)
-	    device_printf(dev, "No signature, asuming disk device\n");
+	    device_printf(dev, "Unknown signature, asuming disk device\n");
 	ch->devices = ATA_ATA_MASTER;
     }
     if (bootverbose)
-        device_printf(dev, "ahci_reset devices=%08x\n", ch->devices);
+        device_printf(dev, "AHCI reset done: devices=%08x\n", ch->devices);
 }
 
 static void


More information about the svn-src-head mailing list