Subject: aic7899
To: None <port-i386@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: port-i386
Date: 11/03/2000 17:45:59
Anybody have success with one of these?

I've being trying to get the onboard SCSI on an SGI 1450 to work. The kernel
faults in ahc_check_patch() during autoconfiguration. No trace is available.
The fault is at line 4467 in aic7xxx.c, and at that point, `skip_addr' is
0x1c0.

FWIW this patch was needed to get it to configure:

Index: ahc_pci.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/ahc_pci.c,v
retrieving revision 1.27
diff -u -r1.27 ahc_pci.c
--- ahc_pci.c	2000/09/24 12:37:03	1.27
+++ ahc_pci.c	2000/11/03 17:36:57
@@ -51,7 +51,7 @@
 
 /* XXXX some i386 on-board chips act weird when memory-mapped */
 #ifndef __i386__
-#define AHC_ALLOW_MEMIO
+#define AHC_PREFER_MEMIO
 #endif
 
 #define AHC_PCI_IOADDR	PCI_MAPREG_START	/* I/O Address */
@@ -620,11 +620,9 @@
 	int		   ioh_valid, memh_valid;
 	bus_space_tag_t st, iot;
 	bus_space_handle_t sh, ioh;
-#ifdef AHC_ALLOW_MEMIO
 	bus_space_tag_t memt;
 	bus_space_handle_t memh;
 	pcireg_t memtype;
-#endif
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	struct ahc_pci_busdata *bd;
@@ -640,36 +638,40 @@
 
 	ioh_valid = memh_valid = 0;
 
-#ifdef AHC_ALLOW_MEMIO
-	memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AHC_PCI_MEMADDR);
-	switch (memtype) {
-	case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
-	case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT:
-		memh_valid = (pci_mapreg_map(pa, AHC_PCI_MEMADDR,
-		    memtype, 0, &memt, &memh, NULL, NULL) == 0);
-		break;
-	default:
-		memh_valid = 0;
-	}
-#endif
 	ioh_valid = (pci_mapreg_map(pa, AHC_PCI_IOADDR,
 	    PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL) == 0);
 
-	if (ioh_valid) {
-		st = iot;
-		sh = ioh;
-#ifdef AHC_ALLOW_MEMIO
-	} else if (memh_valid) {
+#ifndef AHC_PREFER_MEMIO
+	if (ioh_valid == 0) {
+#endif
+		memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag,
+		    AHC_PCI_MEMADDR);
+		switch (memtype) {
+		case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
+		case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT:
+			memh_valid = (pci_mapreg_map(pa, AHC_PCI_MEMADDR,
+			    memtype, 0, &memt, &memh, NULL, NULL) == 0);
+			break;
+		default:
+			memh_valid = 0;
+		}
+#ifndef AHC_PREFER_MEMIO
+	}
+#endif
+
+	if (memh_valid) {
 		st = memt;
 		sh = memh;
-#endif
+	} else if (ioh_valid) {
+		st = iot;
+		sh = ioh;
 	} else {
 		printf(": unable to map registers\n");
 		return;
 	}
 
 	printf("\n");
-		
+
 
 	/* Ensure busmastering is enabled */
 	command |= PCI_COMMAND_MASTER_ENABLE;;