Module Name:    src
Committed By:   phx
Date:           Wed Dec 28 20:33:20 UTC 2011

Modified Files:
        src/sys/arch/sandpoint/conf: GENERIC
        src/sys/arch/sandpoint/pci: pci_machdep.c

Log Message:
Add a workaround for the VT6410 IDE controller on the Iomega Storcenter.
Its interrupt cannot be disabled and remains asserted during the whole
device probing procedure, causing an interrupt storm.
This was fixed by establishing an edge-triggered interrupt for it, so it
will trigger only once during probing.
This workaround makes the WDC_NO_IDS option obsolete, which was removed
from the GENERIC config.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sandpoint/conf/GENERIC
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sandpoint/conf/GENERIC
diff -u src/sys/arch/sandpoint/conf/GENERIC:1.63 src/sys/arch/sandpoint/conf/GENERIC:1.64
--- src/sys/arch/sandpoint/conf/GENERIC:1.63	Sun Dec 18 05:49:31 2011
+++ src/sys/arch/sandpoint/conf/GENERIC	Wed Dec 28 20:33:20 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.63 2011/12/18 05:49:31 dholland Exp $
+# $NetBSD: GENERIC,v 1.64 2011/12/28 20:33:20 phx Exp $
 #
 # machine description file for GENERIC NAS
 # 
@@ -22,7 +22,7 @@ include 	"arch/sandpoint/conf/std.sandpo
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.63 $"
+#ident 		"GENERIC-$Revision: 1.64 $"
 
 maxusers	32
 
@@ -201,7 +201,6 @@ cmdide* 	at pci? dev ? function ?	# CMD 
 iteide* 	at pci? dev ? function ?	# IT Express IDE controllers
 satalink*	at pci? dev ? function ?	# SiI SATALink controllers
 viaide*		at pci? dev ? function ?	# VIA IDE controllers
-#options 	WDC_NO_IDS			# fix Iomega viaide VT6410
 
 # ATA (IDE) bus support
 atabus* at ata?

Index: src/sys/arch/sandpoint/pci/pci_machdep.c
diff -u src/sys/arch/sandpoint/pci/pci_machdep.c:1.30 src/sys/arch/sandpoint/pci/pci_machdep.c:1.31
--- src/sys/arch/sandpoint/pci/pci_machdep.c:1.30	Sun Nov  6 00:28:12 2011
+++ src/sys/arch/sandpoint/pci/pci_machdep.c	Wed Dec 28 20:33:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.30 2011/11/06 00:28:12 phx Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.30 2011/11/06 00:28:12 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $");
 
 #include "opt_pci.h"
 
@@ -364,13 +364,16 @@ pci_intr_map(const struct pci_attach_arg
 		break;
 	case BRD_STORCENTER:
 		/* map line 13,14A,14B,14C,15 to EPIC IRQ 1,2,3,4,0 */
-		*ihp =	(line == 15) ? 0 : 1;
-		if (line == 14)
-			*ihp += pin;
+		*ihp =	(line == 15) ? 0 :
+			(line == 13) ? 1 : 1 + pin;
 		break;
 	default:
 		/* simply map line 12-15 to EPIC IRQ0-3 */
 		*ihp = line - 12;
+#if defined(DIAGNOSTIC) || defined(DEBUG)
+		printf("pci_intr_map: line %d, pin %c for unknown board"
+		    " mapped to irq %d\n", line, pin + '@', *ihp);
+#endif
 		break;
 	}
 #ifdef EPIC_DEBUGIRQ
@@ -391,7 +394,7 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 		panic("pci_intr_string: bogus handle 0x%x", ih);
 
 	sprintf(irqstr, "irq %d", ih + I8259_ICU);
-	return (irqstr);
+	return irqstr;
 	
 }
 
@@ -420,11 +423,26 @@ void *
 pci_intr_establish(void *v, pci_intr_handle_t ih, int level,
     int (*func)(void *), void *arg)
 {
+	int type;
+
+	if (brdtype == BRD_STORCENTER && ih == 1) {
+		/*
+		 * XXX This is a workaround for the VT6410 IDE controller!
+		 * Apparently its interrupt cannot be disabled and remains
+		 * asserted during the whole device probing procedure,
+		 * causing an interrupt storm.
+		 * Using an edge-trigger fixes that and triggers the
+		 * interrupt only once during probing.
+		 */
+		 type = IST_EDGE;
+	} else
+		type = IST_LEVEL;
+	
 	/*
 	 * ih is the value assigned in pci_intr_map(), above.
 	 * It's the EPIC IRQ #.
 	 */
-	return intr_establish(ih + I8259_ICU, IST_LEVEL, level, func, arg);
+	return intr_establish(ih + I8259_ICU, type, level, func, arg);
 }
 
 void

Reply via email to