Index: oldkernel/linux/drivers/scsi/aic7xxx.c
diff -u linux/drivers/scsi/aic7xxx.c:1.5 linux/drivers/scsi/aic7xxx.c:1.6
--- linux/drivers/scsi/aic7xxx.c:1.5	Thu Jun  1 15:16:51 2000
+++ linux/drivers/scsi/aic7xxx.c	Thu Jun  1 15:46:48 2000
@@ -270,7 +270,7 @@
     0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 
-#define AIC7XXX_C_VERSION  "5.1.25"
+#define AIC7XXX_C_VERSION  "5.1.26"
 
 #define NUMBER(arr)     (sizeof(arr) / sizeof(arr[0]))
 #define MIN(a,b)        (((a) < (b)) ? (a) : (b))
@@ -519,6 +519,7 @@
   "Adaptec AHA-394X Ultra SCSI host adapter",           /* AIC_7882 */
   "Adaptec AHA-398X Ultra SCSI host adapter",           /* AIC_7883 */
   "Adaptec AHA-2944 Ultra SCSI host adapter",           /* AIC_7884 */
+  "Adaptec AHA-2940UW Pro Ultra SCSI host adapter",     /* AIC_7887 */
   "Adaptec AIC-7895 Ultra SCSI host adapter",           /* AIC_7895 */
   "Adaptec AIC-7890/1 Ultra2 SCSI host adapter",        /* AIC_7890 */
   "Adaptec AHA-293X Ultra2 SCSI host adapter",          /* AIC_7890 */
@@ -833,7 +834,8 @@
   *  and what flags weren't.  This way, I could clean up the flag usage on
   *  a use by use basis.  Doug Ledford
   */
-        AHC_NO_STPWR              = 0x00040000,
+        AHC_MOTHERBOARD           = 0x00020000,
+        AHC_NO_STPWEN             = 0x00040000,
         AHC_RESET_DELAY           = 0x00080000,
         AHC_A_SCANNED             = 0x00100000,
         AHC_B_SCANNED             = 0x00200000,
@@ -1440,15 +1442,6 @@
  ***************************************************************************/
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
-static inline void
-mdelay(int milliseconds)
-{
-  int i;
-
-  for(i=0; i<milliseconds; i++)
-    udelay(1000);
-}
-
 static inline int
 time_after_eq(unsigned long a, unsigned long b)
 {
@@ -1888,7 +1881,7 @@
       hcntrl = aic_inb(p, HCNTRL);
       aic_outb(p, ((instr.integer >> 24) & 0xff), SEQRAM);
       hcntrl = aic_inb(p, HCNTRL);
-      udelay(50);
+      udelay(10);
       break;
 
     default:
@@ -5342,7 +5335,7 @@
         resid_dcnt = aic_inb(p, SCB_RESID_DCNT) |
           (aic_inb(p, SCB_RESID_DCNT + 1) << 8) |
           (aic_inb(p, SCB_RESID_DCNT + 2) << 24);
-        index = scb->sg_count - resid_sgcnt;
+        index = scb->sg_count - (resid_sgcnt + 1);
         native_addr = le32_to_cpu(scb->sg_list[index].address);
         native_length = le32_to_cpu(scb->sg_list[index].length);
         /*
@@ -6361,6 +6354,10 @@
       cmd->result = (DID_TIME_OUT << 16);
 
       /*
+       * Clear the data bits on the SCSI bus
+       */
+      aic_outb(p, aic_inb(p, SCSIID) & 0x0f, SCSIID);
+      /*
        * Clear out this hardware SCB
        */
       aic_outb(p, 0, SCB_CONTROL);
@@ -6411,15 +6408,36 @@
       }
     }
     /*
-     * Restarting the sequencer will stop the selection and make sure devices
-     * are allowed to reselect in.
+     * Keep the sequencer from trying to restart any selections
      */
     aic_outb(p, 0, SCSISEQ);
+    /*
+     * Make sure the data bits on the bus are released
+     */
+    if(p->features & AHC_WIDE)
+      aic_outb(p, 0, SCSIBUSH);
+    aic_outb(p, 0, SCSIBUSL);
+    aic_outb(p, aic_inb(p, SCSIID) & 0x0f, SCSIID);
+    /*
+     * Fake PCI read to flush any posted writes prior to our delay loop
+     */
+    aic_inb(p, HCNTRL);
+    /*
+     * Delay for the selection timeout delay period then stop the selection
+     */
+    udelay(301);
     aic_outb(p, CLRSELINGO, CLRSINT0);
+    /*
+     * Clear out all the interrupt status bits
+     */
     aic_outb(p, aic_inb(p, SIMODE1) & ~(ENREQINIT|ENBUSFREE), SIMODE1);
     p->flags &= ~AHC_HANDLING_REQINITS;
     aic_outb(p, CLRSELTIMEO | CLRBUSFREE, CLRSINT1);
     aic_outb(p, CLRSCSIINT, CLRINT);
+    /*
+     * Restarting the sequencer will stop the selection and make sure devices
+     * are allowed to reselect in.
+     */
     restart_sequencer(p);
     unpause_sequencer(p, TRUE);
   }
@@ -7447,7 +7465,6 @@
    */
   CLOCK_PULSE(p);
   aic_outb(p, 0, SEECTL);
