Author: mav
Date: Tue Nov 17 14:47:40 2009
New Revision: 199384
URL: http://svn.freebsd.org/changeset/base/199384

Log:
  MFC r196907:
  To save small bit of CPU time, hide part of SNTF register read latency
  behind other reads.

Modified:
  stable/8/sys/dev/ahci/ahci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ahci/ahci.c
==============================================================================
--- stable/8/sys/dev/ahci/ahci.c        Tue Nov 17 14:38:47 2009        
(r199383)
+++ stable/8/sys/dev/ahci/ahci.c        Tue Nov 17 14:47:40 2009        
(r199384)
@@ -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. */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to