aic79xx.h:
authorPeter Avalos <pavalos@dragonflybsd.org>
Thu, 5 Jul 2007 02:47:43 +0000 (02:47 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Thu, 5 Jul 2007 02:47:43 +0000 (02:47 +0000)
Add softc flag to indicate that we have seen at
least one selection since the last bus reset or
SE/LVD bus change.

aic79xx.c:
Fix a few style nits.

In ahd_update_pending_scbs(), only touch card registers
once we have found an SCB that needs to be updated.
This removes lots of clutter from PCI traces taken of
error recovery performed by the driver.

Short circuit the first selection iocell workaround handler
if we've run once since the last bus reset or iocell change.
This also removes clutter from PCI traces.

Note if completions are pending in the qoutfifo when we dump
card state.

Obtained-from: FreeBSD

sys/dev/disk/aic7xxx/aic79xx.c
sys/dev/disk/aic7xxx/aic79xx.h

index 3b3a07a..1c7a3f3 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#200 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#201 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.c,v 1.22 2003/06/28 04:42:11 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.c,v 1.15 2007/07/04 23:52:04 pavalos Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.c,v 1.23 2003/06/28 04:45:25 gibbs Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.c,v 1.16 2007/07/05 02:47:43 pavalos Exp $
  */
 
 #include "aic79xx_osm.h"
@@ -2327,7 +2327,7 @@ ahd_dump_sglist(struct scb *scb)
                                len = ahd_le32toh(sg_list[i].len);
                                kprintf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
                                       i,
-                                      (len >> 24) & SG_HIGH_ADDR_BITS,
+                                      (len & AHD_SG_HIGH_ADDR_MASK) >> 24,
                                       ahd_le32toh(sg_list[i].addr),
                                       len & AHD_SG_LEN_MASK,
                                       len & AHD_DMA_LAST_SEG ? " Last" : "");
@@ -2913,7 +2913,7 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
 {
        struct          scb *pending_scb;
        int             pending_scb_count;
-       int             i;
+       u_int           scb_tag;
        int             paused;
        u_int           saved_scbptr;
        ahd_mode_state  saved_modes;
@@ -2971,17 +2971,14 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
        ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
        saved_scbptr = ahd_get_scbptr(ahd);
        /* Ensure that the hscbs down on the card match the new information */
-       for (i = 0; i < ahd->scb_data.maxhscbs; i++) {
+       for (scb_tag = 0; scb_tag < ahd->scb_data.maxhscbs; scb_tag++) {
                struct  hardware_scb *pending_hscb;
                u_int   control;
-               u_int   scb_tag;
 
-               ahd_set_scbptr(ahd, i);
-               scb_tag = i;
                pending_scb = ahd_lookup_scb(ahd, scb_tag);
                if (pending_scb == NULL)
                        continue;
-
+               ahd_set_scbptr(ahd, scb_tag);
                pending_hscb = pending_scb->hscb;
                control = ahd_inb_scbram(ahd, SCB_CONTROL);
                control &= ~MK_MESSAGE;
@@ -5396,6 +5393,7 @@ ahd_setup_iocell_workaround(struct ahd_softc *ahd)
                kprintf("%s: Setting up iocell workaround\n", ahd_name(ahd));
 #endif
        ahd_restore_modes(ahd, saved_modes);
+       ahd->flags &= ~AHD_HAD_FIRST_SEL;
 }
 
 static void
@@ -5404,6 +5402,8 @@ ahd_iocell_first_selection(struct ahd_softc *ahd)
        ahd_mode_state  saved_modes;
        u_int           sblkctl;
 
+       if ((ahd->flags & AHD_HAD_FIRST_SEL) != 0)
+               return;
        saved_modes = ahd_save_modes(ahd);
        ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
        sblkctl = ahd_inb(ahd, SBLKCTL);
@@ -5423,6 +5423,7 @@ ahd_iocell_first_selection(struct ahd_softc *ahd)
        ahd_outb(ahd, SIMODE0, ahd_inb(ahd, SIMODE0) & ~(ENSELDO|ENSELDI));
        ahd_outb(ahd, CLRINT, CLRSCSIINT);
        ahd_restore_modes(ahd, saved_modes);
+       ahd->flags |= AHD_HAD_FIRST_SEL;
 }
 
 /*************************** SCB Management ***********************************/
@@ -8453,6 +8454,10 @@ ahd_dump_card_state(struct ahd_softc *ahd)
                                    ahd->saved_dst_mode));
        if (paused)
                kprintf("Card was paused\n");
+
+       if (ahd_check_cmdcmpltqueues(ahd))
+               kprintf("Completions are pending\n");
+
        /*
         * Mode independent registers.
         */
index e814ac8..f72659e 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#93 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#94 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.h,v 1.14 2003/06/28 04:39:49 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.h,v 1.3 2007/07/04 22:56:30 pavalos Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.h,v 1.15 2003/06/28 04:45:25 gibbs Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.h,v 1.4 2007/07/05 02:47:43 pavalos Exp $
  */
 
 #ifndef _AIC79XX_H_
@@ -374,7 +374,8 @@ typedef enum {
        AHD_HP_BOARD          = 0x100000,
        AHD_RESET_POLL_ACTIVE = 0x200000,
        AHD_UPDATE_PEND_CMDS  = 0x400000,
-       AHD_RUNNING_QOUTFIFO  = 0x800000
+       AHD_RUNNING_QOUTFIFO  = 0x800000,
+       AHD_HAD_FIRST_SEL     = 0x1000000
 } ahd_flag;
 
 /************************* Hardware  SCB Definition ***************************/