-  CLOCK_PULSE(p);
 }
 
 /*+F*************************************************************************
@@ -7723,8 +7740,6 @@
   }
 }
 
-#undef CLOCK_PULSE
-
 /*+F*************************************************************************
  * Function:
  *   aic785x_cable_detect
@@ -7739,18 +7754,66 @@
   unsigned char brdctl;
 
   aic_outb(p, BRDRW | BRDCS, BRDCTL);
-  udelay(1);
+  CLOCK_PULSE(p);
   aic_outb(p, 0, BRDCTL);
-  udelay(1);
+  CLOCK_PULSE(p);
   brdctl = aic_inb(p, BRDCTL);
-  udelay(1);
+  CLOCK_PULSE(p);
   *int_50 = !(brdctl & BRDDAT5);
   *ext_present = !(brdctl & BRDDAT6);
   *eeprom = (aic_inb(p, SPIOCAP) & EEPROM);
 }
 
+#undef CLOCK_PULSE
+
 /*+F*************************************************************************
  * Function:
+ *   aic2940_uwpro_cable_detect
+ *
+ * Description:
+ *   Detect the cables that are present on the 2940-UWPro cards
+ *
+ * NOTE: This functions assumes the SEEPROM will have already been aquired
+ *       prior to invocation of this function.
+ *-F*************************************************************************/
+static void
+aic2940_uwpro_wide_cable_detect(struct aic7xxx_host *p, int *int_68,
+    int *ext_68, int *eeprom)
+{
+  unsigned char brdctl;
+
+  /*
+   * First read the status of our cables.  Set the rom bank to
+   * 0 since the bank setting serves as a multiplexor for the
+   * cable detection logic.  BRDDAT5 controls the bank switch.
+   */
+  write_brdctl(p, 0);
+
+  /*
+   * Now we read the state of the internal 68 connector.  BRDDAT6
+   * is don't care, BRDDAT7 is internal 68.  The cable is
+   * present if the bit is 0
+   */
+  brdctl = read_brdctl(p);
+  *int_68 = !(brdctl & BRDDAT7);
+
+  /*
+   * Set the bank bit in brdctl and then read the external cable state
+   * and the EEPROM status
+   */
+  write_brdctl(p, BRDDAT5);
+  brdctl = read_brdctl(p);
+
+  *ext_68 = !(brdctl & BRDDAT6);
+  *eeprom = !(brdctl & BRDDAT7);
+
+  /*
+   * We're done, the calling function will release the SEEPROM for us
+   */
+}
+
+/*+F*************************************************************************
+ * Function:
  *   aic787x_cable_detect
  *
  * Description:
@@ -7853,59 +7916,182 @@
       max_target = 8;
     aic_outb(p, SEEMS | SEECS, SEECTL);
     sxfrctl1 &= ~STPWEN;
-    if ( (p->adapter_control & CFAUTOTERM) ||
-         (p->features & AHC_NEW_AUTOTERM) )
+    /*
+     * The termination/cable detection logic is split into three distinct
+     * groups.  Ultra2 and later controllers, 2940UW-Pro controllers, and
+     * older 7850, 7860, 7870, 7880, and 7895 controllers.  Each has its
+     * own unique way of detecting their cables and writing the results
+     * back to the card.
+     */
+    if (p->features & AHC_ULTRA2)
     {
-      if ( (p->adapter_control & CFAUTOTERM) &&
-          !(p->features & AHC_NEW_AUTOTERM) )
+      /*
+       * As long as user hasn't overridden term settings, always check the
+       * cable detection logic
+       */
+      if (aic7xxx_override_term == -1)
       {
-        printk(KERN_INFO "(scsi%d) Warning - detected auto-termination\n",
-               p->host_no);
-        printk(KERN_INFO "(scsi%d) Please verify driver detected settings are "
-          "correct.\n", p->host_no);
-        printk(KERN_INFO "(scsi%d) If not, then please properly set the device "
-          "termination\n", p->host_no);
-        printk(KERN_INFO "(scsi%d) in the Adaptec SCSI BIOS by hitting CTRL-A "
-          "when prompted\n", p->host_no);
-        printk(KERN_INFO "(scsi%d) during machine bootup.\n", p->host_no);
+        aic7xxx_ultra2_term_detect(p, &enableSE_low, &enableSE_high,
+                                   &enableLVD_low, &enableLVD_high,
+                                   &eprom_present);
+      }
+      
+      /*
+       * If the user is overriding settings, then they have been preserved
+       * to here as fake adapter_control entries.  Parse them and allow
+       * them to override the detected settings (if we even did detection).
+       */
+      if (!(p->adapter_control & CFSEAUTOTERM))
+      {
+        enableSE_low = (p->adapter_control & CFSTERM);
+        enableSE_high = (p->adapter_control & CFWSTERM);
+      }
+      if (!(p->adapter_control & CFAUTOTERM))
+      {
+        enableLVD_low = enableLVD_high = (p->adapter_control & CFLVDSTERM);
       }
-      /* Configure auto termination. */
 
-      if (p->features & AHC_NEW_AUTOTERM)
+      /*
+       * Now take those settings that we have and translate them into the
+       * values that must be written into the registers.
+       *
+       * Flash Enable = BRDDAT7
+       * Secondary High Term Enable = BRDDAT6
+       * Secondary Low Term Enable = BRDDAT5
+       * LVD/Primary High Term Enable = BRDDAT4
+       * LVD/Primary Low Term Enable = STPWEN bit in SXFRCTL1
+       */
+      if (enableLVD_low != 0)
       {
-        if (aic7xxx_override_term == -1)
-          aic7xxx_ultra2_term_detect(p, &enableSE_low, &enableSE_high,
-                                     &enableLVD_low, &enableLVD_high,
-                                     &eprom_present);
-        if (!(p->adapter_control & CFSEAUTOTERM))
-        {
-          enableSE_low = (p->adapter_control & CFSTERM);
-          enableSE_high = (p->adapter_control & CFWSTERM);
+        sxfrctl1 |= STPWEN;
+        p->flags |= AHC_TERM_ENB_LVD;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) LVD/Primary Low byte termination "
+                 "Enabled\n", p->host_no);
+      }
+          
+      if (enableLVD_high != 0)
+      {
+        brddat |= BRDDAT4;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) LVD/Primary High byte termination "
+                 "Enabled\n", p->host_no);
+      }
+
+      if (enableSE_low != 0)
+      {
+        brddat |= BRDDAT5;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) Secondary Low byte termination "
+                 "Enabled\n", p->host_no);
+      }
+
+      if (enableSE_high != 0)
+      {
+        brddat |= BRDDAT6;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) Secondary High byte termination "
+                 "Enabled\n", p->host_no);
+      }
+    }
+    else if (p->features & AHC_NEW_AUTOTERM)
+    {
+      /*
+       * The 50 pin connector termination is controlled by STPWEN in the
+       * SXFRCTL1 register.  Since the Adaptec docs typically say the
+       * controller is not allowed to be in the middle of a cable and
+       * this is the only connection on that stub of the bus, there is
+       * no need to even check for narrow termination, it's simply
+       * always on.
+       */
+      sxfrctl1 |= STPWEN;
+      if (aic7xxx_verbose & VERBOSE_PROBE2)
+        printk(KERN_INFO "(scsi%d) Narrow channel termination Enabled\n",
+               p->host_no);
+
+      if (p->adapter_control & CFAUTOTERM)
+      {
+        aic2940_uwpro_wide_cable_detect(p, &internal68_present,
+                                        &external_present,
+                                        &eprom_present);
+        printk(KERN_INFO "(scsi%d) Cables present (Int-50 %s, Int-68 %s, "
+               "Ext-68 %s)\n", p->host_no,
+               "Don't Care",
+               internal68_present ? "YES" : "NO",
+               external_present ? "YES" : "NO");
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) EEPROM %s present.\n", p->host_no,
+               eprom_present ? "is" : "is not");
+        if (internal68_present && external_present)
+        {
+          brddat = 0;
+          p->flags &= ~AHC_TERM_ENB_SE_HIGH;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) Wide channel termination Disabled\n",
+                   p->host_no);
         }
