Index: oldkernel/linux/drivers/scsi/README.aic7xxx
diff -u linux/drivers/scsi/README.aic7xxx:1.1.1.1 linux/drivers/scsi/README.aic7xxx:1.2
--- linux/drivers/scsi/README.aic7xxx:1.1.1.1	Wed May 31 12:33:51 2000
+++ linux/drivers/scsi/README.aic7xxx	Thu Jun  1 15:16:16 2000
@@ -208,6 +208,19 @@
 	will often result in the machine crashing or spontaneously rebooting
 	during startup.  Examples of machines that need this are the
 	Dell PowerEdge 6300 machines.
+
+    "aic7xxx=seltime:2" - This option controls how long the card waits
+        during a device selection sequence for the device to respond.
+	The original SCSI spec says that this "should be" 256ms.  This
+	is generally not required with modern devices.  However, some
+	very old SCSI I devices need the full 256ms.  Most modern devices
+	can run fine with only 64ms.  The default for this option is
+	64ms.  If you need to change this option, then use the following
+	table to set the proper value in the example above:
+	  0  -  256ms
+	  1  -  128ms
+	  2  -   64ms
+	  3  -   32ms
 	
     "aic7xxx=panic_on_abort" - This option is for debugging and will cause
         the driver to panic the linux kernel and freeze the system the first
@@ -485,12 +498,14 @@
 
   Web sites
   ------------------------------
-    http://people.redhat.com/dledford/aic7xxx.html
-      - Primary web site maintained by Doug Ledford.
+    http://people.redhat.com/dledford/
+      - My web site, also the primary aic7xxx site with several related
+        pages.
 
 Dean W. Gehnert
 deang@teleport.com
 
 $Revision: 3.0 $
+
+Modified by Doug Ledford 1998-2000
 
-Modified by Doug Ledford 1998-9
Index: oldkernel/linux/drivers/scsi/aic7xxx.c
diff -u linux/drivers/scsi/aic7xxx.c:1.3 linux/drivers/scsi/aic7xxx.c:1.4
--- linux/drivers/scsi/aic7xxx.c:1.3	Thu Jun  1 15:15:42 2000
+++ linux/drivers/scsi/aic7xxx.c	Thu Jun  1 15:16:16 2000
@@ -270,7 +270,7 @@
     0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 
-#define AIC7XXX_C_VERSION  "5.1.23"
+#define AIC7XXX_C_VERSION  "5.1.24"
 
 #define NUMBER(arr)     (sizeof(arr) / sizeof(arr[0]))
 #define MIN(a,b)        (((a) < (b)) ? (a) : (b))
@@ -833,6 +833,7 @@
   *  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_RESET_DELAY           = 0x00080000,
         AHC_A_SCANNED             = 0x00100000,
         AHC_B_SCANNED             = 0x00200000,
@@ -1364,10 +1365,10 @@
 /*
  * So that we can set how long each device is given as a selection timeout.
  * The table of values goes like this:
- * 	0 - 256ms
- * 	1 - 128ms
- * 	2 - 64ms
- * 	3 - 32ms
+ *   0 - 256ms
+ *   1 - 128ms
+ *   2 - 64ms
+ *   3 - 32ms
  * We default to 64ms because it's fast.  Some old SCSI-I devices need a
  * longer time.  The final value has to be left shifted by 3, hence 0x10
  * is the final value.
@@ -1777,6 +1778,7 @@
   struct ins_format1 *fmt1_ins;
   struct ins_format3 *fmt3_ins;
   unsigned char opcode;
+  volatile unsigned char hcntrl;
 
   instr = *(union ins_formats*) &seqprog[instrptr * 4];
 
@@ -1878,12 +1880,13 @@
         }
       }
       aic_outb(p, (instr.integer & 0xff), SEQRAM);
-      udelay(50);
+      hcntrl = aic_inb(p, HCNTRL);
       aic_outb(p, ((instr.integer >> 8) & 0xff), SEQRAM);
-      udelay(50);
+      hcntrl = aic_inb(p, HCNTRL);
       aic_outb(p, ((instr.integer >> 16) & 0xff), SEQRAM);
-      udelay(50);
+      hcntrl = aic_inb(p, HCNTRL);
       aic_outb(p, ((instr.integer >> 24) & 0xff), SEQRAM);
+      hcntrl = aic_inb(p, HCNTRL);
       udelay(50);
       break;
 
@@ -1998,21 +2001,6 @@
 
 /*+F*************************************************************************
  * Function:
- *   aic7xxx_delay
- *
- * Description:
- *   Delay for specified amount of time.  We use mdelay because the timer
- *   interrupt is not guaranteed to be enabled.  This will cause an
- *   infinite loop since jiffies (clock ticks) is not updated.
- *-F*************************************************************************/
-static void
-aic7xxx_delay(int seconds)
-{
-  mdelay(seconds * 1000);
-}
-
-/*+F*************************************************************************
- * Function:
  *   aic7xxx_info
  *
  * Description:
@@ -3896,11 +3884,19 @@
   while ( (aic_inb(p, SCSISEQ) & SCSIRSTO) == 0)
     mdelay(5);
 
-  mdelay(10);
+  /*
+   * Some of the new Ultra2 chipsets need a longer delay after a chip
+   * reset than just the init setup creates, so we have to delay here
+   * before we go into a reset in order to make the chips happy.
+   */
+  if (p->features & AHC_ULTRA2)
+    mdelay(250);
+  else
+    mdelay(50);
 
   /* Turn off the bus reset. */
   aic_outb(p, 0, SCSISEQ);
-  mdelay(5);
+  mdelay(10);
 
   aic7xxx_clear_intstat(p);
   /* Re-enable reset interrupts. */
@@ -5304,6 +5300,188 @@
       }
       break;
 
+    case WIDE_RESIDUE:
+      {
+        unsigned char resid_sgcnt, index;
+        unsigned char scb_index = aic_inb(p, SCB_TAG);
+        unsigned int cur_addr, resid_dcnt;
+        unsigned int native_addr, native_length;
+        int i;
+
+        if(scb_index > p->scb_data->numscbs)
+        {
+          printk(WARN_LEAD "invalid scb_index during WIDE_RESIDUE.\n",
+            p->host_no, -1, -1, -1);
+          /*
+           * XXX: Add error handling here
+           */
+          break;
+        }
+        scb = p->scb_data->scb_array[scb_index];
+        if(!(scb->flags & SCB_ACTIVE) || (scb->cmd == NULL))
+        {
+          printk(WARN_LEAD "invalid scb during WIDE_RESIDUE flags:0x%x "
+                 "scb->cmd:0x%x\n", p->host_no, CTL_OF_SCB(scb),
+                 scb->flags, (unsigned int)scb->cmd);
+          break;
+        }
+
+        /*
+         * We have a valid scb to use on this WIDE_RESIDUE message, so
+         * we need to walk the sg list looking for this particular sg
+         * segment, then see if we happen to be at the very beginning of
+         * the segment.  If we are, then we have to back things up to
+         * the previous segment.  If not, then we simply need to remove
+         * one byte from this segments address and add one to the byte
+         * count.
+         */
+        cur_addr = aic_inb(p, SHADDR) | (aic_inb(p, SHADDR + 1) << 8) |
+          (aic_inb(p, SHADDR + 2) << 16) | (aic_inb(p, SHADDR + 3) << 24);
+        resid_sgcnt = aic_inb(p, SCB_RESID_SGCNT);
+        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;
+        native_addr = le32_to_cpu(scb->sg_list[index].address);
+        native_length = le32_to_cpu(scb->sg_list[index].length);
+        /*
+         * Make sure this is a valid sg_seg for the given pointer
+         */
+        if(cur_addr < native_addr ||
+           cur_addr > (native_addr + native_length))
+        {
+          printk(WARN_LEAD "invalid cur_addr:0x%x during WIDE_RESIDUE\n",
+                 p->host_no, CTL_OF_SCB(scb), cur_addr);
+          if(index > 0)
+            printk(WARN_LEAD "  sg_address[-1]:0x%x sg_length[-1]:%d\n",
+                   p->host_no, CTL_OF_SCB(scb),
+                   le32_to_cpu(scb->sg_list[index - 1].address),
+                   le32_to_cpu(scb->sg_list[index - 1].length));
+          printk(WARN_LEAD "  sg_address:0x%x sg_length:%d\n",
+                 p->host_no, CTL_OF_SCB(scb),
+                 native_addr, native_length);
+          if(resid_sgcnt > 1)
+            printk(WARN_LEAD "  sg_address[1]:0x%x sg_length[1]:%d\n",
+                   p->host_no, CTL_OF_SCB(scb),
+                   le32_to_cpu(scb->sg_list[index + 1].address),
+                   le32_to_cpu(scb->sg_list[index + 1].length));
+          break;
+        }
+
+        /*
+         * If our current address matches the sg_seg->address then we
+         * have to back up the sg array to the previous segment and set
+         * it up to have only one byte of transfer left to go.
+         */
+        if(cur_addr == native_addr)
+        {
+          if(index == 0)
+          {
+            printk(WARN_LEAD "bogus WIDE_RESIDUE message, no data has been "
+                   "transferred.\n", p->host_no, CTL_OF_SCB(scb));
+            break;
+          }
+          resid_sgcnt++;
+          index--;
+          cur_addr = le32_to_cpu(scb->sg_list[index].address) + 
+            le32_to_cpu(scb->sg_list[index].length) - 1;
+          native_addr = aic_inb(p, SG_NEXT) | (aic_inb(p, SG_NEXT + 1) << 8)
+            | (aic_inb(p, SG_NEXT + 2) << 16) | (aic_inb(p, SG_NEXT + 3) << 24);
+          native_addr -= SG_SIZEOF;
+          aic_outb(p, resid_sgcnt, SG_COUNT);
+          aic_outb(p, resid_sgcnt, SCB_RESID_SGCNT);
+          aic_outb(p, native_addr & 0xff, SG_NEXT);
+          aic_outb(p, (native_addr >> 8) & 0xff, SG_NEXT + 1);
+          aic_outb(p, (native_addr >> 16) & 0xff, SG_NEXT + 2);
+          aic_outb(p, (native_addr >> 24) & 0xff, SG_NEXT + 3);
+          aic_outb(p, 1, SCB_RESID_DCNT); 
+          aic_outb(p, 0, SCB_RESID_DCNT + 1); 
+          aic_outb(p, 0, SCB_RESID_DCNT + 2); 
+          aic_outb(p, 1, HCNT); 
+          aic_outb(p, 0, HCNT + 1); 
+          aic_outb(p, 0, HCNT + 2); 
+          aic_outb(p, cur_addr & 0xff, HADDR);
+          aic_outb(p, (cur_addr >> 8) & 0xff, HADDR + 1);
+          aic_outb(p, (cur_addr >> 16) & 0xff, HADDR + 2);
+          aic_outb(p, (cur_addr >> 24) & 0xff, HADDR + 3);
+          /*
+           * The sequencer actually wants to find the new address and byte
+           * count in the SHCNT and SHADDR register sets.  These registers
+           * are a shadow of the regular HCNT and HADDR registers.  On the
+           * Ultra2 controllers, these registers are read only and the way
+           * we have to set their values is to put the values we want into
+           * the HCNT and HADDR registers and then output PRELOADEN into
+           * the DFCNTRL register which causes the card to latch the current
+           * values in the HADDR and HCNT registers and drop it through to
+           * the shadow registers.  On older cards we copy them directly
+           * across by hand.
+           */
+          if(p->features & AHC_ULTRA2)
+          {
+            aic_outb(p, aic_inb(p, DMAPARAMS), DFCNTRL);
+            i=0;
+            udelay(1);
+            while(((aic_inb(p, SSTAT0) & SDONE) != 0) && (i++ < 1000))
+            {
+              aic_outb(p, aic_inb(p, DMAPARAMS), DFCNTRL);
+              udelay(1);
+            }
+          }
+          else
+          {
+            aic_outb(p, 1, STCNT); 
+            aic_outb(p, 0, STCNT + 1); 
+            aic_outb(p, 0, STCNT + 2); 
+            aic_outb(p, cur_addr & 0xff, SHADDR);
+            aic_outb(p, (cur_addr >> 8) & 0xff, SHADDR + 1);
+            aic_outb(p, (cur_addr >> 16) & 0xff, SHADDR + 2);
+            aic_outb(p, (cur_addr >> 24) & 0xff, SHADDR + 3);
+          }
+        }
+        else
+        {
+          /*
+           * Back the data pointer up by one and add one to the remaining
+           * byte count.  Then store that in the HCNT and HADDR registers.
+           */
+          cur_addr--;
+          resid_dcnt++;
+          aic_outb(p, resid_dcnt & 0xff, SCB_RESID_DCNT); 
+          aic_outb(p, (resid_dcnt >> 8) & 0xff, SCB_RESID_DCNT + 1); 
+          aic_outb(p, (resid_dcnt >> 16) & 0xff, SCB_RESID_DCNT + 2); 
+          aic_outb(p, resid_dcnt & 0xff, HCNT); 
+          aic_outb(p, (resid_dcnt >> 8) & 0xff, HCNT + 1); 
+          aic_outb(p, (resid_dcnt >> 16) & 0xff, HCNT + 2); 
+          aic_outb(p, cur_addr & 0xff, HADDR);
+          aic_outb(p, (cur_addr >> 8) & 0xff, HADDR + 1);
+          aic_outb(p, (cur_addr >> 16) & 0xff, HADDR + 2);
+          aic_outb(p, (cur_addr >> 24) & 0xff, HADDR + 3);
+          if(p->features & AHC_ULTRA2)
+          {
+            aic_outb(p, aic_inb(p, DMAPARAMS), DFCNTRL);
+            i=0;
+            udelay(1);
+            while(((aic_inb(p, SSTAT0) & SDONE) != 0) && (i++ < 1000))
+            {
+              aic_outb(p, aic_inb(p, DMAPARAMS), DFCNTRL);
+              udelay(1);
+            }
+          }
+          else
+          {
+            aic_outb(p, resid_dcnt & 0xff, STCNT); 
+            aic_outb(p, (resid_dcnt >> 8) & 0xff, STCNT + 1); 
+            aic_outb(p, (resid_dcnt >> 16) & 0xff, STCNT + 2); 
+            aic_outb(p, cur_addr & 0xff, SHADDR);
+            aic_outb(p, (cur_addr >> 8) & 0xff, SHADDR + 1);
+            aic_outb(p, (cur_addr >> 16) & 0xff, SHADDR + 2);
+            aic_outb(p, (cur_addr >> 24) & 0xff, SHADDR + 3);
+          }
+        }
+      }
+      break;
+
+        
 #if AIC7XXX_NOT_YET 
     case TRACEPOINT:
       {
@@ -7907,12 +8085,6 @@
   unsigned char term, scsi_conf;
   struct Scsi_Host *host;
 
-  /*
-   * Lock out other contenders for our i/o space.
-   */
-  request_region(p->base, MAXREG - MINREG, "aic7xxx");
-
-
   host = p->host;
 
   p->scb_data->maxscbs = AIC7XXX_MAXSCB;
@@ -7984,7 +8156,7 @@
       printk("VLB slot %d\n", p->pci_device_fn);
       break;
     default:
-      printk("PCI %d/%d\n", PCI_SLOT(p->pci_device_fn),
+      printk("PCI %d/%d/%d\n", p->pci_bus, PCI_SLOT(p->pci_device_fn),
         PCI_FUNC(p->pci_device_fn));
       break;
   }
@@ -8020,6 +8192,20 @@
   }
   aic_outb(p, 0, SEQ_FLAGS);
 
