patch-2.3.41 linux/drivers/scsi/aha1542.c

Next file: linux/drivers/scsi/aic7xxx/aic7xxx.seq
Previous file: linux/drivers/scsi/a3000.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c
@@ -21,8 +21,11 @@
  *  Modified by Chris Faulhaber <jedgar@fxp.org>
  *        Added module command-line options
  *        19-Jul-99
+ *  Modified by Adam Fritzler <mid@auk.cx>
+ *        Added proper detection of the AHA-1640 (MCA version of AHA-1540)
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 
 #include <linux/kernel.h>
@@ -40,6 +43,8 @@
 #include <asm/system.h>
 #include <asm/io.h>
 #include <linux/blk.h>
+#include <linux/mca.h>
+
 #include "scsi.h"
 #include "hosts.h"
 
@@ -96,7 +101,7 @@
 #define MAXBOARDS 4		/* Increase this and the sizes of the
 				   arrays below, if you need more.. */
 
-/* Boards 3,4 slots are reserved for ISAPnP scans */
+/* Boards 3,4 slots are reserved for ISAPnP/MCA scans */
 
 static unsigned int bases[MAXBOARDS] = {0x330, 0x334, 0, 0};
 
@@ -1043,6 +1048,69 @@
 		setup_dmaspeed[0] = atbt;
 	}
 #endif
+
+	/*
+	 *	Find MicroChannel cards (AHA1640)
+	 */
+#ifdef CONFIG_MCA
+	if(MCA_bus) {
+		int slot = 0;
+		int pos = 0;
+
+		for (indx = 0; (slot !=  MCA_NOTFOUND) && 
+			     (indx < sizeof(bases)/sizeof(bases[0])); indx++) {
+
+			if (bases[indx])
+				continue;
+
+			/* Detect only AHA-1640 cards -- MCA ID 0F1F */
+			slot = mca_find_unused_adapter(0x0f1f, slot);
+			if (slot == MCA_NOTFOUND)
+				break;
+
+			
+			/* Found one */
+			pos = mca_read_stored_pos(slot, 3);
+			
+			/* Decode address */
+			if (pos & 0x80) {
+				if (pos & 0x02) {
+					if (pos & 0x01)
+						bases[indx] = 0x334;
+					else
+						bases[indx] = 0x234;
+				} else {
+					if (pos & 0x01)
+						bases[indx] = 0x134;
+				}
+			} else {
+				if (pos & 0x02) {
+					if (pos & 0x01)
+						bases[indx] = 0x330;
+					else
+						bases[indx] = 0x230;
+				} else {
+					if (pos & 0x01)
+						bases[indx] = 0x130;
+				}
+			}
+
+			/* No need to decode IRQ and Arb level -- those are
+			 * read off the card later.
+			 */
+			printk(KERN_INFO "Found an AHA-1640 in MCA slot %d, I/O 0x%04x\n", slot, bases[indx]);
+
+			mca_set_adapter_name(slot, "Adapter AHA-1640");
+			mca_set_adapter_procfn(slot, NULL, NULL);
+			mca_mark_as_used(slot);
+			
+			/* Go on */
+			slot++;
+		}
+		
+	}
+#endif
+
 	/*
 	 *	Hunt for ISA Plug'n'Pray Adaptecs (AHA1535)
 	 */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)