-        if (!(p->adapter_control & CFAUTOTERM))
+        else
         {
-          enableLVD_low = enableLVD_high = (p->adapter_control & CFLVDSTERM);
+          brddat = BRDDAT6;
+          p->flags |= AHC_TERM_ENB_SE_HIGH;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) Wide channel termination Enabled\n",
+                   p->host_no);
         }
-        internal50_present = 0;
-        internal68_present = 1;
-        external_present = 1;
-      }
-      else if ( (p->chip & AHC_CHIPID_MASK) >= AHC_AIC7870 )
-      {
-        aic787x_cable_detect(p, &internal50_present, &internal68_present,
-          &external_present, &eprom_present);
       }
       else
       {
-        aic785x_cable_detect(p, &internal50_present, &external_present,
-          &eprom_present);
+        /*
+         * The termination of the Wide channel is done more like normal
+         * though, and the setting of this termination is done by writing
+         * either a 0 or 1 to BRDDAT6 of the BRDDAT register
+         */
+        if (p->adapter_control & CFWSTERM)
+        {
+          brddat = BRDDAT6;
+          p->flags |= AHC_TERM_ENB_SE_HIGH;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) Wide channel termination Enabled\n",
+                   p->host_no);
+        }
+        else
+        {
+          brddat = 0;
+        }
       }
-      
-      if (max_target <= 8)
-        internal68_present = 0;
-
-      if ( !(p->features & AHC_NEW_AUTOTERM) )
+    }
+    else
+    {
+      if (p->adapter_control & CFAUTOTERM)
       {
+        if (p->flags & AHC_MOTHERBOARD)
+        {
+          printk(KERN_INFO "(scsi%d) Warning - detected auto-termination\n",
+                 p->host_no);
+          printk(KERN_INFO "(scsi%d) Please verify driver detected settings "
+            "are correct.\n", p->host_no);
+          printk(KERN_INFO "(scsi%d) If not, then please properly set the "
+            "device termination\n", p->host_no);
+          printk(KERN_INFO "(scsi%d) in the Adaptec SCSI BIOS by hitting "
+            "CTRL-A when prompted\n", p->host_no);
+          printk(KERN_INFO "(scsi%d) during machine bootup.\n", p->host_no);
+        }
+        /* Configure auto termination. */
+
+        if ( (p->chip & AHC_CHIPID_MASK) >= AHC_AIC7870 )
+        {
+          aic787x_cable_detect(p, &internal50_present, &internal68_present,
+            &external_present, &eprom_present);
+        }
+        else
+        {
+          aic785x_cable_detect(p, &internal50_present, &external_present,
+            &eprom_present);
+        }
+
+        if (max_target <= 8)
+          internal68_present = 0;
+
         if (max_target > 8)
         {
           printk(KERN_INFO "(scsi%d) Cables present (Int-50 %s, Int-68 %s, "
@@ -7921,100 +8107,73 @@
                  internal50_present ? "YES" : "NO",
                  external_present ? "YES" : "NO");
         }
-      }
-      if (aic7xxx_verbose & VERBOSE_PROBE2)
-        printk(KERN_INFO "(scsi%d) EEPROM %s present.\n", p->host_no,
-             eprom_present ? "is" : "is not");
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk(KERN_INFO "(scsi%d) EEPROM %s present.\n", p->host_no,
+               eprom_present ? "is" : "is not");
 
-      /*
-       * Now set the termination based on what we found.  BRDDAT6
-       * controls wide termination enable.
-       * Flash Enable = BRDDAT7
-       * SE High Term Enable = BRDDAT6
-       * SE Low Term Enable = BRDDAT5 (7890)
-       * LVD High Term Enable = BRDDAT4 (7890)
-       */
-      if ( !(p->features & AHC_NEW_AUTOTERM) &&
-           (internal50_present && internal68_present && external_present) )
-      {
-        printk(KERN_INFO "(scsi%d) Illegal cable configuration!!  Only two\n",
-               p->host_no);
-        printk(KERN_INFO "(scsi%d) connectors on the SCSI controller may be "
-               "in use at a time!\n", p->host_no);
         /*
-         * Force termination (low and high byte) on.  This is safer than
-         * leaving it completely off, especially since this message comes
-         * most often from motherboard controllers that don't even have 3
-         * connectors, but instead are failing the cable detection.
+         * Now set the termination based on what we found.  BRDDAT6
+         * controls wide termination enable.
+         * Flash Enable = BRDDAT7
+         * SE High Term Enable = BRDDAT6
          */
-        internal50_present = external_present = 0;
-        enableSE_high = enableSE_low = 1;
-      }
-
-      if ((max_target > 8) &&
-          ((external_present == 0) || (internal68_present == 0) ||
-           (enableSE_high != 0)))
-      {
-        brddat |= BRDDAT6;
-        p->flags |= AHC_TERM_ENB_SE_HIGH;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) SE High byte termination Enabled\n",
+        if (internal50_present && internal68_present && external_present)
+        {
+          printk(KERN_INFO "(scsi%d) Illegal cable configuration!!  Only two\n",
                  p->host_no);
-      }
+          printk(KERN_INFO "(scsi%d) connectors on the SCSI controller may be "
+                 "in use at a time!\n", p->host_no);
+          /*
+           * Force termination (low and high byte) on.  This is safer than
+           * leaving it completely off, especially since this message comes
+           * most often from motherboard controllers that don't even have 3
+           * connectors, but instead are failing the cable detection.
+           */
+          internal50_present = external_present = 0;
+          enableSE_high = enableSE_low = 1;
+        }
 
