From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 21:22:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0878A1065672; Sun, 6 Sep 2009 21:22:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBDB88FC16; Sun, 6 Sep 2009 21:22:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86LMO4x094810; Sun, 6 Sep 2009 21:22:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86LMOvK094808; Sun, 6 Sep 2009 21:22:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909062122.n86LMOvK094808@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 21:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196907 - head/sys/dev/ahci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 21:22:25 -0000 Author: mav Date: Sun Sep 6 21:22:24 2009 New Revision: 196907 URL: http://svn.freebsd.org/changeset/base/196907 Log: To save small bit of CPU time, hide part of SNTF register read latency behind other reads. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Sep 6 20:32:16 2009 (r196906) +++ head/sys/dev/ahci/ahci.c Sun Sep 6 21:22:24 2009 (r196907) @@ -891,16 +891,12 @@ ahci_phy_check_events(device_t dev) } static void -ahci_notify_events(device_t dev) +ahci_notify_events(device_t dev, u_int32_t status) { struct ahci_channel *ch = device_get_softc(dev); struct cam_path *dpath; - u_int32_t status; int i; - status = ATA_INL(ch->r_mem, AHCI_P_SNTF); - if (status == 0) - return; ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); if (bootverbose) device_printf(dev, "SNTF 0x%04x\n", status); @@ -948,7 +944,7 @@ ahci_ch_intr(void *data) { device_t dev = (device_t)data; struct ahci_channel *ch = device_get_softc(dev); - uint32_t istatus, cstatus, sstatus, ok, err; + uint32_t istatus, sstatus, cstatus, sntf = 0, ok, err; enum ahci_err_type et; int i, ccs, ncq_err = 0; @@ -958,8 +954,10 @@ ahci_ch_intr(void *data) return; ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus); /* Read command statuses. */ - cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); 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); /* Process PHY events */ if (istatus & (AHCI_P_IX_PRC | AHCI_P_IX_PC)) ahci_phy_check_events(dev); @@ -1023,8 +1021,8 @@ ahci_ch_intr(void *data) ahci_issue_read_log(dev); } /* Process NOTIFY events */ - if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) - ahci_notify_events(dev); + if (sntf) + ahci_notify_events(dev, sntf); } /* Must be called with channel locked. */