Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Dec 2009 23:56:54 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200196 - head/sys/dev/ahci
Message-ID:  <200912062356.nB6NusBb035620@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Dec  6 23:56:54 2009
New Revision: 200196
URL: http://svn.freebsd.org/changeset/base/200196

Log:
  Add Asynchronous Notification support for controllers without SNTF
  capability by snooping SDB FIS receive area. It should be even faster
  then regular way, but less reliable.

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Sun Dec  6 23:51:27 2009	(r200195)
+++ head/sys/dev/ahci/ahci.c	Sun Dec  6 23:56:54 2009	(r200196)
@@ -1129,7 +1129,8 @@ ahci_notify_events(device_t dev, u_int32
 	struct cam_path *dpath;
 	int i;
 
-	ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status);
+	if (ch->caps & AHCI_CAP_SSNTF)
+		ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status);
 	if (bootverbose)
 		device_printf(dev, "SNTF 0x%04x\n", status);
 	for (i = 0; i < 16; i++) {
@@ -1188,8 +1189,16 @@ ahci_ch_intr(void *data)
 	/* Read command statuses. */
 	sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT);
 	cstatus = ATA_INL(ch->r_mem, AHCI_P_CI);
-	if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF))
-		sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF);
+	if (istatus & AHCI_P_IX_SDB) {
+		if (ch->caps & AHCI_CAP_SSNTF)
+			sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF);
+		else {
+			u_int8_t *fis = ch->dma.rfis + 0x58;
+
+			if (fis[1] & 0x80)
+				sntf = (1 << (fis[1] & 0x0f));
+		}
+	}
 	/* Process PHY events */
 	if (istatus & (AHCI_P_IX_PC | AHCI_P_IX_PRC | AHCI_P_IX_OF |
 	    AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912062356.nB6NusBb035620>