-      if ( (((internal50_present ? 1 : 0) +
-             (internal68_present ? 1 : 0) +
-             (external_present   ? 1 : 0)) <= 1) ||
-           (enableSE_low != 0) )
-      {
-        if (p->features & AHC_NEW_AUTOTERM)
-          brddat |= BRDDAT5;
-        else
-          sxfrctl1 |= STPWEN;
-        p->flags |= AHC_TERM_ENB_SE_LOW;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) SE Low byte termination Enabled\n",
-                 p->host_no);
-      }
+        if ((max_target > 8) &&
+            ((external_present == 0) || (internal68_present == 0)) )
+        {
+          brddat |= BRDDAT6;
+          p->flags |= AHC_TERM_ENB_SE_HIGH;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) SE High byte termination Enabled\n",
+                   p->host_no);
+        }
 
-      if (enableLVD_low != 0)
-      {
-        sxfrctl1 |= STPWEN;
-        p->flags |= AHC_TERM_ENB_LVD;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) LVD Low byte termination Enabled\n",
-                 p->host_no);
-      }
-          
-      if (enableLVD_high != 0)
-      {
-        brddat |= BRDDAT4;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) LVD High byte termination Enabled\n",
-                 p->host_no);
+        if ( ((internal50_present ? 1 : 0) +
+              (internal68_present ? 1 : 0) +
+              (external_present   ? 1 : 0)) <= 1 )
+        {
+          sxfrctl1 |= STPWEN;
+          p->flags |= AHC_TERM_ENB_SE_LOW;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) SE Low byte termination Enabled\n",
+                   p->host_no);
+        }
       }
-    }
-    else
-    {
-      if (p->adapter_control & CFSTERM)
+      else /* p->adapter_control & CFAUTOTERM */
       {
-        if (p->features & AHC_NEW_AUTOTERM)
-          brddat |= BRDDAT5;
-        else
+        if (p->adapter_control & CFSTERM)
+        {
           sxfrctl1 |= STPWEN;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) SE Low byte termination Enabled\n",
-                 p->host_no);
-      }
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) SE Low byte termination Enabled\n",
+                   p->host_no);
+        }
 
-      if (p->adapter_control & CFWSTERM)
-      {
-        brddat |= BRDDAT6;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk(KERN_INFO "(scsi%d) SE High byte termination Enabled\n",
-                 p->host_no);
+        if (p->adapter_control & CFWSTERM)
+        {
+          brddat |= BRDDAT6;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk(KERN_INFO "(scsi%d) SE High byte termination Enabled\n",
+                   p->host_no);
+        }
       }
     }
+
     aic_outb(p, sxfrctl1, SXFRCTL1);
     write_brdctl(p, brddat);
     release_seeprom(p);
@@ -8376,7 +8535,7 @@
    * we won't have a power source for the SCSI termination, which means
    * we'll see infinite incoming bus resets.
    */
-  if(p->flags & AHC_NO_STPWR)
+  if(p->flags & AHC_NO_STPWEN)
     aic_outb(p, ENSELTIMO | ENSCSIPERR, SIMODE1);
   else
     aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1);
@@ -8678,10 +8837,10 @@
    * In the future, we may call this function as a last resort for
    * error handling.  Let's be nice and not do any unecessary delays.
    */
-  wait = 1000;  /* 1 second (1000 * 1 msec) */
+  wait = 1000;  /* 1 msec (1000 * 1 msec) */
   while (--wait && !(aic_inb(p, HCNTRL) & CHIPRSTACK))
   {
-    udelay(1);  /* 1 msec */
+    udelay(1);  /* 1 usec */
   }
 
   pause_sequencer(p);
@@ -9360,7 +9519,7 @@
        AHC_AIC7860_FE,                                       7,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7860, AHC_AIC7860,
-       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
+       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MOTHERBOARD,
        AHC_AIC7860_FE,                                       7,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7861, AHC_AIC7860,
@@ -9368,7 +9527,8 @@
        AHC_AIC7860_FE,                                       8,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7870, AHC_AIC7870,
-       AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7870_FE,      9,
+       AHC_PAGESCBS | AHC_BIOS_ENABLED | AHC_MOTHERBOARD,
+       AHC_AIC7870_FE,                                       9,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7871, AHC_AIC7870,
        AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7870_FE,     10,
@@ -9385,7 +9545,8 @@
        AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7870_FE,     13,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7880, AHC_AIC7880,
-       AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE,     14,
+       AHC_PAGESCBS | AHC_BIOS_ENABLED | AHC_MOTHERBOARD,
+       AHC_AIC7880_FE,                                      14,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7881, AHC_AIC7880,
        AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE,     15,
@@ -9408,78 +9569,78 @@
        AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE,     18,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7887, AHC_AIC7880,
-       AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE | AHC_NEW_AUTOTERM, 18,
+       AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE | AHC_NEW_AUTOTERM, 19,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7888, AHC_AIC7880,
        AHC_PAGESCBS | AHC_BIOS_ENABLED, AHC_AIC7880_FE,     18,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_7895, AHC_AIC7895,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7895_FE,                                      19,
+       AHC_AIC7895_FE,                                      20,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7890, AHC_AIC7890,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7890_FE,                                      20,
+       AHC_AIC7890_FE,                                      21,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7890B, AHC_AIC7890,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7890_FE,                                      20,
+       AHC_AIC7890_FE,                                      21,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_2930U2, AHC_AIC7890,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7890_FE,                                      21,
+       AHC_AIC7890_FE,                                      22,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_2940U2, AHC_AIC7890,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7890_FE,                                      22,
+       AHC_AIC7890_FE,                                      23,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7896, AHC_AIC7896,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7896_FE,                                      23,
+       AHC_AIC7896_FE,                                      24,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_3940U2, AHC_AIC7896,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7896_FE,                                      24,
+       AHC_AIC7896_FE,                                      25,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_3950U2D, AHC_AIC7896,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7896_FE,                                      25,
+       AHC_AIC7896_FE,                                      26,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_1480A, AHC_AIC7860,
-       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_NO_STPWR,
-       AHC_AIC7860_FE,                                      26,
+       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_NO_STPWEN,
+       AHC_AIC7860_FE,                                      27,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7892A, AHC_AIC7892,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7892_FE,                                      27,
+       AHC_AIC7892_FE,                                      28,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7892B, AHC_AIC7892,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7892_FE,                                      27,
+       AHC_AIC7892_FE,                                      28,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7892D, AHC_AIC7892,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7892_FE,                                      27,
+       AHC_AIC7892_FE,                                      28,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7892P, AHC_AIC7892,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
-       AHC_AIC7892_FE,                                      27,
+       AHC_AIC7892_FE,                                      28,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7899A, AHC_AIC7899,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7899_FE,                                      28,
+       AHC_AIC7899_FE,                                      29,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7899B, AHC_AIC7899,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7899_FE,                                      28,
+       AHC_AIC7899_FE,                                      29,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7899D, AHC_AIC7899,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7899_FE,                                      28,
+       AHC_AIC7899_FE,                                      29,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7899P, AHC_AIC7899,
        AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_MULTI_CHANNEL,
