Subject: AHA-2842 and EISA config stuff
To: None <port-i386@NetBSD.ORG>
From: Noriyuki Soda <soda@sra.co.jp>
List: port-i386
Date: 03/20/1996 11:02:19
I tried new EISA config stuff to config AHA-2842 VL SCSI card which is
almost software compatible with AHA-2742 EISA SCSI card, and encounterd
two problems.

  (1)	new EISA config stuff checks whether EISA ROM BIOS is exist or
	not, and if not exist, then doesn't probe EISA bus subdevices.
	so that AHA-2842 is never probed.

  (2)	(at least) AHA-2842 requires additional priming to quiry
	vendor and product ID. (I didn't try AHA-2742, though)

so, which is suitable solution to write AHA-2842 probe & attach code ?

  (a)	apply following patches, and share code with EISA config stuff.

  (b)	duplicate EISA config stuff to AHA-2842	specific probe routine.

patch for (1)
===================================================================
diff -u -r1.1 arch/i386/i386/mainbus.c
--- mainbus.c	1996/03/17 12:23:36	1.1
+++ mainbus.c	1996/03/19 23:39:20
@@ -107,7 +107,11 @@
 	}
 #endif
 
+#ifndef AHA2840_HACK
 	if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) {
+#else
+	{
+#endif
 		mba.mba_eba.eba_busname = "eisa";
 		mba.mba_eba.eba_bc = NULL;
 		config_found(self, &mba.mba_eba, mainbus_print);


patch for (2)
===================================================================
diff -u -r1.1.1.2 dev/eisa/eisareg.h
--- dev/eisa/eisareg.h	1996/02/27 12:26:03	1.1.1.2
+++ dev/eisa/eisareg.h	1996/03/19 21:35:10
@@ -60,6 +60,14 @@
 #define	EISA_SLOTOFF_PID	0xc82		/* offset of product id regs */
 #define	EISA_NPIDREGS		2
 
+/*
+ * AHA-284x (VL bus) requires priming a register with the following values.
+ */
+#ifdef AHA2840_HACK
+#define	EISA_SLOTOFF_PRIMING	EISA_SLOTOFF_VID	/* offset */
+#define	EISA_PRIMING_VID(index)	(0x80 + (index))	/* value for vendor */
+#define	EISA_PRIMING_PID(index)	(0x82 + (index))	/* value for product */
+#endif
 
 /*
  * EISA ID functions, used to manipulate and decode EISA ID registers.
diff -u -r1.1.1.2 dev/eisa/eisa.c
--- dev/eisa/eisa.c	1996/03/17 12:27:27	1.1.1.2
+++ dev/eisa/eisa.c	1996/03/19 22:30:18
@@ -150,9 +150,14 @@
 		}
 
 		/* Get the vendor ID bytes */
-		for (i = 0; i < EISA_NVIDREGS; i++)
+		for (i = 0; i < EISA_NVIDREGS; i++) {
+#ifdef EISA_SLOTOFF_PRIMING
+			bus_io_write_1(bc, slotioh,
+			    EISA_SLOTOFF_PRIMING, EISA_PRIMING_VID(i));
+#endif
 			ea.ea_vid[i] = bus_io_read_1(bc, slotioh,
 			    EISA_SLOTOFF_VID + i);
+		}
 
 		/* Check for device existence */
 		if (EISA_VENDID_NODEV(ea.ea_vid)) {
@@ -175,9 +180,14 @@
 		}
 
 		/* Get the product ID bytes */
-		for (i = 0; i < EISA_NPIDREGS; i++)
+		for (i = 0; i < EISA_NPIDREGS; i++) {
+#ifdef EISA_SLOTOFF_PRIMING
+			bus_io_write_1(bc, slotioh,
+			    EISA_SLOTOFF_PRIMING, EISA_PRIMING_PID(i));
+#endif
 			ea.ea_pid[i] = bus_io_read_1(bc, slotioh,
 			    EISA_SLOTOFF_PID + i);
+		}
 
 		/* Create the ID string from the vendor and product IDs */
 		ea.ea_idstring[0] = EISA_VENDID_0(ea.ea_vid);
--
soda@sra.co.jp		Software Research Associates, Inc., Japan
(Noriyuki Soda)		   software tools and technology group