Conclusions for the day

Robert G. Brown rgb at phy.duke.edu
Fri Jul 31 15:55:14 PDT 1998


Dear Doug et. al.

I spent the day getting to know the linux aic7xxx code and comparing it to
Justin's, where possible.  None of the changes I made or tried made
much difference for better or for worse.  The one thing that I do
believe is an error occurs here:

@@ -8549,10 +8528,10 @@
             command &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
           pci_write_config_word(pdev, PCI_COMMAND, command);
 #ifdef AIC7XXX_STRICT_PCI_SETUP
-          pci_read_config_dword(pdev, DEVCONFIG, &devconfig);
+          pci_read_config_dword(pdev, PCI_COMMAND, &devconfig);
           if (aic7xxx_verbose & VERBOSE_PROBE2)
           {
-            printk("aic7xxx: Initial DEVCONFIG value was 0x%8x\n", devconfig);
+            printk("aic7xxx: Initial DEVCONFIG value was 0x%x\n", devconfig);
           }
           devconfig |= 0x80000000;
           if ((aic7xxx_pci_parity == 0) || (aic7xxx_pci_parity == -1))
@@ -8563,11 +8542,7 @@
           {
             devconfig |= 0x00000008;
           }
-          if (aic7xxx_verbose & VERBOSE_PROBE2)
-          {
-            printk("aic7xxx: Writing 0x%8x back to DEVCONFIG\n", devconfig);
-          }
-          pci_write_config_dword(pdev, DEVCONFIG, devconfig);
+          pci_write_config_dword(pdev, PCI_COMMAND, devconfig);
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
 #else  /* LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
           temp_p->pci_bus = pci_bus;
@@ -8617,10 +8592,6 @@
           {
             devconfig |= 0x00000008;
           }
-          if (aic7xxx_verbose & VERBOSE_PROBE2)
-          {
-            printk("aic7xxx: Writing 0x%x back to DEVCONFIG\n", devconfig);
-	  }
           pcibios_write_config_dword(pci_bus, pci_devfn, DEVCONFIG, devconfig);
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
 #endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */

This differs from Justin's code and is ALMOST what was announced this
morning.  Note well that devconfig needs to be written back into the
pcibios; this was omitted from the note this morning.  Unfortunately
this didn't make everything magically work.

I added the dumpregs patch from the morning as well the patch to
increase delays as well as the FAILDIS patch on restart_sequencer
(which I believe to be irrelevant and incorrect -- Justin's code
differs only by the inclusion of the SEQRESET flag, not the FAILDIS
flag, and even the SEQRESET flag may be wrong for Doug's code.

Finally, I added a patch to dump the actual binary being sent to the
sequencer in the download_instr command.  I plan to use this along
with dumpreg and the aic7xxx.list (if I can figure out how) to debug
the sequencer download.  Unfortunately, I only have a one day
left to work on this before I go on vacation, so I doubt that I'll get
anywhere.  I enclose the full diff below.

Oh, one more interesting note:

A system that I had been working on that repeatedly failed still had
NT on it (as pre-installed by DELL).  I had never booted it without a
floppy.  I booted it up into NT's pre-install (AFTER NT
installs/clears its found devices) and then, without doing anything
more, booted up linux and inserted the aic7xxx module.  It came up
flawlessly (loudly, but flawlessly:-).

I'm not paranoid enough to expect that this is a
Dell-Microsoft-Adaptec Bomb intended to force NT usage, but it may
well be that there is some difference in what is downloaded by the NT
initialization that survives the sequencer download and/or in PROM.
Worth thinking about.  This might explain why some of my systems
eventually go away, as well and MIGHT be the difference that
distinguishes the systems I have that "work" from those that "don't".

Patch below.  Apply only to a test/junk module -- it is VERY loud and
may break several things.

   rgb

Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu

--- drivers/scsi/aic7xxx.c	Fri Jul 31 18:15:06 1998
+++ drivers/scsi/aic7xxx.c.patched	Wed Jul 29 14:08:23 1998
@@ -320,7 +320,6 @@
 #include <linux/blk.h>
 #include <linux/tqueue.h>
 #include <linux/tasks.h>
-#include <linux/mc146818rtc.h>
 #include "sd.h"
 #include "scsi.h"
 #include "hosts.h"
@@ -1358,9 +1357,6 @@
 static void aic7xxx_check_scbs(struct aic7xxx_host *p, char *buffer);
 #endif
 
-static void aic7xxx_delay(int seconds);
-static void dumpregs (struct aic7xxx_host *p);
-
 /****************************************************************************
  *
  * These functions are not used yet, but when we do memory mapped
@@ -1595,7 +1591,7 @@
 {
   aic_outb(p, 0, SEQADDR0);
   aic_outb(p, 0, SEQADDR1);
-  aic_outb(p, FASTMODE | SEQRESET, SEQCTL);
+  aic_outb(p, FASTMODE, SEQCTL);
 }
 
 /*
@@ -1679,8 +1675,6 @@
 
   /* Pull the opcode */
   opcode = instr.format1.opcode;
-  printk("IP:0x%2x  OPCODE:0x%2x   0x",instrptr,opcode);
-
   switch (opcode)
   {
     case AIC_OP_JMP:
@@ -1772,14 +1766,6 @@
         }
       }
       aic_outsb(p, SEQRAM, instr.bytes, 4);
-      {
-        int i;
-        for (i=0; i < 4; i++)
-        {
-          printk("%2x",instr.bytes[i]);
-        }
-        printk("\n");
-      }
       break;
 
     default:
@@ -1805,13 +1791,10 @@
   int skip_addr;
   unsigned char download_consts[4];
 