-       AHC_AIC7899_FE,                                      28,
+       AHC_AIC7899_FE,                                      29,
        32, C56_66 },
     };
 
Index: oldkernel/linux/drivers/scsi/aic7xxx_seq.c
diff -u linux/drivers/scsi/aic7xxx_seq.c:1.2 linux/drivers/scsi/aic7xxx_seq.c:1.3
--- linux/drivers/scsi/aic7xxx_seq.c:1.2	Thu Jun  1 15:16:16 2000
+++ linux/drivers/scsi/aic7xxx_seq.c	Thu Jun  1 15:46:48 2000
@@ -26,12 +26,12 @@
 	0x00, 0x4d, 0x12, 0x70,
 	0x01, 0x4e, 0x9c, 0x18,
 	0xbf, 0x60, 0xc0, 0x08,
-	0x00, 0x6a, 0xbe, 0x5c,
+	0x00, 0x6a, 0xbc, 0x5c,
 	0xff, 0x4e, 0xc8, 0x18,
-	0x02, 0x6a, 0xd4, 0x5b,
+	0x02, 0x6a, 0xd2, 0x5b,
 	0xff, 0x52, 0x20, 0x09,
 	0x0d, 0x6a, 0x6a, 0x00,
-	0x00, 0x52, 0x4a, 0x5c,
+	0x00, 0x52, 0x48, 0x5c,
 	0x03, 0xb0, 0x52, 0x31,
 	0xff, 0xb0, 0x52, 0x09,
 	0xff, 0xb1, 0x54, 0x09,
@@ -76,7 +76,7 @@
 	0x10, 0x03, 0xfc, 0x78,
 	0xff, 0x50, 0xc8, 0x08,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x49, 0x6a, 0x3a, 0x5c,
+	0x49, 0x6a, 0x38, 0x5c,
 	0x01, 0x6a, 0x26, 0x01,
 	0xff, 0x6a, 0xca, 0x08,
 	0x08, 0x01, 0x02, 0x00,
@@ -117,11 +117,11 @@
 	0xff, 0x65, 0xca, 0x18,
 	0xff, 0x65, 0xd8, 0x68,
 	0x0a, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0xb0, 0x5c,
+	0x00, 0x65, 0xae, 0x5c,
 	0x40, 0x51, 0xf0, 0x78,
 	0xe4, 0x6a, 0x06, 0x00,
 	0x08, 0x01, 0x02, 0x00,
-	0x04, 0x6a, 0x6c, 0x5b,
+	0x04, 0x6a, 0x6a, 0x5b,
 	0x01, 0x50, 0xa0, 0x18,
 	0x00, 0x50, 0xf6, 0xe0,
 	0xff, 0x6a, 0xa0, 0x08,
@@ -147,7 +147,7 @@
 	0x08, 0x6a, 0x66, 0x58,
 	0x80, 0x6a, 0x68, 0x00,
 	0x80, 0x36, 0x6c, 0x00,
-	0x00, 0x65, 0x1e, 0x5c,
+	0x00, 0x65, 0x1c, 0x5c,
 	0xff, 0x3d, 0xc8, 0x08,
 	0xbf, 0x64, 0x5a, 0x79,
 	0x80, 0x64, 0x22, 0x72,
@@ -173,13 +173,13 @@
 	0x03, 0xa9, 0x18, 0x31,
 	0x03, 0xa9, 0x10, 0x30,
 	0x08, 0x6a, 0xcc, 0x00,
-	0xa9, 0x6a, 0x34, 0x5c,
+	0xa9, 0x6a, 0x32, 0x5c,
 	0x00, 0x65, 0x7a, 0x41,
 	0xa8, 0x6a, 0x6a, 0x00,
 	0x79, 0x6a, 0x6a, 0x00,
 	0x40, 0x3d, 0x62, 0x69,
 	0x04, 0x35, 0x6a, 0x00,
-	0x00, 0x65, 0x8e, 0x5b,
+	0x00, 0x65, 0x8c, 0x5b,
 	0x80, 0x6a, 0xd4, 0x01,
 	0x10, 0x36, 0x4e, 0x69,
 	0x10, 0x36, 0x6c, 0x00,
@@ -187,10 +187,10 @@
 	0x03, 0x8c, 0x10, 0x30,
 	0x05, 0xa3, 0x70, 0x30,
 	0x88, 0x6a, 0xcc, 0x00,
-	0xac, 0x6a, 0x2c, 0x5c,
-	0x00, 0x65, 0x26, 0x5c,
+	0xac, 0x6a, 0x2a, 0x5c,
+	0x00, 0x65, 0x24, 0x5c,
 	0x38, 0x6a, 0xcc, 0x00,
-	0xa3, 0x6a, 0x30, 0x5c,
+	0xa3, 0x6a, 0x2e, 0x5c,
 	0xff, 0x38, 0x8a, 0x69,
 	0x80, 0x02, 0x04, 0x00,
 	0xe7, 0x35, 0x6a, 0x08,
@@ -209,7 +209,7 @@
 	0x10, 0x0c, 0x96, 0x79,
 	0x04, 0x0b, 0xa0, 0x69,
 	0xff, 0x6a, 0xca, 0x08,
-	0x00, 0x35, 0x76, 0x5b,
+	0x00, 0x35, 0x74, 0x5b,
 	0x80, 0x02, 0xf4, 0x69,
 	0xff, 0x65, 0xe4, 0x79,
 	0xff, 0x38, 0x70, 0x18,
@@ -229,14 +229,14 @@
 	0x08, 0xe9, 0x10, 0x31,
 	0x03, 0x8c, 0x10, 0x30,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x39, 0x6a, 0x32, 0x5c,
+	0x39, 0x6a, 0x30, 0x5c,
 	0x08, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0x0d, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0xb0, 0x5c,
-	0x88, 0x6a, 0xa0, 0x5c,
-	0x00, 0x65, 0x26, 0x5c,
+	0x00, 0x65, 0xae, 0x5c,
+	0x88, 0x6a, 0x9e, 0x5c,
+	0x00, 0x65, 0x24, 0x5c,
 	0xff, 0x6a, 0xc8, 0x08,
 	0x08, 0x39, 0x72, 0x18,
 	0x00, 0x3a, 0x74, 0x20,
@@ -275,16 +275,16 @@
 	0xff, 0x38, 0x50, 0x09,
 	0x12, 0x01, 0x02, 0x00,
 	0xff, 0x6a, 0xd4, 0x0c,
-	0x00, 0x65, 0x8e, 0x5b,
+	0x00, 0x65, 0x8c, 0x5b,
 	0x05, 0xb4, 0x10, 0x31,
 	0x02, 0x6a, 0x1a, 0x31,
 	0x03, 0x8c, 0x10, 0x30,
 	0x88, 0x6a, 0xcc, 0x00,
-	0xb4, 0x6a, 0x30, 0x5c,
+	0xb4, 0x6a, 0x2e, 0x5c,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
-	0x00, 0x65, 0x26, 0x5c,
-	0x3d, 0x6a, 0x76, 0x5b,
+	0x00, 0x65, 0x24, 0x5c,
+	0x3d, 0x6a, 0x74, 0x5b,
 	0xac, 0x6a, 0x26, 0x01,
 	0x04, 0x0b, 0x38, 0x6a,
 	0x04, 0x0b, 0x3e, 0x6a,
@@ -295,7 +295,7 @@
 	0x20, 0x93, 0x44, 0x6a,
 	0x12, 0x01, 0x02, 0x00,
 	0x00, 0x65, 0x22, 0x41,
-	0x00, 0x65, 0x8e, 0x5b,
+	0x00, 0x65, 0x8c, 0x5b,
 	0xff, 0x06, 0x44, 0x09,
 	0x00, 0x65, 0x22, 0x41,
 	0x10, 0x3d, 0x06, 0x00,
@@ -311,10 +311,10 @@
 	0x00, 0x65, 0x78, 0x42,
 	0x20, 0xa0, 0x7e, 0x7a,
 	0xff, 0x65, 0x0c, 0x08,
-	0x00, 0x65, 0x1e, 0x5c,
+	0x00, 0x65, 0x1c, 0x5c,
 	0xa0, 0x3d, 0x86, 0x62,
 	0x23, 0xa0, 0x0c, 0x08,
-	0x00, 0x65, 0x1e, 0x5c,
+	0x00, 0x65, 0x1c, 0x5c,
 	0xa0, 0x3d, 0x86, 0x62,
 	0x00, 0xb9, 0x7e, 0x42,
 	0xff, 0x65, 0x7e, 0x62,
@@ -323,7 +323,7 @@
 	0x10, 0x51, 0x86, 0x72,
 	0x40, 0x6a, 0x18, 0x00,
 	0xff, 0x65, 0x0c, 0x08,
-	0x00, 0x65, 0x1e, 0x5c,
+	0x00, 0x65, 0x1c, 0x5c,
 	0xa0, 0x3d, 0x50, 0x72,
 	0x40, 0x6a, 0x18, 0x00,
 	0xff, 0x34, 0xa6, 0x08,
@@ -331,7 +331,7 @@
 	0x7f, 0xa0, 0x40, 0x09,
 	0x08, 0x6a, 0x68, 0x00,
 	0x00, 0x65, 0x22, 0x41,
-	0x64, 0x6a, 0x66, 0x5b,
+	0x64, 0x6a, 0x64, 0x5b,
 	0x80, 0x64, 0x04, 0x6b,
 	0x04, 0x64, 0xe6, 0x72,
 	0x02, 0x64, 0xec, 0x72,
@@ -342,49 +342,49 @@
 	0x08, 0x64, 0xaa, 0x72,
 	0x23, 0x64, 0x46, 0x73,
 	0x11, 0x6a, 0x22, 0x01,
-	0x07, 0x6a, 0x58, 0x5b,
+	0x07, 0x6a, 0x56, 0x5b,
 	0xff, 0x06, 0xd4, 0x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03, 0xa9, 0x60, 0x31,
 	0xa3, 0x6a, 0xcc, 0x00,
-	0x38, 0x6a, 0x30, 0x5c,
+	0x38, 0x6a, 0x2e, 0x5c,
 	0xac, 0x6a, 0xcc, 0x00,
-	0x14, 0x6a, 0x32, 0x5c,
-	0xa9, 0x6a, 0x34, 0x5c,
+	0x14, 0x6a, 0x30, 0x5c,
+	0xa9, 0x6a, 0x32, 0x5c,
 	0x00, 0x65, 0xaa, 0x42,
 	0xef, 0x36, 0x6c, 0x08,
 	0x00, 0x65, 0xaa, 0x42,
@@ -392,17 +392,17 @@
 	0x07, 0x64, 0xc8, 0x08,
 	0x00, 0x37, 0x6e, 0x00,
 	0xff, 0x6a, 0xa4, 0x00,
-	0x00, 0x65, 0xc4, 0x5b,
+	0x00, 0x65, 0xc2, 0x5b,
 	0xff, 0x51, 0x16, 0x73,
 	0x20, 0x36, 0x20, 0x7b,
-	0x00, 0x90, 0xb2, 0x5b,
+	0x00, 0x90, 0xb0, 0x5b,
 	0x00, 0x65, 0x22, 0x43,
 	0xff, 0x06, 0xd4, 0x08,
-	0x00, 0x65, 0x1e, 0x5c,
+	0x00, 0x65, 0x1c, 0x5c,
 	0xe0, 0x3d, 0x3c, 0x63,
 	0x20, 0x12, 0x3c, 0x63,
-	0x51, 0x6a, 0x5c, 0x5b,
-	0x00, 0x65, 0xac, 0x5b,
+	0x51, 0x6a, 0x5a, 0x5b,
+	0x00, 0x65, 0xaa, 0x5b,
 	0xff, 0x37, 0xc8, 0x08,
 	0x00, 0xa1, 0x34, 0x63,
 	0x04, 0xa0, 0x34, 0x7b,
@@ -410,127 +410,126 @@
 	0x80, 0x36, 0x6c, 0x00,
 	0x80, 0xa0, 0xaa, 0x7a,
 	0x7f, 0xa0, 0x40, 0x09,
-	0xff, 0x6a, 0x58, 0x5b,
+	0xff, 0x6a, 0x56, 0x5b,
 	0x00, 0x65, 0xaa, 0x42,
 	0x04, 0xa0, 0x3a, 0x7b,
-	0x00, 0x65, 0xd0, 0x5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41,
 	0xff, 0x65, 0x26, 0x09,
-	0x01, 0x0b, 0x86, 0x6b,
-	0x10, 0x0c, 0x78, 0x7b,
-	0x04, 0x0b, 0x80, 0x6b,
+	0x01, 0x0b, 0x84, 0x6b,
+	0x10, 0x0c, 0x76, 0x7b,
+	0x04, 0x0b, 0x7e, 0x6b,
 	0xff, 0x6a, 0xca, 0x08,
-	0x04, 0x93, 0x84, 0x6b,
-	0x01, 0x94, 0x82, 0x7b,
-	0x10, 0x94, 0x84, 0x6b,
+	0x04, 0x93, 0x82, 0x6b,
+	0x01, 0x94, 0x80, 0x7b,
+	0x10, 0x94, 0x82, 0x6b,
 	0xc7, 0x93, 0x26, 0x09,
 	0xff, 0x99, 0xd4, 0x08,
-	0x38, 0x93, 0x88, 0x6b,
+	0x38, 0x93, 0x86, 0x6b,
 	0xff, 0x6a, 0xd4, 0x0c,
-	0x80, 0x36, 0x8c, 0x6b,
+	0x80, 0x36, 0x8a, 0x6b,
 	0x21, 0x6a, 0x22, 0x05,
 	0xff, 0x65, 0x20, 0x09,
-	0xff, 0x51, 0x9a, 0x63,
+	0xff, 0x51, 0x98, 0x63,
 	0xff, 0x37, 0xc8, 0x08,
-	0xa1, 0x6a, 0xa6, 0x43,
+	0xa1, 0x6a, 0xa4, 0x43,
 	0xff, 0x51, 0xc8, 0x08,
-	0xb9, 0x6a, 0xa6, 0x43,
+	0xb9, 0x6a, 0xa4, 0x43,
 	0xff, 0x90, 0xa4, 0x08,
-	0xff, 0xba, 0xaa, 0x73,
+	0xff, 0xba, 0xa8, 0x73,
 	0xff, 0xba, 0x20, 0x09,
 	0xff, 0x65, 0xca, 0x18,
-	0x00, 0x6c, 0x9e, 0x63,
+	0x00, 0x6c, 0x9c, 0x63,
 	0xff, 0x90, 0xca, 0x0c,
 	0xff, 0x6a, 0xca, 0x04,
-	0x20, 0x36, 0xbe, 0x7b,
-	0x00, 0x90, 0x92, 0x5b,
-	0xff, 0x65, 0xbe, 0x73,
-	0xff, 0x52, 0xb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09,
 	0x20, 0x6a, 0xd0, 0x01,
-	0x04, 0x35, 0x5c, 0x7c,
+	0x04, 0x35, 0x5a, 0x7c,
 	0x1d, 0x6a, 0xdc, 0x01,
-	0xdc, 0xee, 0x58, 0x64,
-	0x00, 0x65, 0x68, 0x44,
+	0xdc, 0xee, 0x56, 0x64,
+	0x00, 0x65, 0x66, 0x44,
 	0x01, 0x6a, 0xdc, 0x01,
 	0x20, 0xa0, 0xd8, 0x31,
 	0x09, 0xee, 0xdc, 0x01,
-	0x80, 0xee, 0x62, 0x7c,
+	0x80, 0xee, 0x60, 0x7c,
 	0x19, 0x6a, 0xdc, 0x01,
-	0xd8, 0xee, 0x66, 0x64,
+	0xd8, 0xee, 0x64, 0x64,
 	0xff, 0x6a, 0xdc, 0x09,
-	0x18, 0xee, 0x6a, 0x6c,
+	0x18, 0xee, 0x68, 0x6c,
 	0xff, 0x6a, 0xd4, 0x0c,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x41, 0x6a, 0x3a, 0x5c,
+	0x41, 0x6a, 0x38, 0x5c,
 	0x20, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0xff, 0x35, 0x26, 0x09,
-	0x04, 0x35, 0x94, 0x6c,
+	0x04, 0x35, 0x92, 0x6c,
 	0xa0, 0x6a, 0xca, 0x00,
 	0x20, 0x65, 0xc8, 0x18,
 	0xff, 0x6c, 0x32, 0x09,
@@ -586,14 +585,14 @@
 	0xff, 0x6c, 0x32, 0x09,
 	0xff, 0x6c, 0x32, 0x09,
 	0xff, 0x6c, 0x32, 0x09,
-	0x00, 0x65, 0x80, 0x64,
+	0x00, 0x65, 0x7e, 0x64,
 	0x0a, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0xb0, 0x5c,
-	0x04, 0x35, 0x8c, 0x7b,
-	0xa0, 0x6a, 0xa0, 0x5c,
-	0x00, 0x65, 0xa2, 0x5c,
-	0x00, 0x65, 0xa2, 0x5c,
-	0x00, 0x65, 0xa2, 0x44,
+	0x00, 0x65, 0xae, 0x5c,
+	0x04, 0x35, 0x8a, 0x7b,
+	0xa0, 0x6a, 0x9e, 0x5c,
+	0x00, 0x65, 0xa0, 0x5c,
+	0x00, 0x65, 0xa0, 0x5c,
+	0x00, 0x65, 0xa0, 0x44,
 	0xff, 0x65, 0xcc, 0x08,
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x08,
@@ -602,19 +601,19 @@
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x0c,
-	0x08, 0x94, 0xb0, 0x7c,
+	0x08, 0x94, 0xae, 0x7c,
 	0xf7, 0x93, 0x26, 0x09,