+  /*
+   * We are starting to do real work on the card....it's possible we could
+   * generate some spurious interrupts at this point, especially in the
+   * event of a PCI error or some such.  If there are other devices already
+   * registered on the same interrupt as us, this could cause the machine
+   * to lock up.  So, we disable the interrupt this card is on until we
+   * finish our card setup.  We only need to do this for modules, if we are
+   * compiled into the kernel then interrupts are already off during this
+   * part of the code.
+   */
+#ifdef MODULE
+  disable_irq(p->irq);
+#endif
+
   detect_maxscb(p);
 
 
@@ -8125,11 +8311,6 @@
   }
 
   /*
-   * Clear out any possible pending interrupts.
-   */
-  aic7xxx_clear_intstat(p);
-
-  /*
    * Set the SCSI Id, SXFRCTL0, SXFRCTL1, and SIMODE1, for both channels
    */
   if (p->features & AHC_TWIN)
@@ -8172,7 +8353,17 @@
   aic_outb(p, (scsi_conf & ENSPCHK) | aic7xxx_seltime | term | 
        ENSTIMER | ACTNEGEN, SXFRCTL1);
   aic_outb(p, 0, SIMODE0);
-  aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1);
+  /*
+   * If we are a cardbus adapter then don't enable SCSI reset detection.
+   * We shouldn't likely be sharing SCSI busses with someone else, and
+   * if we don't have a cable currently plugged into the controller then
+   * 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)
+    aic_outb(p, ENSELTIMO | ENSCSIPERR, SIMODE1);
+  else
+    aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1);
   aic_outb(p, 0, SCSIRATE);
   if ( p->features & AHC_ULTRA2)
     aic_outb(p, 0, SCSIOFFSET);
@@ -8245,6 +8436,10 @@
     {
       printk("(scsi%d) Unable to allocate hardware SCB array; "
              "failing detection.\n", p->host_no);
+      aic_outb(p, 0, SIMODE1);
+#ifdef MODULE
+      enable_irq(p->irq);
+#endif
       p->irq = 0;
       return(0);
     }
@@ -8319,11 +8514,6 @@
   first_aic7xxx = p;
 
   /*
-   * Clear out any possible pending interrupts, again.
-   */
-  aic7xxx_clear_intstat(p);
-
-  /*
    * Allocate the first set of scbs for this controller.  This is to stream-
    * line code elsewhere in the driver.  If we have to check for the existence
    * of scbs in certain code sections, it slows things down.  However, as
@@ -8377,20 +8567,21 @@
       printk(KERN_INFO "(scsi%d) Resetting channel%s\n", p->host_no, channel);
     }
     
-    /*
-     * Some of the new Ultra2 chipsets need a longer delay after a chip
-     * reset than just the init setup creates, so we have to delay here
-     * before we go into a reset in order to make the chips happy.
-     */
-    if (p->features & AHC_ULTRA2)
-      mdelay(250);
     aic7xxx_reset_current_bus(p);
 
     /*
-     * Delay for the reset delay.
+     * Delay for the reset delay by setting the timer, this will delay
+     * future commands sent to any devices.
      */
-    if (!reset_delay)
-      aic7xxx_delay(AIC7XXX_RESET_DELAY);
+    p->flags |= AHC_RESET_DELAY;
+    for(i=0; i<MAX_TARGETS; i++)
+    {
+      p->dev_expires[i] = jiffies + (4 * HZ);
+      p->dev_timer_active |= (0x01 << i);
+    }
+    p->dev_timer.expires = p->dev_expires[p->scsi_id];
+    add_timer(&p->dev_timer);
+    p->dev_timer_active |= (0x01 << MAX_TARGETS);
   }
   else
   {
@@ -8400,11 +8591,6 @@
              "the no_reset\n", p->host_no);
       printk(KERN_INFO "(scsi%d) option unless you have a verifiable need "
              "for it.\n", p->host_no);
-      printk(KERN_INFO "(scsi%d) The no_reset option is known to break some "
-             "systems,\n", p->host_no);
-      printk(KERN_INFO "(scsi%d) and is not supported by the driver author\n",
-             p->host_no);
-      aic7xxx_delay(AIC7XXX_RESET_DELAY);
     }
   }
   
@@ -8430,10 +8616,23 @@
   {
     printk(KERN_WARNING "(scsi%d) Couldn't register IRQ %d, ignoring "
            "controller.\n", p->host_no, p->irq);
+    aic_outb(p, 0, SIMODE1);
+#ifdef MODULE
+    enable_irq(p->irq);
+#endif
     p->irq = 0;
     return (0);
   }
 
+  if(aic_inb(p, INTSTAT) & INT_PEND)
+    printk(INFO_LEAD "spurious interrupt during configuration, cleared.\n",
+      p->host_no, -1, -1 , -1);
+  aic7xxx_clear_intstat(p);
+
+#ifdef MODULE
+  enable_irq(p->irq);
+#endif
+
   unpause_sequencer(p, /* unpause_always */ TRUE);
 
   return (found);
@@ -9102,272 +9301,18 @@
   template->sg_tablesize = AIC7XXX_MAX_SG;
 
 
-#if defined(__i386__) || defined(__alpha__)
 #ifdef CONFIG_PCI
   /*
-   * PCI-bus chipset probe.
+   * PCI-bus probe.
    */
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92)
   if (pci_present())
-  {
-    if (pci_find_device(PCI_VENDOR_ID_INTEL,
-                        PCI_DEVICE_ID_INTEL_82450GX,
-                        NULL))
-      aic7xxx_no_probe = 1;
-    if (pci_find_device(PCI_VENDOR_ID_INTEL,
-                        PCI_DEVICE_ID_INTEL_82451NX,
-                        NULL))
-      aic7xxx_no_probe = 1;
-  }
 #else
-#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
   if (pcibios_present())