-  if(aic7xxx_verbose & VERBOSE_PROBE)
+  if (aic7xxx_verbose & VERBOSE_PROBE)
   {
-    printk("========================================================================\n");
-    printk("(scsi%d) Downloading sequencer code...", p->host_no);
+    printk(KERN_INFO "(scsi%d) Downloading sequencer code...", p->host_no);
   }
-
-  aic7xxx_delay(2);
   download_consts[TMODE_NUMCMDS] = p->num_targetcmds;
   cur_patch = sequencer_patches;
   downloaded = 0;
@@ -1839,7 +1822,6 @@
   {
     printk(" %d instructions downloaded\n", downloaded);
   }
-
 }
 
 /*+F*************************************************************************
@@ -3617,7 +3599,7 @@
   scsiseq = aic_inb(p, SCSISEQ);
   aic_outb(p, scsiseq | SCSIRSTO, SCSISEQ);
 
-  aic7xxx_delay(1);
+  udelay(5000);
 
   /* Turn off the bus reset. */
   aic_outb(p, scsiseq & ~SCSIRSTO, SCSISEQ);
@@ -3627,7 +3609,7 @@
   /* Re-enable reset interrupts. */
   aic_outb(p, aic_inb(p, SIMODE1) | ENSCSIRST, SIMODE1);
 
-  udelay(20000);
+  udelay(2000);
 }
 
 /*+F*************************************************************************
@@ -7444,8 +7426,6 @@
   /*
    * Grab the disconnection disable table and invert it for our needs
    */
-  printk(KERN_INFO "(scsi%d) Reading disable table to set SCSI "
-          "device parameters.\n", p->host_no);
   if (p->flags & AHC_USEDEFAULTS)
   {
     printk(KERN_INFO "(scsi%d) Host adapter BIOS disabled. Using default SCSI "
@@ -7463,7 +7443,6 @@
       p->ultraenb = (aic_inb(p, ULTRA_ENB + 1) << 8) | 
           aic_inb(p, ULTRA_ENB);
   }
-  printk(KERN_INFO "(scsi%d) Ultra enable set to 0x%4x\n", p->host_no,p->ultraenb);
 
   for (i = 0; i < max_targets; i++)
   {
@@ -8549,10 +8528,10 @@
             command &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
           pci_write_config_word(pdev, PCI_COMMAND, command);
 #ifdef AIC7XXX_STRICT_PCI_SETUP
-          pci_read_config_dword(pdev, DEVCONFIG, &devconfig);
+          pci_read_config_dword(pdev, PCI_COMMAND, &devconfig);
           if (aic7xxx_verbose & VERBOSE_PROBE2)
           {
-            printk("aic7xxx: Initial DEVCONFIG value was 0x%8x\n", devconfig);
+            printk("aic7xxx: Initial DEVCONFIG value was 0x%x\n", devconfig);
           }
           devconfig |= 0x80000000;
           if ((aic7xxx_pci_parity == 0) || (aic7xxx_pci_parity == -1))
@@ -8563,11 +8542,7 @@
           {
             devconfig |= 0x00000008;
           }
-          if (aic7xxx_verbose & VERBOSE_PROBE2)
-          {
-            printk("aic7xxx: Writing 0x%8x back to DEVCONFIG\n", devconfig);
-          }
-          pci_write_config_dword(pdev, DEVCONFIG, devconfig);
+          pci_write_config_dword(pdev, PCI_COMMAND, devconfig);
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
 #else  /* LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
           temp_p->pci_bus = pci_bus;
@@ -8617,10 +8592,6 @@
           {
             devconfig |= 0x00000008;
           }
-          if (aic7xxx_verbose & VERBOSE_PROBE2)
-          {
-            printk("aic7xxx: Writing 0x%x back to DEVCONFIG\n", devconfig);
-	  }
           pcibios_write_config_dword(pci_bus, pci_devfn, DEVCONFIG, devconfig);
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
 #endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
@@ -9746,7 +9717,6 @@
      p->flags, p->chip, p->features,
     (aic_inb(p, HCNTRL) & PAUSE) ? "is" : "isn't" );
   pause_sequencer(p);
-  /* dumpregs (p); */
   disable_irq(p->irq);
   printk("SIMODE0=0x%x, SIMODE1=0x%x, SSTAT0=0x%x, SSTAT1=0x%x, INTSTAT=0x%x\n",
     aic_inb(p, SIMODE0), aic_inb(p, SIMODE1), aic_inb(p, SSTAT0),
@@ -10587,44 +10557,6 @@
 
 #include "aic7xxx_proc.c"
 
-
-static
-void dumpregs (struct aic7xxx_host *p)
-{ long port;
-  unsigned char x;
-
-  printk("============================== Register Dump ==============================\n");
-
-  for ( port = 0; port < 256; port++)
-  {
-    if ( port < 0x99 || port >= 0xc0)
-    {
-       if(p->maddr)
-	 x = p->maddr[port];
-       else
-	 x = inb(p->base + port);
-       mb();
-    }
-    else
-       x = 0xff;
-    if ( ( port % 16) == 0)
-    {
-      if ( port)
-        printk ( "\n");
-      printk ( "%04lX  ", port);
-    }
-    else
-    {
-      if ( ( port % 8) == 0)
-        printk ( " ");
-      printk ( " ");
-    }
-    printk ( "%02X", x);
-  }
-  printk ( "\n");
-  printk("============================== Dump Done! ==============================\n");
-}
- 
 #ifdef MODULE
 /* Eventually this will go into an include file, but this will be later */
 Scsi_Host_Template driver_template = AIC7XXX;



To Unsubscribe: send mail to majordomo at FreeBSD.org
with "unsubscribe aic7xxx" in the body of the message



More information about the aic7xxx mailing list