-	0x08, 0x93, 0xb4, 0x6c,
+	0x08, 0x93, 0xb2, 0x6c,
 	0xff, 0x6a, 0xd4, 0x0c,
 	0xff, 0x40, 0x74, 0x09,
 	0xff, 0x90, 0x80, 0x08,
 	0xff, 0x6a, 0x72, 0x05,
-	0xff, 0x40, 0xcc, 0x64,
-	0xff, 0x3f, 0xc4, 0x64,
+	0xff, 0x40, 0xca, 0x64,
+	0xff, 0x3f, 0xc2, 0x64,
 	0xff, 0x6a, 0xca, 0x04,
 	0xff, 0x3f, 0x20, 0x09,
 	0x01, 0x6a, 0x6a, 0x00,
-	0x00, 0xb9, 0x4a, 0x5c,
+	0x00, 0xb9, 0x48, 0x5c,
 	0xff, 0xba, 0x7e, 0x0c,
 	0xff, 0x40, 0x20, 0x09,
 	0xff, 0xba, 0x80, 0x0c,
@@ -761,8 +760,9 @@
 	{ aic7xxx_patch1_func, 68, 60, 1 },
 	{ aic7xxx_patch8_func, 162, 1, 2 },
 	{ aic7xxx_patch0_func, 163, 2, 1 },
-	{ aic7xxx_patch2_func, 167, 3, 3 },
-	{ aic7xxx_patch8_func, 167, 2, 1 },
+	{ aic7xxx_patch2_func, 167, 3, 4 },
+	{ aic7xxx_patch8_func, 167, 2, 2 },
+	{ aic7xxx_patch0_func, 169, 1, 1 },
 	{ aic7xxx_patch0_func, 170, 2, 1 },
 	{ aic7xxx_patch8_func, 173, 1, 2 },
 	{ aic7xxx_patch0_func, 174, 1, 1 },
@@ -801,23 +801,21 @@
 	{ aic7xxx_patch11_func, 386, 1, 2 },
 	{ aic7xxx_patch0_func, 387, 1, 1 },
 	{ aic7xxx_patch6_func, 392, 1, 1 },
-	{ aic7xxx_patch8_func, 420, 1, 2 },
-	{ aic7xxx_patch0_func, 421, 5, 1 },
-	{ aic7xxx_patch1_func, 438, 3, 1 },
-	{ aic7xxx_patch10_func, 443, 11, 1 },
-	{ aic7xxx_patch2_func, 491, 7, 2 },
-	{ aic7xxx_patch0_func, 498, 8, 1 },
-	{ aic7xxx_patch2_func, 507, 4, 2 },
-	{ aic7xxx_patch0_func, 511, 6, 1 },
-	{ aic7xxx_patch2_func, 517, 4, 2 },
-	{ aic7xxx_patch0_func, 521, 3, 1 },
-	{ aic7xxx_patch12_func, 531, 10, 1 },
-	{ aic7xxx_patch2_func, 550, 17, 4 },
-	{ aic7xxx_patch13_func, 558, 4, 2 },
-	{ aic7xxx_patch0_func, 562, 2, 1 },
-	{ aic7xxx_patch0_func, 567, 33, 1 },
-	{ aic7xxx_patch12_func, 600, 4, 1 },
-	{ aic7xxx_patch6_func, 604, 2, 1 },
-	{ aic7xxx_patch6_func, 607, 9, 1 },
+	{ aic7xxx_patch1_func, 437, 3, 1 },
+	{ aic7xxx_patch10_func, 442, 11, 1 },
+	{ aic7xxx_patch2_func, 490, 7, 2 },
+	{ aic7xxx_patch0_func, 497, 8, 1 },
+	{ aic7xxx_patch2_func, 506, 4, 2 },
+	{ aic7xxx_patch0_func, 510, 6, 1 },
+	{ aic7xxx_patch2_func, 516, 4, 2 },
+	{ aic7xxx_patch0_func, 520, 3, 1 },
+	{ aic7xxx_patch12_func, 530, 10, 1 },
+	{ aic7xxx_patch2_func, 549, 17, 4 },
+	{ aic7xxx_patch13_func, 557, 4, 2 },
+	{ aic7xxx_patch0_func, 561, 2, 1 },
+	{ aic7xxx_patch0_func, 566, 33, 1 },
+	{ aic7xxx_patch12_func, 599, 4, 1 },
+	{ aic7xxx_patch6_func, 603, 2, 1 },
+	{ aic7xxx_patch6_func, 606, 9, 1 },
 
 };
Index: oldkernel/linux/drivers/scsi/aic7xxx/aic7xxx.seq
diff -u linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.2 linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.3
--- linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.2	Thu Jun  1 15:16:17 2000
+++ linux/drivers/scsi/aic7xxx/aic7xxx.seq	Thu Jun  1 15:46:48 2000
@@ -448,8 +448,9 @@
 		if ((p->features & AHC_ULTRA2) != 0) {
 			bmov	HADDR, SHADDR, 4;
 			bmov    HCNT, SCB_RESID_DCNT, 3;
+		} else {
+			bmov    STCNT, SCB_RESID_DCNT, 3;
 		}
-		bmov    STCNT, SCB_RESID_DCNT, 3;
 	} else {
 		mvi	DINDEX, STCNT;
 		mvi	SCB_RESID_DCNT	call bcopy_3;
@@ -1071,15 +1072,12 @@
 /*
  * See if we'll ignore this wide residue (because it's an overrun byte)
  */
- 	if ((p->features & AHC_ULTRA2) != 0) {
-		test	SSTAT2, WIDE_RES jnz mesgin_done;
-	} else {
-		test	SCB_RESID_SGCNT,0xff jnz wide_residue_int;
-		test	SCB_RESID_DCNT[0],0xff jnz wide_residue_int;
-		test	SCB_RESID_DCNT[1],0xff jnz wide_residue_int;
-		test	SCB_RESID_DCNT[2],0xff jnz wide_residue_int;
-		jmp	mesgin_done;
-	}
+	test	SCB_RESID_SGCNT,0xff jnz wide_residue_int;
+	test	SCB_RESID_DCNT[0],0xff jnz wide_residue_int;
+	test	SCB_RESID_DCNT[1],0xff jnz wide_residue_int;
+	test	SCB_RESID_DCNT[2],0xff jnz wide_residue_int;
+	jmp	mesgin_done;
+
 wide_residue_int:
 /*
  * In order for this to be reliable, we have to do all sorts of horrible