-  {
-    unsigned char pci_bus, pci_devfn;
-    if (!(pcibios_find_device(PCI_VENDOR_ID_INTEL,
-                              PCI_DEVICE_ID_INTEL_82450GX,
-                              0, &pci_bus, &pci_devfn)) )
-      aic7xxx_no_probe = 1;
-    if (!(pcibios_find_device(PCI_VENDOR_ID_INTEL,
-                              PCI_DEVICE_ID_INTEL_82451NX,
-                              0, &pci_bus, &pci_devfn)) )
-      aic7xxx_no_probe = 1;
-  }
-#endif /* LINUX_VERSION_CODE */
-#endif /* CONFIG_PCI */
-  /*
-   * EISA/VL-bus card signature probe.
-   */
-  slot = MINSLOT;
-  while ( (slot <= MAXSLOT) && 
-         !(aic7xxx_no_probe) )
+#endif
   {
-    base = SLOTBASE(slot) + MINREG;
-
-    if (check_region(base, MAXREG - MINREG))
-    {
-      /*
-       * Some other driver has staked a
-       * claim to this i/o region already.
-       */
-      slot++;
-      continue; /* back to the beginning of the for loop */
-    }
-    flags = 0;
-    type = aic7xxx_probe(slot, base + AHC_HID0, &flags);
-    if (type == -1)
-    {
-      slot++;
-      continue;
-    }
-    temp_p = kmalloc(sizeof(struct aic7xxx_host), GFP_ATOMIC);
-    if (temp_p == NULL)
-    {
-      printk(KERN_WARNING "aic7xxx: Unable to allocate device space.\n");
-      slot++;
-      continue; /* back to the beginning of the while loop */
-    }
-    /*
-     * Pause the card preserving the IRQ type.  Allow the operator
-     * to override the IRQ trigger.
-     */
-    if (aic7xxx_irq_trigger == 1)
-      hcntrl = IRQMS;  /* Level */
-    else if (aic7xxx_irq_trigger == 0)
-      hcntrl = 0;  /* Edge */
-    else
-      hcntrl = inb(base + HCNTRL) & IRQMS;  /* Default */
-    memset(temp_p, 0, sizeof(struct aic7xxx_host));
-    temp_p->unpause = hcntrl | INTEN;
-    temp_p->pause = hcntrl | PAUSE | INTEN;
-    temp_p->base = base;
-    temp_p->mbase = 0;
-    temp_p->maddr = 0;
-    temp_p->pci_bus = 0;
-    temp_p->pci_device_fn = slot;
-    aic_outb(temp_p, hcntrl | PAUSE, HCNTRL);
-    while( (aic_inb(temp_p, HCNTRL) & PAUSE) == 0 ) ;
-    if (aic7xxx_chip_reset(temp_p) == -1)
-      temp_p->irq = 0;
-    else
-      temp_p->irq = aic_inb(temp_p, INTDEF) & 0x0F;
-    temp_p->flags |= AHC_PAGESCBS;
-
-    switch (temp_p->irq)
-    {
-      case 9:
-      case 10:
-      case 11:
-      case 12:
-      case 14:
-      case 15:
-        break;
-
-      default:
-        printk(KERN_WARNING "aic7xxx: Host adapter uses unsupported IRQ "
-          "level %d, ignoring.\n", temp_p->irq);
-        kfree(temp_p);
-        slot++;
-        continue; /* back to the beginning of the while loop */
-    }
-
-    /*
-     * We are commited now, everything has been checked and this card
-     * has been found, now we just set it up
-     */
-
-    /*
-     * Insert our new struct into the list at the end
-     */
-    if (list_p == NULL)
-    {
-      list_p = current_p = temp_p;
-    }
-    else
-    {
-      current_p = list_p;
-      while (current_p->next != NULL)
-        current_p = current_p->next;
-      current_p->next = temp_p;
-    }
-
-    switch (type)
+    struct
     {
-      case 0:
-        temp_p->board_name_index = 2;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk("aic7xxx: <%s> at EISA %d\n",
-               board_names[2], slot);
-        /* FALLTHROUGH */
-      case 1:
-      {
-        temp_p->chip = AHC_AIC7770 | AHC_EISA;
-        temp_p->features |= AHC_AIC7770_FE;
-        temp_p->bios_control = aic_inb(temp_p, HA_274_BIOSCTRL);
-
-        /*
-         * Get the primary channel information.  Right now we don't
-         * do anything with this, but someday we will be able to inform
-         * the mid-level SCSI code which channel is primary.
-         */
-        if (temp_p->board_name_index == 0)
-        {
-          temp_p->board_name_index = 3;
-          if (aic7xxx_verbose & VERBOSE_PROBE2)
-            printk("aic7xxx: <%s> at EISA %d\n",
-                 board_names[3], slot);
-        }
-        if (temp_p->bios_control & CHANNEL_B_PRIMARY)
-        {
-          temp_p->flags |= AHC_CHANNEL_B_PRIMARY;
-        }
-
-        if ((temp_p->bios_control & BIOSMODE) == BIOSDISABLED)
-        {
-          temp_p->flags &= ~AHC_BIOS_ENABLED;
-        }
-        else
-        {
-          temp_p->flags &= ~AHC_USEDEFAULTS;
-          temp_p->flags |= AHC_BIOS_ENABLED;
-          if ( (temp_p->bios_control & 0x20) == 0 )
-          {
-            temp_p->bios_address = 0xcc000;
-            temp_p->bios_address += (0x4000 * (temp_p->bios_control & 0x07));
-          }
-          else
-          {
-            temp_p->bios_address = 0xd0000;
-            temp_p->bios_address += (0x8000 * (temp_p->bios_control & 0x06));
-          }
-        }
-        temp_p->adapter_control = aic_inb(temp_p, SCSICONF) << 8;
-        temp_p->adapter_control |= aic_inb(temp_p, SCSICONF + 1);
-        if (temp_p->features & AHC_WIDE)
-        {
-          temp_p->scsi_id = temp_p->adapter_control & HWSCSIID;
-          temp_p->scsi_id_b = temp_p->scsi_id;
-        }
-        else
-        {
-          temp_p->scsi_id = (temp_p->adapter_control >> 8) & HSCSIID;
-          temp_p->scsi_id_b = temp_p->adapter_control & HSCSIID;
-        }
-        aic7xxx_load_seeprom(temp_p, &sxfrctl1);
-        break;
-      }
-
-      case 2:
-      case 3:
-        temp_p->chip = AHC_AIC7770 | AHC_VL;
-        temp_p->features |= AHC_AIC7770_FE;
-        if (type == 2)
-          temp_p->flags |= AHC_BIOS_ENABLED;
-        else
-          temp_p->flags &= ~AHC_BIOS_ENABLED;
-        if (aic_inb(temp_p, SCSICONF) & TERM_ENB)
-          sxfrctl1 = STPWEN;
-        aic7xxx_load_seeprom(temp_p, &sxfrctl1);
-        temp_p->board_name_index = 4;
-        if (aic7xxx_verbose & VERBOSE_PROBE2)
-          printk("aic7xxx: <%s> at VLB %d\n",
-               board_names[2], slot);
-        switch( aic_inb(temp_p, STATUS_2840) & BIOS_SEL )
-        {
-          case 0x00:
-            temp_p->bios_address = 0xe0000;
-            break;
-          case 0x20:
-            temp_p->bios_address = 0xc8000;
-            break;
-          case 0x40:
-            temp_p->bios_address = 0xd0000;
-            break;
-          case 0x60:
-            temp_p->bios_address = 0xd8000;
-            break;
-          default:
-            break; /* can't get here */
-        }
-        break;
-
-      default:  /* Won't get here. */
-        break;
-    }
-    if (aic7xxx_verbose & VERBOSE_PROBE2)
-    {
-      printk(KERN_INFO "aic7xxx: BIOS %sabled, IO Port 0x%lx, IRQ %d (%s)\n",
-        (temp_p->flags & AHC_USEDEFAULTS) ? "dis" : "en", temp_p->base,
-        temp_p->irq,
-        (temp_p->pause & IRQMS) ? "level sensitive" : "edge triggered");
-      printk(KERN_INFO "aic7xxx: Extended translation %sabled.\n",
-             (temp_p->flags & AHC_EXTEND_TRANS_A) ? "en" : "dis");
-    }
-
-    /*
-     * Set the FIFO threshold and the bus off time.
-     */
-    hostconf = aic_inb(temp_p, HOSTCONF);
-    aic_outb(temp_p, hostconf & DFTHRSH, BUSSPD);
-    aic_outb(temp_p, (hostconf << 2) & BOFF, BUSTIME);
-    slot++;
-    found++;
-  }
-
-#endif /* defined(__i386__) || defined(__alpha__) */
-
-#ifdef CONFIG_PCI
-  /*
-   * PCI-bus probe.
-   */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92)
-  if (pci_present())
-#else
-  if (pcibios_present())
-#endif
-  {
-    struct
-    {
       unsigned short      vendor_id;
       unsigned short      device_id;
       ahc_chip            chip;
@@ -9485,7 +9430,7 @@
        AHC_AIC7896_FE,                                      25,
        32, C56_66 },
       {PCI_VENDOR_ID_ADAPTEC, PCI_DEVICE_ID_ADAPTEC_1480A, AHC_AIC7860,
-       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED,
+       AHC_PAGESCBS | AHC_NEWEEPROM_FMT | AHC_BIOS_ENABLED | AHC_NO_STPWR,
        AHC_AIC7860_FE,                                      26,
        32, C46 },
       {PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_7892A, AHC_AIC7892,
@@ -9594,10 +9539,11 @@
           if ( temp_p == NULL )
             continue;
           if (aic7xxx_verbose & VERBOSE_PROBE2)
-            printk("aic7xxx: <%s> at PCI %d/%d\n", 
+            printk("aic7xxx: <%s> at PCI %d/%d/%d\n", 
               board_names[aic_pdevs[i].board_name_index],
-              PCI_SLOT(temp_p->pdev->devfn),
-              PCI_FUNC(temp_p->pdev->devfn));
+              temp_p->pci_bus,
+              PCI_SLOT(temp_p->pci_device_fn),
+              PCI_FUNC(temp_p->pci_device_fn));
           pci_read_config_word(pdev, PCI_COMMAND, &command);
           if (aic7xxx_verbose & VERBOSE_PROBE2)
           {
@@ -9653,8 +9599,9 @@
           if ( temp_p == NULL )
             continue;
           if (aic7xxx_verbose & VERBOSE_PROBE2)
-            printk("aic7xxx: <%s> at PCI %d/%d\n", 
+            printk("aic7xxx: <%s> at PCI %d/%d/%d\n", 
               board_names[aic_pdevs[i].board_name_index],
+              temp_p->pci_bus,
               PCI_SLOT(temp_p->pci_device_fn),
               PCI_FUNC(temp_p->pci_device_fn));
           pcibios_read_config_word(pci_bus, pci_devfn, PCI_COMMAND, &command);
@@ -9684,14 +9631,28 @@
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
 #endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
 
+          if(check_region(temp_p->base, MAXREG - MINREG))
+          {
+            printk("aic7xxx: <%s> at PCI %d/%d/%d\n", 
+              board_names[aic_pdevs[i].board_name_index],
+              temp_p->pci_bus,
+              PCI_SLOT(temp_p->pci_device_fn),
+              PCI_FUNC(temp_p->pci_device_fn));
+            printk("aic7xxx: I/O ports already in use, ignoring.\n");
+            kfree(temp_p);
+            temp_p = NULL;
+            continue;
+          }
+
           temp_p->unpause = INTEN;
           temp_p->pause = temp_p->unpause | PAUSE;
           if ( ((temp_p->base == 0) &&
                 (temp_p->mbase == 0)) ||
                (temp_p->irq == 0) )
           {
-            printk("aic7xxx: <%s> at PCI %d/%d\n", 
+            printk("aic7xxx: <%s> at PCI %d/%d/%d\n", 
               board_names[aic_pdevs[i].board_name_index],
+              temp_p->pci_bus,
               PCI_SLOT(temp_p->pci_device_fn),
               PCI_FUNC(temp_p->pci_device_fn));
             printk("aic7xxx: Controller disabled by BIOS, ignoring.\n");
@@ -9726,8 +9687,9 @@
                 /*
                  * OK.....we failed our test....go back to programmed I/O
                  */
-                printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d\n", 
+                printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d/%d\n", 
                   board_names[aic_pdevs[i].board_name_index],
+                  temp_p->pci_bus,
                   PCI_SLOT(temp_p->pci_device_fn),
                   PCI_FUNC(temp_p->pci_device_fn));
                 printk(KERN_INFO "aic7xxx: MMAPed I/O failed, reverting to "
@@ -9744,6 +9706,11 @@
 #endif
 
           /*
+           * Lock out other contenders for our i/o space.
+           */
+          request_region(temp_p->base, MAXREG - MINREG, "aic7xxx");
+
+          /*
            * We HAVE to make sure the first pause_sequencer() and all other
            * subsequent I/O that isn't PCI config space I/O takes place
            * after the MMAPed I/O region is configured and tested.  The
@@ -9779,6 +9746,7 @@
 
           if (aic7xxx_chip_reset(temp_p) == -1)
           {
+            release_region(temp_p->base, MAXREG - MINREG);
             kfree(temp_p);
             temp_p = NULL;
             continue;
@@ -10009,8 +9977,9 @@
                 }
                 else if (aic_inb(temp_p, DSCOMMAND0) & RAMPSM_ULTRA2)
                 {
-                  printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d\n", 
+                  printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d/%d\n", 
                     board_names[aic_pdevs[i].board_name_index],
+                    temp_p->pci_bus,
                     PCI_SLOT(temp_p->pci_device_fn),
                     PCI_FUNC(temp_p->pci_device_fn));
                   printk("aic7xxx: external SCB RAM detected, "
@@ -10027,8 +9996,9 @@
                 }
                 else if (devconfig & RAMPSM)
                 {
-                  printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d\n", 
+                  printk(KERN_INFO "aic7xxx: <%s> at PCI %d/%d/%d\n", 
                     board_names[aic_pdevs[i].board_name_index],
+                    temp_p->pci_bus,
                     PCI_SLOT(temp_p->pci_device_fn),
                     PCI_FUNC(temp_p->pci_device_fn));
                   printk("aic7xxx: external SCB RAM detected, "
@@ -10093,6 +10063,235 @@
     } /* for PCI_DEVICES */
   } /* PCI BIOS present */
 #endif CONFIG_PCI
+
+#if defined(__i386__) || defined(__alpha__)
+  /*
+   * EISA/VL-bus card signature probe.
+   */
+  slot = MINSLOT;
+  while ( (slot <= MAXSLOT) && 
+         !(aic7xxx_no_probe) )
+  {
+    base = SLOTBASE(slot) + MINREG;
+
+    if (check_region(base, MAXREG - MINREG))
+    {
+      /*
+       * Some other driver has staked a
+       * claim to this i/o region already.
+       */
+      slot++;
+      continue; /* back to the beginning of the for loop */
+    }
+    flags = 0;
+    type = aic7xxx_probe(slot, base + AHC_HID0, &flags);
+    if (type == -1)
+    {
+      slot++;
+      continue;
+    }
+    temp_p = kmalloc(sizeof(struct aic7xxx_host), GFP_ATOMIC);
+    if (temp_p == NULL)
+    {
+      printk(KERN_WARNING "aic7xxx: Unable to allocate device space.\n");
+      slot++;
+      continue; /* back to the beginning of the while loop */
+    }
+    /*
+     * Lock out other contenders for our i/o space.
+     */
+    request_region(base, MAXREG - MINREG, "aic7xxx");
+
+    /*
+     * Pause the card preserving the IRQ type.  Allow the operator
+     * to override the IRQ trigger.
+     */
+    if (aic7xxx_irq_trigger == 1)
+      hcntrl = IRQMS;  /* Level */
+    else if (aic7xxx_irq_trigger == 0)
+      hcntrl = 0;  /* Edge */
+    else
+      hcntrl = inb(base + HCNTRL) & IRQMS;  /* Default */
+    memset(temp_p, 0, sizeof(struct aic7xxx_host));
+    temp_p->unpause = hcntrl | INTEN;
+    temp_p->pause = hcntrl | PAUSE | INTEN;
+    temp_p->base = base;
+    temp_p->mbase = 0;
+    temp_p->maddr = 0;
+    temp_p->pci_bus = 0;
+    temp_p->pci_device_fn = slot;
+    aic_outb(temp_p, hcntrl | PAUSE, HCNTRL);
+    while( (aic_inb(temp_p, HCNTRL) & PAUSE) == 0 ) ;
+    if (aic7xxx_chip_reset(temp_p) == -1)
+      temp_p->irq = 0;
+    else
+      temp_p->irq = aic_inb(temp_p, INTDEF) & 0x0F;
+    temp_p->flags |= AHC_PAGESCBS;
+
+    switch (temp_p->irq)
+    {
+      case 9:
+      case 10:
+      case 11:
+      case 12:
+      case 14:
+      case 15:
+        break;
+
+      default:
+        printk(KERN_WARNING "aic7xxx: Host adapter uses unsupported IRQ "
+          "level %d, ignoring.\n", temp_p->irq);
+        kfree(temp_p);
+        release_region(base, MAXREG - MINREG);
+        slot++;
+        continue; /* back to the beginning of the while loop */
+    }
+
+    /*
+     * We are commited now, everything has been checked and this card
+     * has been found, now we just set it up
+     */
+
+    /*
+     * Insert our new struct into the list at the end
+     */
+    if (list_p == NULL)
+    {
+      list_p = current_p = temp_p;
+    }
+    else
+    {
+      current_p = list_p;
+      while (current_p->next != NULL)
+        current_p = current_p->next;
+      current_p->next = temp_p;
+    }
+
+    switch (type)
+    {
+      case 0:
+        temp_p->board_name_index = 2;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk("aic7xxx: <%s> at EISA %d\n",
+               board_names[2], slot);
+        /* FALLTHROUGH */
+      case 1:
+      {
+        temp_p->chip = AHC_AIC7770 | AHC_EISA;
+        temp_p->features |= AHC_AIC7770_FE;
+        temp_p->bios_control = aic_inb(temp_p, HA_274_BIOSCTRL);
+
+        /*
+         * Get the primary channel information.  Right now we don't
+         * do anything with this, but someday we will be able to inform
+         * the mid-level SCSI code which channel is primary.
+         */
+        if (temp_p->board_name_index == 0)
+        {
+          temp_p->board_name_index = 3;
+          if (aic7xxx_verbose & VERBOSE_PROBE2)
+            printk("aic7xxx: <%s> at EISA %d\n",
+                 board_names[3], slot);
+        }
+        if (temp_p->bios_control & CHANNEL_B_PRIMARY)
+        {
+          temp_p->flags |= AHC_CHANNEL_B_PRIMARY;
+        }
+
+        if ((temp_p->bios_control & BIOSMODE) == BIOSDISABLED)
+        {
+          temp_p->flags &= ~AHC_BIOS_ENABLED;
+        }
+        else
+        {
+          temp_p->flags &= ~AHC_USEDEFAULTS;
+          temp_p->flags |= AHC_BIOS_ENABLED;
+          if ( (temp_p->bios_control & 0x20) == 0 )
+          {
+            temp_p->bios_address = 0xcc000;
+            temp_p->bios_address += (0x4000 * (temp_p->bios_control & 0x07));
+          }
+          else
+          {
+            temp_p->bios_address = 0xd0000;
+            temp_p->bios_address += (0x8000 * (temp_p->bios_control & 0x06));
+          }
+        }
+        temp_p->adapter_control = aic_inb(temp_p, SCSICONF) << 8;
+        temp_p->adapter_control |= aic_inb(temp_p, SCSICONF + 1);
+        if (temp_p->features & AHC_WIDE)
+        {
+          temp_p->scsi_id = temp_p->adapter_control & HWSCSIID;
+          temp_p->scsi_id_b = temp_p->scsi_id;
+        }
+        else
+        {
+          temp_p->scsi_id = (temp_p->adapter_control >> 8) & HSCSIID;
+          temp_p->scsi_id_b = temp_p->adapter_control & HSCSIID;
+        }
+        aic7xxx_load_seeprom(temp_p, &sxfrctl1);
+        break;
+      }
+
+      case 2:
+      case 3:
+        temp_p->chip = AHC_AIC7770 | AHC_VL;
+        temp_p->features |= AHC_AIC7770_FE;
+        if (type == 2)
+          temp_p->flags |= AHC_BIOS_ENABLED;
+        else
+          temp_p->flags &= ~AHC_BIOS_ENABLED;
+        if (aic_inb(temp_p, SCSICONF) & TERM_ENB)
+          sxfrctl1 = STPWEN;
+        aic7xxx_load_seeprom(temp_p, &sxfrctl1);
+        temp_p->board_name_index = 4;
+        if (aic7xxx_verbose & VERBOSE_PROBE2)
+          printk("aic7xxx: <%s> at VLB %d\n",
+               board_names[2], slot);
+        switch( aic_inb(temp_p, STATUS_2840) & BIOS_SEL )
+        {
+          case 0x00:
+            temp_p->bios_address = 0xe0000;
+            break;
+          case 0x20:
+            temp_p->bios_address = 0xc8000;
+            break;
+          case 0x40:
+            temp_p->bios_address = 0xd0000;
+            break;
+          case 0x60:
+            temp_p->bios_address = 0xd8000;
+            break;
+          default:
+            break; /* can't get here */
+        }
+        break;
+
+      default:  /* Won't get here. */
+        break;
+    }
+    if (aic7xxx_verbose & VERBOSE_PROBE2)
+    {
+      printk(KERN_INFO "aic7xxx: BIOS %sabled, IO Port 0x%lx, IRQ %d (%s)\n",
+        (temp_p->flags & AHC_USEDEFAULTS) ? "dis" : "en", temp_p->base,
+        temp_p->irq,
+        (temp_p->pause & IRQMS) ? "level sensitive" : "edge triggered");
+      printk(KERN_INFO "aic7xxx: Extended translation %sabled.\n",
+             (temp_p->flags & AHC_EXTEND_TRANS_A) ? "en" : "dis");
+    }
+
+    /*
+     * Set the FIFO threshold and the bus off time.
+     */
+    hostconf = aic_inb(temp_p, HOSTCONF);
+    aic_outb(temp_p, hostconf & DFTHRSH, BUSSPD);
+    aic_outb(temp_p, (hostconf << 2) & BOFF, BUSTIME);
+    slot++;
+    found++;
+  }
+
+#endif /* defined(__i386__) || defined(__alpha__) */
+
   /*
    * Now, we re-order the probed devices by BIOS address and BUS class.
    * In general, we follow this algorithm to make the adapters show up
@@ -10393,7 +10592,7 @@
          * instead of slowing down if those exist.  That's hard to do with simple
          * checksums though.
          */
-        if(aic7xxx_verbose & VERBOSE_NEGOTIATION) 
+        if(aic7xxx_verbose & VERBOSE_NEGOTIATION2) 
         {
           printk(INFO_LEAD "reducing SCSI transfer speed due to Domain "
                  "validation failure.\n", p->host_no, CTL_OF_CMD(cmd));
@@ -10424,7 +10623,7 @@
       }
       else
       {
-        if(aic7xxx_verbose & VERBOSE_NEGOTIATION) 
+        if(aic7xxx_verbose & VERBOSE_NEGOTIATION2) 
         {
           printk(INFO_LEAD "Performing Domain validation.\n",
                  p->host_no, CTL_OF_CMD(cmd));
@@ -10449,7 +10648,7 @@
     } 
     else
     {
-      if( (aic7xxx_verbose & VERBOSE_NEGOTIATION) &&
+      if( (aic7xxx_verbose & VERBOSE_NEGOTIATION2) &&
           (p->needdv & (1<<tindex)) )
       {
         printk(INFO_LEAD "Successfully completed Domain validation.\n",
@@ -11993,7 +12192,7 @@
       break;
     case AHC_PCI:
     default:
-      printk("PCI %d/%d.\n", PCI_SLOT(p->pci_device_fn),
+      printk("PCI %d/%d/%d.\n", p->pci_bus, PCI_SLOT(p->pci_device_fn),
              PCI_FUNC(p->pci_device_fn));
       break;
   }
Index: oldkernel/linux/drivers/scsi/aic7xxx_proc.c
diff -u linux/drivers/scsi/aic7xxx_proc.c:1.1.1.1 linux/drivers/scsi/aic7xxx_proc.c:1.2
--- linux/drivers/scsi/aic7xxx_proc.c:1.1.1.1	Wed May 31 12:33:51 2000
+++ linux/drivers/scsi/aic7xxx_proc.c	Thu Jun  1 15:16:16 2000
@@ -178,7 +178,7 @@
   size += sprintf(BLS, "           SCSI Adapter: %s\n",
       board_names[p->board_name_index]);
   if (p->flags & AHC_TWIN)
-    size += sprintf(BLS, "                         Twin Channel\n");
+    size += sprintf(BLS, "                         Twin Channel Controller ");
   else
   {
     char *channel = "";
@@ -209,9 +209,22 @@
       ultra = "Ultra-2 LVD/SE ";
     else if (p->features & AHC_ULTRA)
       ultra = "Ultra ";
-    size += sprintf(BLS, "                           %s%sController%s\n",
+    size += sprintf(BLS, "                           %s%sController%s ",
       ultra, wide, channel);
   }
+  switch(p->chip & ~AHC_CHIPID_MASK)
+  {
+    case AHC_VL:
+      size += sprintf(BLS, "at VLB slot %d\n", p->pci_device_fn);
+      break;
+    case AHC_EISA:
+      size += sprintf(BLS, "at EISA slot %d\n", p->pci_device_fn);
+      break;
+    default:
+      size += sprintf(BLS, "at PCI %d/%d/%d\n", p->pci_bus,
+        PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn));
+      break;
+  }
   if( !(p->maddr) )
   {
     size += sprintf(BLS, "    Programmed I/O Base: %lx\n", p->base);
@@ -223,11 +236,6 @@
   if( (p->chip & (AHC_VL | AHC_EISA)) )
   {
     size += sprintf(BLS, "    BIOS Memory Address: 0x%08x\n", p->bios_address);
-  }
-  if( p->chip & AHC_PCI )
-  {
-    size += sprintf(BLS, "    PCI Bus 0x%02x Device 0x%02x\n", p->pci_bus,
-              p->pci_device_fn);
   }
   size += sprintf(BLS, " Adapter SEEPROM Config: %s\n",
           (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." :
Index: oldkernel/linux/drivers/scsi/aic7xxx_reg.h
diff -u linux/drivers/scsi/aic7xxx_reg.h:1.1.1.1 linux/drivers/scsi/aic7xxx_reg.h:1.2
--- linux/drivers/scsi/aic7xxx_reg.h:1.1.1.1	Wed May 31 12:33:51 2000
+++ linux/drivers/scsi/aic7xxx_reg.h	Thu Jun  1 15:16:16 2000
@@ -188,8 +188,8 @@
 #define		BRDRW           	0x04
 #define		BRDRW_ULTRA2    	0x02
 #define		BRDCTL1         	0x02
-#define		BRDSTB_ULTRA2   	0x01
 #define		BRDCTL0         	0x01
+#define		BRDSTB_ULTRA2   	0x01
 
 #define	SEECTL          		0x1e
 #define		EXTARBACK       	0x80
@@ -402,7 +402,7 @@
 #define		RESIDUAL        	0x81
 #define		BAD_STATUS      	0x71
 #define		REJECT_MSG      	0x61
-#define		ABORT_REQUESTED 	0x51
+#define		WIDE_RESIDUE    	0x51
 #define		EXTENDED_MSG    	0x41
 #define		NO_MATCH        	0x31
 #define		NO_IDENT        	0x21
@@ -465,6 +465,8 @@
 #define		TARGCRCENDEN    	0x08
 #define		TARGCRCCNTEN    	0x04
 
+#define	QOUTCNT         		0x9e
+
 #define	SCSIPHASE       		0x9e
 #define		SP_STATUS       	0x20
 #define		SP_COMMAND      	0x10
@@ -473,8 +475,6 @@
 #define		SP_DATA_IN      	0x02
 #define		SP_DATA_OUT     	0x01
 
-#define	QOUTCNT         		0x9e
-
 #define	SFUNCT          		0x9f
 #define		ALT_MODE        	0x80
 
@@ -595,8 +595,8 @@
 #define		RD_DFTHRSH_63   	0x03
 #define		RD_DFTHRSH_50   	0x02
 #define		RD_DFTHRSH_25   	0x01
-#define		WR_DFTHRSH_MIN  	0x00
 #define		RD_DFTHRSH_MIN  	0x00
+#define		WR_DFTHRSH_MIN  	0x00
 
 #define	SG_CACHEPTR     		0xfc
 #define		SG_USER_DATA    	0xfc
@@ -604,18 +604,18 @@
 #define		LAST_SEG_DONE   	0x01
 
 
+#define	CMD_GROUP_CODE_SHIFT	0x05
+#define	BUS_8_BIT	0x00
+#define	QOUTFIFO_OFFSET	0x01
+#define	CCSGRAM_MAXSEGS	0x10
 #define	CMD_GROUP2_BYTE_DELTA	0xfa
 #define	MAX_OFFSET_8BIT	0x0f
 #define	BUS_16_BIT	0x01
 #define	QINFIFO_OFFSET	0x02
 #define	CMD_GROUP5_BYTE_DELTA	0x0b
-#define	CMD_GROUP_CODE_SHIFT	0x05
 #define	MAX_OFFSET_ULTRA2	0x7f
 #define	MAX_OFFSET_16BIT	0x08
-#define	BUS_8_BIT	0x00
-#define	QOUTFIFO_OFFSET	0x01
 #define	UNTAGGEDSCB_OFFSET	0x00
-#define	CCSGRAM_MAXSEGS	0x10
 #define	SCB_LIST_NULL	0xff
 #define	SG_SIZEOF	0x08
 #define	CMD_GROUP4_BYTE_DELTA	0x04
Index: oldkernel/linux/drivers/scsi/aic7xxx_seq.c
diff -u linux/drivers/scsi/aic7xxx_seq.c:1.1.1.1 linux/drivers/scsi/aic7xxx_seq.c:1.2
--- linux/drivers/scsi/aic7xxx_seq.c:1.1.1.1	Wed May 31 12:33:51 2000
+++ linux/drivers/scsi/aic7xxx_seq.c	Thu Jun  1 15:16:16 2000
@@ -26,12 +26,12 @@
 	0x00, 0x4d, 0x12, 0x70,
 	0x01, 0x4e, 0x9c, 0x18,
 	0xbf, 0x60, 0xc0, 0x08,
-	0x00, 0x6a, 0xa8, 0x5c,
+	0x00, 0x6a, 0xbe, 0x5c,
 	0xff, 0x4e, 0xc8, 0x18,
-	0x02, 0x6a, 0xbe, 0x5b,
+	0x02, 0x6a, 0xd4, 0x5b,
 	0xff, 0x52, 0x20, 0x09,
 	0x0d, 0x6a, 0x6a, 0x00,
-	0x00, 0x52, 0x34, 0x5c,
+	0x00, 0x52, 0x4a, 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, 0x24, 0x5c,
+	0x49, 0x6a, 0x3a, 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, 0x9a, 0x5c,
+	0x00, 0x65, 0xb0, 0x5c,
 	0x40, 0x51, 0xf0, 0x78,
 	0xe4, 0x6a, 0x06, 0x00,
 	0x08, 0x01, 0x02, 0x00,
-	0x04, 0x6a, 0x56, 0x5b,
+	0x04, 0x6a, 0x6c, 0x5b,
 	0x01, 0x50, 0xa0, 0x18,
 	0x00, 0x50, 0xf6, 0xe0,
 	0xff, 0x6a, 0xa0, 0x08,
@@ -147,13 +147,13 @@
 	0x08, 0x6a, 0x66, 0x58,
 	0x80, 0x6a, 0x68, 0x00,
 	0x80, 0x36, 0x6c, 0x00,
-	0x00, 0x65, 0x08, 0x5c,
+	0x00, 0x65, 0x1e, 0x5c,
 	0xff, 0x3d, 0xc8, 0x08,
 	0xbf, 0x64, 0x5a, 0x79,
-	0x80, 0x64, 0x20, 0x72,
-	0xa0, 0x64, 0x50, 0x72,
-	0xc0, 0x64, 0x48, 0x72,
-	0xe0, 0x64, 0x90, 0x72,
+	0x80, 0x64, 0x22, 0x72,
+	0xa0, 0x64, 0x52, 0x72,
+	0xc0, 0x64, 0x4a, 0x72,
+	0xe0, 0x64, 0x92, 0x72,
 	0x01, 0x6a, 0x22, 0x01,
 	0x00, 0x65, 0x22, 0x41,
 	0xf7, 0x11, 0x22, 0x08,
@@ -173,13 +173,13 @@
 	0x03, 0xa9, 0x18, 0x31,
 	0x03, 0xa9, 0x10, 0x30,
 	0x08, 0x6a, 0xcc, 0x00,
-	0xa9, 0x6a, 0x1e, 0x5c,
+	0xa9, 0x6a, 0x34, 0x5c,
 	0x00, 0x65, 0x7a, 0x41,
 	0xa8, 0x6a, 0x6a, 0x00,
 	0x79, 0x6a, 0x6a, 0x00,
 	0x40, 0x3d, 0x62, 0x69,
 	0x04, 0x35, 0x6a, 0x00,
-	0x00, 0x65, 0x78, 0x5b,
+	0x00, 0x65, 0x8e, 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, 0x16, 0x5c,
-	0x00, 0x65, 0x10, 0x5c,
+	0xac, 0x6a, 0x2c, 0x5c,
+	0x00, 0x65, 0x26, 0x5c,
 	0x38, 0x6a, 0xcc, 0x00,
-	0xa3, 0x6a, 0x1a, 0x5c,
+	0xa3, 0x6a, 0x30, 0x5c,
 	0xff, 0x38, 0x8a, 0x69,
 	0x80, 0x02, 0x04, 0x00,
 	0xe7, 0x35, 0x6a, 0x08,
@@ -199,51 +199,52 @@
 	0xff, 0x6a, 0x10, 0x00,
 	0xff, 0x6a, 0x12, 0x00,
 	0xff, 0x6a, 0x14, 0x00,
-	0x01, 0x38, 0x8e, 0x61,
+	0x01, 0x38, 0x90, 0x61,
 	0xbf, 0x35, 0x6a, 0x08,
+	0x02, 0x6a, 0xf8, 0x01,
 	0xff, 0x69, 0xca, 0x08,
 	0xff, 0x35, 0x26, 0x09,
-	0x04, 0x0b, 0x92, 0x69,
-	0x04, 0x0b, 0x9e, 0x69,
-	0x10, 0x0c, 0x94, 0x79,
-	0x04, 0x0b, 0x9c, 0x69,
+	0x04, 0x0b, 0x94, 0x69,
+	0x04, 0x0b, 0xa0, 0x69,
+	0x10, 0x0c, 0x96, 0x79,
+	0x04, 0x0b, 0xa0, 0x69,
 	0xff, 0x6a, 0xca, 0x08,
-	0x00, 0x35, 0x60, 0x5b,
-	0x80, 0x02, 0xf2, 0x69,
-	0xff, 0x65, 0xe2, 0x79,
+	0x00, 0x35, 0x76, 0x5b,
+	0x80, 0x02, 0xf4, 0x69,
+	0xff, 0x65, 0xe4, 0x79,
 	0xff, 0x38, 0x70, 0x18,
-	0xff, 0x38, 0xe2, 0x79,
-	0x80, 0xea, 0xbe, 0x61,
+	0xff, 0x38, 0xe4, 0x79,
+	0x80, 0xea, 0xc0, 0x61,
 	0xef, 0x38, 0xc8, 0x18,
 	0x80, 0x6a, 0xc8, 0x00,
-	0x00, 0x65, 0xb0, 0x49,
+	0x00, 0x65, 0xb2, 0x49,
 	0x33, 0x38, 0xc8, 0x28,
 	0xff, 0x64, 0xd0, 0x09,
 	0x04, 0x39, 0xc0, 0x31,
 	0x09, 0x6a, 0xd6, 0x01,
-	0x80, 0xeb, 0xb6, 0x79,
+	0x80, 0xeb, 0xb8, 0x79,
 	0xf7, 0xeb, 0xd6, 0x09,
-	0x08, 0xeb, 0xba, 0x69,
+	0x08, 0xeb, 0xbc, 0x69,
 	0x01, 0x6a, 0xd6, 0x01,
 	0x08, 0xe9, 0x10, 0x31,
 	0x03, 0x8c, 0x10, 0x30,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x39, 0x6a, 0x1c, 0x5c,
+	0x39, 0x6a, 0x32, 0x5c,
 	0x08, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0x0d, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0x9a, 0x5c,
-	0x88, 0x6a, 0x8a, 0x5c,
-	0x00, 0x65, 0x10, 0x5c,
+	0x00, 0x65, 0xb0, 0x5c,
+	0x88, 0x6a, 0xa0, 0x5c,
+	0x00, 0x65, 0x26, 0x5c,
 	0xff, 0x6a, 0xc8, 0x08,
 	0x08, 0x39, 0x72, 0x18,
 	0x00, 0x3a, 0x74, 0x20,
-	0x01, 0x0c, 0xda, 0x79,
+	0x01, 0x0c, 0xdc, 0x79,
 	0x10, 0x0c, 0x7a, 0x79,
 	0xff, 0x35, 0x26, 0x09,
-	0x04, 0x0b, 0xe0, 0x69,
-	0x00, 0x65, 0xfa, 0x59,
+	0x04, 0x0b, 0xe2, 0x69,
+	0x00, 0x65, 0xfc, 0x59,
 	0x03, 0x08, 0x52, 0x31,
 	0xff, 0x38, 0x50, 0x09,
 	0xff, 0x08, 0x52, 0x09,
@@ -251,275 +252,285 @@
 	0xff, 0x0a, 0x56, 0x09,
 	0xff, 0x38, 0x50, 0x09,
 	0x00, 0x65, 0x22, 0x41,
-	0x00, 0x65, 0xfa, 0x59,
+	0x00, 0x65, 0xfc, 0x59,
 	0x7f, 0x02, 0x04, 0x08,
 	0xe1, 0x6a, 0x22, 0x01,
 	0x00, 0x65, 0x22, 0x41,
-	0x04, 0x93, 0x10, 0x6a,
+	0x04, 0x93, 0x12, 0x6a,
 	0xdf, 0x93, 0x26, 0x09,
-	0x20, 0x93, 0xfe, 0x69,
+	0x20, 0x93, 0x00, 0x6a,
 	0x02, 0x93, 0x26, 0x01,
-	0x01, 0x94, 0x00, 0x7a,
-	0x01, 0x94, 0x00, 0x7a,
-	0x01, 0x94, 0x00, 0x7a,
-	0x01, 0x94, 0x00, 0x7a,
-	0x01, 0x94, 0x00, 0x7a,
-	0x01, 0x94, 0x00, 0x7a,
-	0x10, 0x94, 0x0e, 0x6a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x01, 0x94, 0x02, 0x7a,
+	0x10, 0x94, 0x10, 0x6a,
 	0xf7, 0x93, 0x26, 0x09,
-	0x08, 0x93, 0x12, 0x6a,
+	0x08, 0x93, 0x14, 0x6a,
 	0xdf, 0x93, 0x26, 0x09,
-	0x20, 0x93, 0x16, 0x6a,
+	0x20, 0x93, 0x18, 0x6a,
 	0x03, 0x08, 0x52, 0x31,
 	0xff, 0x38, 0x50, 0x09,
 	0x12, 0x01, 0x02, 0x00,
 	0xff, 0x6a, 0xd4, 0x0c,
-	0x00, 0x65, 0x78, 0x5b,
+	0x00, 0x65, 0x8e, 0x5b,
 	0x05, 0xb4, 0x10, 0x31,
 	0x02, 0x6a, 0x1a, 0x31,
 	0x03, 0x8c, 0x10, 0x30,
 	0x88, 0x6a, 0xcc, 0x00,
-	0xb4, 0x6a, 0x1a, 0x5c,
+	0xb4, 0x6a, 0x30, 0x5c,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
-	0x00, 0x65, 0x10, 0x5c,
-	0x3d, 0x6a, 0x60, 0x5b,
+	0x00, 0x65, 0x26, 0x5c,
+	0x3d, 0x6a, 0x76, 0x5b,
 	0xac, 0x6a, 0x26, 0x01,
-	0x04, 0x0b, 0x36, 0x6a,
-	0x01, 0x0b, 0x3c, 0x6a,
-	0x10, 0x0c, 0x38, 0x7a,
+	0x04, 0x0b, 0x38, 0x6a,
+	0x04, 0x0b, 0x3e, 0x6a,
+	0x10, 0x0c, 0x3a, 0x7a,
 	0xf7, 0x93, 0x26, 0x09,
-	0x08, 0x93, 0x3e, 0x6a,
+	0x08, 0x93, 0x40, 0x6a,
 	0xdf, 0x93, 0x26, 0x09,
-	0x20, 0x93, 0x42, 0x6a,
+	0x20, 0x93, 0x44, 0x6a,
 	0x12, 0x01, 0x02, 0x00,
 	0x00, 0x65, 0x22, 0x41,
-	0x00, 0x65, 0x78, 0x5b,
+	0x00, 0x65, 0x8e, 0x5b,
 	0xff, 0x06, 0x44, 0x09,
 	0x00, 0x65, 0x22, 0x41,
 	0x10, 0x3d, 0x06, 0x00,
 	0xff, 0x34, 0xca, 0x08,
-	0x80, 0x65, 0x74, 0x62,
+	0x80, 0x65, 0x76, 0x62,
 	0x0f, 0xa1, 0xca, 0x08,
 	0x07, 0xa1, 0xca, 0x08,
 	0x40, 0xa0, 0xc8, 0x08,
 	0x00, 0x65, 0xca, 0x00,
 	0x80, 0x65, 0xca, 0x00,
-	0x80, 0xa0, 0x64, 0x7a,
+	0x80, 0xa0, 0x66, 0x7a,
 	0xff, 0x65, 0x0c, 0x08,
-	0x00, 0x65, 0x76, 0x42,
-	0x20, 0xa0, 0x7c, 0x7a,
+	0x00, 0x65, 0x78, 0x42,
+	0x20, 0xa0, 0x7e, 0x7a,
 	0xff, 0x65, 0x0c, 0x08,
-	0x00, 0x65, 0x08, 0x5c,
-	0xa0, 0x3d, 0x84, 0x62,
+	0x00, 0x65, 0x1e, 0x5c,
+	0xa0, 0x3d, 0x86, 0x62,
 	0x23, 0xa0, 0x0c, 0x08,
-	0x00, 0x65, 0x08, 0x5c,
-	0xa0, 0x3d, 0x84, 0x62,
-	0x00, 0xb9, 0x7c, 0x42,
-	0xff, 0x65, 0x7c, 0x62,
+	0x00, 0x65, 0x1e, 0x5c,
+	0xa0, 0x3d, 0x86, 0x62,
+	0x00, 0xb9, 0x7e, 0x42,
+	0xff, 0x65, 0x7e, 0x62,
 	0xa1, 0x6a, 0x22, 0x01,
 	0xff, 0x6a, 0xd4, 0x08,
-	0x10, 0x51, 0x84, 0x72,
+	0x10, 0x51, 0x86, 0x72,
 	0x40, 0x6a, 0x18, 0x00,
 	0xff, 0x65, 0x0c, 0x08,
-	0x00, 0x65, 0x08, 0x5c,
-	0xa0, 0x3d, 0x4e, 0x72,
+	0x00, 0x65, 0x1e, 0x5c,
+	0xa0, 0x3d, 0x50, 0x72,
 	0x40, 0x6a, 0x18, 0x00,
 	0xff, 0x34, 0xa6, 0x08,
-	0x80, 0x34, 0x8c, 0x62,
+	0x80, 0x34, 0x8e, 0x62,
 	0x7f, 0xa0, 0x40, 0x09,
 	0x08, 0x6a, 0x68, 0x00,
 	0x00, 0x65, 0x22, 0x41,
-	0x64, 0x6a, 0x50, 0x5b,
-	0x80, 0x64, 0x00, 0x6b,
-	0x04, 0x64, 0xe2, 0x72,
-	0x02, 0x64, 0xe8, 0x72,
-	0x00, 0x6a, 0xaa, 0x72,
-	0x03, 0x64, 0xfc, 0x72,
-	0x01, 0x64, 0xde, 0x72,
-	0x07, 0x64, 0x3e, 0x73,
-	0x08, 0x64, 0xa6, 0x72,
+	0x64, 0x6a, 0x66, 0x5b,
+	0x80, 0x64, 0x04, 0x6b,
+	0x04, 0x64, 0xe6, 0x72,
+	0x02, 0x64, 0xec, 0x72,
+	0x00, 0x6a, 0xae, 0x72,
+	0x03, 0x64, 0x00, 0x73,
+	0x01, 0x64, 0xe2, 0x72,
+	0x07, 0x64, 0x42, 0x73,
+	0x08, 0x64, 0xaa, 0x72,
+	0x23, 0x64, 0x46, 0x73,
 	0x11, 0x6a, 0x22, 0x01,
-	0x07, 0x6a, 0x42, 0x5b,
+	0x07, 0x6a, 0x58, 0x5b,
 	0xff, 0x06, 0xd4, 0x08,
 	0x00, 0x65, 0x22, 0x41,
-	0xff, 0xa8, 0xae, 0x6a,
-	0xff, 0xa2, 0xc6, 0x7a,
+	0xff, 0xa8, 0xb2, 0x6a,
+	0xff, 0xa2, 0xca, 0x7a,
 	0x01, 0x6a, 0x6a, 0x00,
-	0x00, 0xb9, 0x34, 0x5c,
-	0xff, 0xa2, 0xc6, 0x7a,
+	0x00, 0xb9, 0x4a, 0x5c,
+	0xff, 0xa2, 0xca, 0x7a,
 	0x71, 0x6a, 0x22, 0x01,
 	0xff, 0x6a, 0xd4, 0x08,
-	0x40, 0x51, 0xc6, 0x62,
+	0x40, 0x51, 0xca, 0x62,
 	0x0d, 0x6a, 0x6a, 0x00,
-	0x00, 0xb9, 0x34, 0x5c,
+	0x00, 0xb9, 0x4a, 0x5c,
 	0xff, 0x3e, 0x74, 0x09,
 	0xff, 0x90, 0x7c, 0x08,
 	0x00, 0x65, 0x50, 0x58,
 	0x00, 0x65, 0x34, 0x41,
-	0x20, 0xa0, 0xce, 0x6a,
+	0x20, 0xa0, 0xd2, 0x6a,
 	0xff, 0x37, 0xc8, 0x08,
-	0x00, 0x6a, 0xde, 0x5b,
-	0xff, 0x6a, 0xf4, 0x5b,
+	0x00, 0x6a, 0xf4, 0x5b,
+	0xff, 0x6a, 0x0a, 0x5c,
 	0xff, 0xf8, 0xc8, 0x08,
 	0xff, 0x4f, 0xc8, 0x08,
-	0x01, 0x6a, 0xde, 0x5b,
-	0x00, 0xb9, 0xf4, 0x5b,
+	0x01, 0x6a, 0xf4, 0x5b,
+	0x00, 0xb9, 0x0a, 0x5c,
 	0x01, 0x4f, 0x9e, 0x18,
 	0x02, 0x6a, 0x22, 0x01,
-	0x00, 0x65, 0xa2, 0x5c,
+	0x00, 0x65, 0xb8, 0x5c,
 	0x00, 0x65, 0x34, 0x41,
 	0x41, 0x6a, 0x22, 0x01,
 	0x00, 0x65, 0x22, 0x41,
 	0x04, 0xa0, 0x40, 0x01,
-	0x00, 0x65, 0xba, 0x5c,
+	0x00, 0x65, 0xd0, 0x5c,
 	0x00, 0x65, 0x34, 0x41,
-	0x10, 0x36, 0xa6, 0x7a,
+	0x10, 0x36, 0xaa, 0x7a,
 	0x05, 0x38, 0x46, 0x31,
 	0x04, 0x14, 0x58, 0x31,
 	0x03, 0xa9, 0x60, 0x31,
 	0xa3, 0x6a, 0xcc, 0x00,
-	0x38, 0x6a, 0x1a, 0x5c,
+	0x38, 0x6a, 0x30, 0x5c,
 	0xac, 0x6a, 0xcc, 0x00,
-	0x14, 0x6a, 0x1c, 0x5c,
-	0xa9, 0x6a, 0x1e, 0x5c,
-	0x00, 0x65, 0xa6, 0x42,
+	0x14, 0x6a, 0x32, 0x5c,
+	0xa9, 0x6a, 0x34, 0x5c,
+	0x00, 0x65, 0xaa, 0x42,
 	0xef, 0x36, 0x6c, 0x08,
-	0x00, 0x65, 0xa6, 0x42,
+	0x00, 0x65, 0xaa, 0x42,
 	0x0f, 0x64, 0xc8, 0x08,
 	0x07, 0x64, 0xc8, 0x08,
 	0x00, 0x37, 0x6e, 0x00,
 	0xff, 0x6a, 0xa4, 0x00,
-	0x00, 0x65, 0xae, 0x5b,
-	0xff, 0x51, 0x12, 0x73,
-	0x20, 0x36, 0x1c, 0x7b,
-	0x00, 0x90, 0x9c, 0x5b,
-	0x00, 0x65, 0x1e, 0x43,
+	0x00, 0x65, 0xc4, 0x5b,
+	0xff, 0x51, 0x16, 0x73,
+	0x20, 0x36, 0x20, 0x7b,
+	0x00, 0x90, 0xb2, 0x5b,
+	0x00, 0x65, 0x22, 0x43,
 	0xff, 0x06, 0xd4, 0x08,
-	0x00, 0x65, 0x08, 0x5c,
-	0xe0, 0x3d, 0x38, 0x63,
-	0x20, 0x12, 0x38, 0x63,
-	0x51, 0x6a, 0x46, 0x5b,
-	0x00, 0x65, 0x96, 0x5b,
+	0x00, 0x65, 0x1e, 0x5c,
+	0xe0, 0x3d, 0x3c, 0x63,
+	0x20, 0x12, 0x3c, 0x63,
+	0x51, 0x6a, 0x5c, 0x5b,
+	0x00, 0x65, 0xac, 0x5b,
 	0xff, 0x37, 0xc8, 0x08,
-	0x00, 0xa1, 0x30, 0x63,
-	0x04, 0xa0, 0x30, 0x7b,
+	0x00, 0xa1, 0x34, 0x63,
+	0x04, 0xa0, 0x34, 0x7b,
 	0xfb, 0xa0, 0x40, 0x09,
 	0x80, 0x36, 0x6c, 0x00,
-	0x80, 0xa0, 0xa6, 0x7a,
+	0x80, 0xa0, 0xaa, 0x7a,
 	0x7f, 0xa0, 0x40, 0x09,
-	0xff, 0x6a, 0x42, 0x5b,
-	0x00, 0x65, 0xa6, 0x42,
-	0x04, 0xa0, 0x36, 0x7b,
-	0x00, 0x65, 0xba, 0x5c,
-	0x00, 0x65, 0x38, 0x43,
-	0x00, 0x65, 0xa2, 0x5c,
+	0xff, 0x6a, 0x58, 0x5b,
+	0x00, 0x65, 0xaa, 0x42,
+	0x04, 0xa0, 0x3a, 0x7b,
+	0x00, 0x65, 0xd0, 0x5c,
+	0x00, 0x65, 0x3c, 0x43,
+	0x00, 0x65, 0xb8, 0x5c,
 	0x31, 0x6a, 0x22, 0x01,
-	0x0c, 0x6a, 0x42, 0x5b,
-	0x00, 0x65, 0xa6, 0x42,
+	0x0c, 0x6a, 0x58, 0x5b,
+	0x00, 0x65, 0xaa, 0x42,
 	0x61, 0x6a, 0x22, 0x01,
-	0x00, 0x65, 0xa6, 0x42,
+	0x00, 0x65, 0xaa, 0x42,
+	0x51, 0x6a, 0x5c, 0x5b,
+	0x20, 0x0d, 0xaa, 0x6a,
+	0xff, 0xa8, 0x54, 0x6b,
+	0xff, 0xa9, 0x54, 0x6b,
+	0xff, 0xaa, 0x54, 0x6b,
+	0xff, 0xab, 0x54, 0x6b,
+	0x00, 0x65, 0xaa, 0x42,
+	0x51, 0x6a, 0x22, 0x01,
+	0x00, 0x65, 0xaa, 0x42,
 	0x10, 0x3d, 0x06, 0x00,
 	0xff, 0x65, 0x68, 0x0c,
 	0xff, 0x06, 0xd4, 0x08,
-	0x01, 0x0c, 0x48, 0x7b,
-	0x04, 0x0c, 0x48, 0x6b,
+	0x01, 0x0c, 0x5e, 0x7b,
+	0x04, 0x0c, 0x60, 0x6b,
 	0xe0, 0x03, 0x7a, 0x08,
-	0xe0, 0x3d, 0x5c, 0x63,
+	0xe0, 0x3d, 0x72, 0x63,
 	0xff, 0x65, 0xcc, 0x08,
 	0xff, 0x12, 0xda, 0x0c,
 	0xff, 0x06, 0xd4, 0x0c,
 	0xff, 0x65, 0x0c, 0x08,
-	0x02, 0x0b, 0x58, 0x7b,
+	0x02, 0x0b, 0x6e, 0x7b,
 	0xff, 0x6a, 0xd4, 0x0c,
 	0xd1, 0x6a, 0x22, 0x01,
 	0x00, 0x65, 0x22, 0x41,
 	0xff, 0x65, 0x26, 0x09,
-	0x01, 0x0b, 0x70, 0x6b,
-	0x10, 0x0c, 0x62, 0x7b,
-	0x04, 0x0b, 0x6a, 0x6b,
+	0x01, 0x0b, 0x86, 0x6b,
+	0x10, 0x0c, 0x78, 0x7b,
+	0x04, 0x0b, 0x80, 0x6b,
 	0xff, 0x6a, 0xca, 0x08,
-	0x04, 0x93, 0x6e, 0x6b,
-	0x01, 0x94, 0x6c, 0x7b,
-	0x10, 0x94, 0x6e, 0x6b,
+	0x04, 0x93, 0x84, 0x6b,
+	0x01, 0x94, 0x82, 0x7b,
+	0x10, 0x94, 0x84, 0x6b,
 	0xc7, 0x93, 0x26, 0x09,
 	0xff, 0x99, 0xd4, 0x08,
-	0x38, 0x93, 0x72, 0x6b,
+	0x38, 0x93, 0x88, 0x6b,
 	0xff, 0x6a, 0xd4, 0x0c,
-	0x80, 0x36, 0x76, 0x6b,
+	0x80, 0x36, 0x8c, 0x6b,
 	0x21, 0x6a, 0x22, 0x05,
 	0xff, 0x65, 0x20, 0x09,
-	0xff, 0x51, 0x84, 0x63,
+	0xff, 0x51, 0x9a, 0x63,
 	0xff, 0x37, 0xc8, 0x08,
-	0xa1, 0x6a, 0x90, 0x43,
+	0xa1, 0x6a, 0xa6, 0x43,
 	0xff, 0x51, 0xc8, 0x08,
-	0xb9, 0x6a, 0x90, 0x43,
+	0xb9, 0x6a, 0xa6, 0x43,
 	0xff, 0x90, 0xa4, 0x08,
-	0xff, 0xba, 0x94, 0x73,
+	0xff, 0xba, 0xaa, 0x73,
 	0xff, 0xba, 0x20, 0x09,
 	0xff, 0x65, 0xca, 0x18,
-	0x00, 0x6c, 0x88, 0x63,
+	0x00, 0x6c, 0x9e, 0x63,
 	0xff, 0x90, 0xca, 0x0c,
 	0xff, 0x6a, 0xca, 0x04,
-	0x20, 0x36, 0xa8, 0x7b,
-	0x00, 0x90, 0x7c, 0x5b,
-	0xff, 0x65, 0xa8, 0x73,
-	0xff, 0x52, 0xa6, 0x73,
+	0x20, 0x36, 0xbe, 0x7b,
+	0x00, 0x90, 0x92, 0x5b,
+	0xff, 0x65, 0xbe, 0x73,
+	0xff, 0x52, 0xbc, 0x73,
 	0xff, 0xba, 0xcc, 0x08,
 	0xff, 0x52, 0x20, 0x09,
 	0xff, 0x66, 0x74, 0x09,
 	0xff, 0x65, 0x20, 0x0d,
 	0xff, 0xba, 0x7e, 0x0c,
-	0x00, 0x6a, 0xa8, 0x5c,
+	0x00, 0x6a, 0xbe, 0x5c,
 	0x0d, 0x6a, 0x6a, 0x00,
-	0x00, 0x51, 0x34, 0x44,
-	0xff, 0x3f, 0x02, 0x74,
+	0x00, 0x51, 0x4a, 0x44,
+	0xff, 0x3f, 0x18, 0x74,
 	0xff, 0x6a, 0xa2, 0x00,
-	0x00, 0x3f, 0x7c, 0x5b,
-	0xff, 0x65, 0x02, 0x74,
+	0x00, 0x3f, 0x92, 0x5b,
+	0xff, 0x65, 0x18, 0x74,
 	0x20, 0x36, 0x6c, 0x00,
-	0x20, 0xa0, 0xbc, 0x6b,
+	0x20, 0xa0, 0xd2, 0x6b,
 	0xff, 0xb9, 0xa2, 0x0c,
 	0xff, 0x6a, 0xa2, 0x04,
 	0xff, 0x65, 0xa4, 0x08,
 	0xe0, 0x6a, 0xcc, 0x00,
-	0x45, 0x6a, 0x28, 0x5c,
+	0x45, 0x6a, 0x3e, 0x5c,
 	0x01, 0x6a, 0xd0, 0x01,
 	0x09, 0x6a, 0xd6, 0x01,
-	0x80, 0xeb, 0xc8, 0x7b,
+	0x80, 0xeb, 0xde, 0x7b,
 	0x01, 0x6a, 0xd6, 0x01,
 	0x01, 0xe9, 0xa4, 0x34,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x45, 0x6a, 0x28, 0x5c,
+	0x45, 0x6a, 0x3e, 0x5c,
 	0x01, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0x0d, 0x6a, 0x26, 0x01,
-	0x00, 0x65, 0x9a, 0x5c,
+	0x00, 0x65, 0xb0, 0x5c,
 	0xff, 0x99, 0xa4, 0x0c,
 	0xff, 0x65, 0xa4, 0x08,
 	0xe0, 0x6a, 0xcc, 0x00,
-	0x45, 0x6a, 0x28, 0x5c,
+	0x45, 0x6a, 0x3e, 0x5c,
 	0x01, 0x6a, 0xd0, 0x01,
 	0x01, 0x6a, 0xdc, 0x05,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x45, 0x6a, 0x28, 0x5c,
+	0x45, 0x6a, 0x3e, 0x5c,
 	0x01, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0x01, 0x6a, 0x26, 0x05,
 	0x01, 0x65, 0xd8, 0x31,
 	0x09, 0xee, 0xdc, 0x01,
-	0x80, 0xee, 0xf8, 0x7b,
+	0x80, 0xee, 0x0e, 0x7c,
 	0xff, 0x6a, 0xdc, 0x0d,
 	0xff, 0x65, 0x32, 0x09,
 	0x0a, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0x9a, 0x44,
+	0x00, 0x65, 0xb0, 0x44,
 	0xff, 0x37, 0xc8, 0x08,
-	0x00, 0x6a, 0xbe, 0x5b,
+	0x00, 0x6a, 0xd4, 0x5b,
 	0xff, 0x52, 0xa2, 0x0c,
-	0x01, 0x0c, 0x08, 0x7c,
-	0x04, 0x0c, 0x08, 0x6c,
+	0x01, 0x0c, 0x1e, 0x7c,
+	0x04, 0x0c, 0x1e, 0x6c,
 	0xe0, 0x03, 0x06, 0x08,
 	0xe0, 0x03, 0x7a, 0x0c,
 	0xff, 0x8c, 0x10, 0x08,
@@ -542,29 +553,29 @@
 	0x00, 0x6c, 0xda, 0x24,
 	0xff, 0x65, 0xc8, 0x08,
 	0xe0, 0x6a, 0xcc, 0x00,
-	0x41, 0x6a, 0x24, 0x5c,
+	0x41, 0x6a, 0x3a, 0x5c,
 	0xff, 0x90, 0xe2, 0x09,
 	0x20, 0x6a, 0xd0, 0x01,
-	0x04, 0x35, 0x46, 0x7c,
+	0x04, 0x35, 0x5c, 0x7c,
 	0x1d, 0x6a, 0xdc, 0x01,
-	0xdc, 0xee, 0x42, 0x64,
-	0x00, 0x65, 0x52, 0x44,
+	0xdc, 0xee, 0x58, 0x64,
+	0x00, 0x65, 0x68, 0x44,
 	0x01, 0x6a, 0xdc, 0x01,
 	0x20, 0xa0, 0xd8, 0x31,
 	0x09, 0xee, 0xdc, 0x01,
-	0x80, 0xee, 0x4c, 0x7c,
+	0x80, 0xee, 0x62, 0x7c,
 	0x19, 0x6a, 0xdc, 0x01,
-	0xd8, 0xee, 0x50, 0x64,
+	0xd8, 0xee, 0x66, 0x64,
 	0xff, 0x6a, 0xdc, 0x09,
-	0x18, 0xee, 0x54, 0x6c,
+	0x18, 0xee, 0x6a, 0x6c,
 	0xff, 0x6a, 0xd4, 0x0c,
 	0x88, 0x6a, 0xcc, 0x00,
-	0x41, 0x6a, 0x24, 0x5c,
+	0x41, 0x6a, 0x3a, 0x5c,
 	0x20, 0x6a, 0x18, 0x01,
 	0xff, 0x6a, 0x1a, 0x09,
 	0xff, 0x6a, 0x1c, 0x09,
 	0xff, 0x35, 0x26, 0x09,
-	0x04, 0x35, 0x7e, 0x6c,
+	0x04, 0x35, 0x94, 0x6c,
 	0xa0, 0x6a, 0xca, 0x00,
 	0x20, 0x65, 0xc8, 0x18,
 	0xff, 0x6c, 0x32, 0x09,
@@ -575,14 +586,14 @@
 	0xff, 0x6c, 0x32, 0x09,
 	0xff, 0x6c, 0x32, 0x09,
 	0xff, 0x6c, 0x32, 0x09,
-	0x00, 0x65, 0x6a, 0x64,
+	0x00, 0x65, 0x80, 0x64,
 	0x0a, 0x93, 0x26, 0x01,
-	0x00, 0x65, 0x9a, 0x5c,
-	0x04, 0x35, 0x76, 0x7b,
-	0xa0, 0x6a, 0x8a, 0x5c,
-	0x00, 0x65, 0x8c, 0x5c,
-	0x00, 0x65, 0x8c, 0x5c,
-	0x00, 0x65, 0x8c, 0x44,
+	0x00, 0x65, 0xb0, 0x5c,
+	0x04, 0x35, 0x8c, 0x7b,
+	0xa0, 0x6a, 0xa0, 0x5c,
+	0x00, 0x65, 0xa2, 0x5c,
+	0x00, 0x65, 0xa2, 0x5c,
+	0x00, 0x65, 0xa2, 0x44,
 	0xff, 0x65, 0xcc, 0x08,
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x08,
@@ -591,19 +602,19 @@
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x08,
 	0xff, 0x99, 0xda, 0x0c,
-	0x08, 0x94, 0x9a, 0x7c,
+	0x08, 0x94, 0xb0, 0x7c,
 	0xf7, 0x93, 0x26, 0x09,
-	0x08, 0x93, 0x9e, 0x6c,
+	0x08, 0x93, 0xb4, 0x6c,
 	0xff, 0x6a, 0xd4, 0x0c,
 	0xff, 0x40, 0x74, 0x09,
 	0xff, 0x90, 0x80, 0x08,
 	0xff, 0x6a, 0x72, 0x05,
-	0xff, 0x40, 0xb6, 0x64,
-	0xff, 0x3f, 0xae, 0x64,
+	0xff, 0x40, 0xcc, 0x64,
+	0xff, 0x3f, 0xc4, 0x64,
 	0xff, 0x6a, 0xca, 0x04,
 	0xff, 0x3f, 0x20, 0x09,
 	0x01, 0x6a, 0x6a, 0x00,
-	0x00, 0xb9, 0x34, 0x5c,
+	0x00, 0xb9, 0x4a, 0x5c,
 	0xff, 0xba, 0x7e, 0x0c,
 	0xff, 0x40, 0x20, 0x09,
 	0xff, 0xba, 0x80, 0x0c,
@@ -761,49 +772,52 @@
 	{ aic7xxx_patch2_func, 192, 2, 3 },
 	{ aic7xxx_patch8_func, 192, 1, 1 },
 	{ aic7xxx_patch0_func, 194, 3, 1 },
-	{ aic7xxx_patch10_func, 197, 2, 1 },
-	{ aic7xxx_patch8_func, 199, 7, 2 },
-	{ aic7xxx_patch0_func, 206, 1, 1 },
-	{ aic7xxx_patch2_func, 211, 14, 3 },
-	{ aic7xxx_patch10_func, 224, 1, 1 },
-	{ aic7xxx_patch0_func, 225, 9, 1 },
-	{ aic7xxx_patch8_func, 239, 2, 1 },
-	{ aic7xxx_patch8_func, 241, 1, 1 },
-	{ aic7xxx_patch10_func, 242, 6, 3 },
-	{ aic7xxx_patch2_func, 242, 2, 2 },
-	{ aic7xxx_patch0_func, 244, 4, 1 },
-	{ aic7xxx_patch8_func, 249, 1, 1 },
-	{ aic7xxx_patch8_func, 253, 19, 1 },
-	{ aic7xxx_patch2_func, 273, 3, 3 },
-	{ aic7xxx_patch10_func, 275, 1, 1 },
-	{ aic7xxx_patch0_func, 276, 5, 1 },
-	{ aic7xxx_patch10_func, 281, 1, 2 },
-	{ aic7xxx_patch0_func, 282, 9, 1 },
-	{ aic7xxx_patch11_func, 298, 1, 2 },
-	{ aic7xxx_patch0_func, 299, 1, 1 },
-	{ aic7xxx_patch5_func, 359, 1, 2 },
-	{ aic7xxx_patch0_func, 360, 1, 1 },
-	{ aic7xxx_patch3_func, 363, 1, 1 },
-	{ aic7xxx_patch2_func, 373, 3, 2 },
-	{ aic7xxx_patch0_func, 376, 5, 1 },
-	{ aic7xxx_patch11_func, 384, 1, 2 },
-	{ aic7xxx_patch0_func, 385, 1, 1 },
-	{ aic7xxx_patch6_func, 390, 1, 1 },
-	{ aic7xxx_patch1_func, 427, 3, 1 },
-	{ aic7xxx_patch10_func, 432, 11, 1 },
-	{ aic7xxx_patch2_func, 480, 7, 2 },
-	{ aic7xxx_patch0_func, 487, 8, 1 },
-	{ aic7xxx_patch2_func, 496, 4, 2 },
-	{ aic7xxx_patch0_func, 500, 6, 1 },
-	{ aic7xxx_patch2_func, 506, 4, 2 },
-	{ aic7xxx_patch0_func, 510, 3, 1 },
-	{ aic7xxx_patch12_func, 520, 10, 1 },
-	{ aic7xxx_patch2_func, 539, 17, 4 },
-	{ aic7xxx_patch13_func, 547, 4, 2 },
-	{ aic7xxx_patch0_func, 551, 2, 1 },
-	{ aic7xxx_patch0_func, 556, 33, 1 },
-	{ aic7xxx_patch12_func, 589, 4, 1 },
-	{ aic7xxx_patch6_func, 593, 2, 1 },
-	{ aic7xxx_patch6_func, 596, 9, 1 },
+	{ aic7xxx_patch10_func, 198, 1, 2 },
+	{ aic7xxx_patch0_func, 199, 1, 1 },
+	{ aic7xxx_patch8_func, 200, 7, 2 },
+	{ aic7xxx_patch0_func, 207, 1, 1 },
+	{ aic7xxx_patch2_func, 212, 14, 3 },
+	{ aic7xxx_patch10_func, 225, 1, 1 },
+	{ aic7xxx_patch0_func, 226, 9, 1 },
+	{ aic7xxx_patch8_func, 240, 2, 1 },
+	{ aic7xxx_patch8_func, 242, 1, 1 },
+	{ aic7xxx_patch10_func, 243, 6, 3 },
+	{ aic7xxx_patch2_func, 243, 2, 2 },
+	{ aic7xxx_patch0_func, 245, 4, 1 },
+	{ aic7xxx_patch8_func, 250, 1, 1 },
+	{ aic7xxx_patch8_func, 254, 19, 1 },
+	{ aic7xxx_patch2_func, 274, 3, 3 },
+	{ aic7xxx_patch10_func, 276, 1, 1 },
+	{ aic7xxx_patch0_func, 277, 5, 1 },
+	{ aic7xxx_patch10_func, 282, 1, 2 },
+	{ aic7xxx_patch0_func, 283, 9, 1 },
+	{ aic7xxx_patch11_func, 299, 1, 2 },
+	{ aic7xxx_patch0_func, 300, 1, 1 },
+	{ aic7xxx_patch5_func, 361, 1, 2 },
+	{ aic7xxx_patch0_func, 362, 1, 1 },
+	{ aic7xxx_patch3_func, 365, 1, 1 },
+	{ aic7xxx_patch2_func, 375, 3, 2 },
+	{ aic7xxx_patch0_func, 378, 5, 1 },
+	{ 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 },
 
 };
Index: oldkernel/linux/drivers/scsi/aic7xxx/aic7xxx.reg
diff -u linux/drivers/scsi/aic7xxx/aic7xxx.reg:1.1.1.1 linux/drivers/scsi/aic7xxx/aic7xxx.reg:1.2
--- linux/drivers/scsi/aic7xxx/aic7xxx.reg:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/scsi/aic7xxx/aic7xxx.reg	Thu Jun  1 15:16:17 2000
@@ -691,7 +691,8 @@
 	mask	NO_IDENT	0x20|SEQINT	/* no IDENTIFY after reconnect*/
 	mask	NO_MATCH	0x30|SEQINT	/* no cmd match for reconnect */
 	mask	EXTENDED_MSG	0x40|SEQINT	/* Extended message received */
-	mask	ABORT_REQUESTED 0x50|SEQINT	/* Reconect of aborted SCB */
+	mask	WIDE_RESIDUE	0x50|SEQINT	/* need kernel to back up */
+						/* the SG array for us */
 	mask	REJECT_MSG	0x60|SEQINT	/* Reject message received */
 	mask	BAD_STATUS	0x70|SEQINT	/* Bad status from target */
 	mask	RESIDUAL	0x80|SEQINT	/* Residual byte count != 0 */
Index: oldkernel/linux/drivers/scsi/aic7xxx/aic7xxx.seq
diff -u linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.1.1.1 linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.2
--- linux/drivers/scsi/aic7xxx/aic7xxx.seq:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/scsi/aic7xxx/aic7xxx.seq	Thu Jun  1 15:16:17 2000
@@ -517,10 +517,12 @@
 	}
 data_phase_inbounds:
 /* If we are the last SG block, tell the hardware. */
-if ((p->features & AHC_ULTRA2) == 0) {
 	cmp	SG_COUNT,0x01 jne data_phase_wideodd;
-	and	DMAPARAMS, ~WIDEODD;
-}
+	if ((p->features & AHC_ULTRA2) == 0) {
+		and	DMAPARAMS, ~WIDEODD;
+	} else {
+		mvi	SG_CACHEPTR, LAST_SEG;
+	}
 data_phase_wideodd:
 	if ((p->features & AHC_ULTRA2) != 0) {
 		mov	SINDEX, ALLONES;
@@ -530,7 +532,7 @@
 		test	SSTAT0, SDONE jnz data_phase_dma_done;
 		test	SSTAT1,PHASEMIS	jz data_phase_dma_loop;	/* ie. underrun */
 data_phase_dma_phasemis:
-		test	SSTAT0,SDONE	jnz . + 2;
+		test	SSTAT0,SDONE	jnz data_phase_dma_done;
 		clr	SINDEX;			/* Remember the phasemiss */
 	} else {
 		mov	DMAPARAMS  call dma;
@@ -615,9 +617,10 @@
 	test    SSTAT1, REQINIT jz .;
 	test	SSTAT1,PHASEMIS	jz data_phase_loop;
 
+/* This drops the last SG segment down to the shadow layer for us */
 	if ((p->features & AHC_ULTRA2) != 0) {
 		mov	DFCNTRL, DMAPARAMS;
-		test	SSTAT0, SDONE jnz .;
+		test	SSTAT0, SDONE	jnz .;
 	}
 
 data_phase_finish:
@@ -713,7 +716,7 @@
 		mvi	DFCNTRL, (PRELOADEN|SCSIEN|HDMAEN|DIRECTION);
 		test	SSTAT0, SDONE jnz .;
 p_command_dma_loop:
-		test	SSTAT0, DMADONE jnz p_command_ultra2_dma_done;
+		test	SSTAT0, SDONE jnz p_command_ultra2_dma_done;
 		test	SSTAT1,PHASEMIS	jz p_command_dma_loop;	/* ie. underrun */
 p_command_ultra2_dma_done:
 		and     DFCNTRL, ~HDMAEN;
@@ -830,6 +833,7 @@
 	cmp	A,MSG_EXTENDED		je mesgin_extended;
 	cmp	A,MSG_MESSAGE_REJECT	je mesgin_reject;
 	cmp	A,MSG_NOOP		je mesgin_done;
+	cmp	A,MSG_IGN_WIDE_RESIDUE	je mesgin_wide_residue;
 
 rej_mesgin:
 /*
@@ -1057,6 +1061,36 @@
 	jmp	mesgin_done;
 
 /*
+ * Wide Residue.  We handle the simple cases, but pass of the one hard case
+ * to the kernel (when the residue byte happened to cause us to advance our
+ * sg element array, so we know have to back that advance out).
+ */
+mesgin_wide_residue:
+	mvi	ARG_1	call inb_next; /* ACK the wide_residue and get */
+				       /* the size byte */
+/*
+ * 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;
+	}
+wide_residue_int:
+/*
+ * In order for this to be reliable, we have to do all sorts of horrible
+ * magic in terms of resetting the datafifo and reloading the shadow layer
+ * with the correct new values (so that a subsequent save data pointers
+ * message will do the right thing).  We let the kernel do that work.
+ */
+ 	mvi	INTSTAT,WIDE_RESIDUE;
+	jmp	mesgin_done;
+	
+/*
  * [ ADD MORE MESSAGE HANDLING HERE ]
  */
 
@@ -1093,7 +1127,7 @@
 	 * before continuing.
 	 */
 	test	SSTAT1, REQINIT	jz inb_next_wait;
-	test	SSTAT1, SCSIPERR jnz inb_next_wait;
+	test	SSTAT1, SCSIPERR jnz .;
 	and	LASTPHASE, PHASE_MASK, SCSISIGI;
 	cmp	LASTPHASE, P_MESGIN jne mesgin_phasemis;
 inb_first:
