From owner-svn-src-stable@FreeBSD.ORG Wed Apr 24 19:24:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 61630766; Wed, 24 Apr 2013 19:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3AD98188D; Wed, 24 Apr 2013 19:24:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3OJOrc6091909; Wed, 24 Apr 2013 19:24:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3OJOrK9091908; Wed, 24 Apr 2013 19:24:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304241924.r3OJOrK9091908@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Apr 2013 19:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r249851 - stable/9/sys/dev/ahci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 19:24:54 -0000 Author: mav Date: Wed Apr 24 19:24:53 2013 New Revision: 249851 URL: http://svnweb.freebsd.org/changeset/base/249851 Log: MFC r248698: Depending on combination of running commands (NCQ/non-NCQ) try to avoid extra read from PxCI/PxSACT registers. If only NCQ commands are running, we don't really need PxCI. If only non-NCQ commands are running we don't need PxSACT. Mixed set may happen only on controllers with FIS-based switching when port multiplier is attached, and then we have to read both registers. Modified: stable/9/sys/dev/ahci/ahci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Wed Apr 24 19:22:19 2013 (r249850) +++ stable/9/sys/dev/ahci/ahci.c Wed Apr 24 19:24:53 2013 (r249851) @@ -1507,7 +1507,7 @@ ahci_ch_intr(void *data) { device_t dev = (device_t)data; struct ahci_channel *ch = device_get_softc(dev); - uint32_t istatus, sstatus, cstatus, serr = 0, sntf = 0, ok, err; + uint32_t istatus, cstatus, serr = 0, sntf = 0, ok, err; enum ahci_err_type et; int i, ccs, port, reset = 0; @@ -1517,8 +1517,13 @@ ahci_ch_intr(void *data) return; ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus); /* Read command statuses. */ - sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT); - cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); + if (ch->numtslots != 0) + cstatus = ATA_INL(ch->r_mem, AHCI_P_SACT); + else + cstatus = 0; + if (ch->numrslots != ch->numtslots) + cstatus |= ATA_INL(ch->r_mem, AHCI_P_CI); + /* Read SNTF in one of possible ways. */ if (istatus & AHCI_P_IX_SDB) { if (ch->caps & AHCI_CAP_SSNTF) sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF); @@ -1578,14 +1583,14 @@ ahci_ch_intr(void *data) } } } - err = ch->rslots & (cstatus | sstatus); + err = ch->rslots & cstatus; } else { ccs = 0; err = 0; port = -1; } /* Complete all successfull commands. */ - ok = ch->rslots & ~(cstatus | sstatus); + ok = ch->rslots & ~cstatus; for (i = 0; i < ch->numslots; i++) { if ((ok >> i) & 1) ahci_end_transaction(&ch->slot[i], AHCI_ERR_NONE);