Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sandpoint Add a workaround for the VT6410 IDE contr...



details:   https://anonhg.NetBSD.org/src/rev/a900419fa7b4
branches:  trunk
changeset: 772306:a900419fa7b4
user:      phx <phx%NetBSD.org@localhost>
date:      Wed Dec 28 20:33:20 2011 +0000

description:
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.

diffstat:

 sys/arch/sandpoint/conf/GENERIC      |   5 ++---
 sys/arch/sandpoint/pci/pci_machdep.c |  32 +++++++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 10 deletions(-)

diffs (101 lines):

diff -r e7146fa834fc -r a900419fa7b4 sys/arch/sandpoint/conf/GENERIC
--- a/sys/arch/sandpoint/conf/GENERIC   Wed Dec 28 20:28:04 2011 +0000
+++ b/sys/arch/sandpoint/conf/GENERIC   Wed Dec 28 20:33:20 2011 +0000
@@ -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 @@
 
 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 @@
 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?
diff -r e7146fa834fc -r a900419fa7b4 sys/arch/sandpoint/pci/pci_machdep.c
--- a/sys/arch/sandpoint/pci/pci_machdep.c      Wed Dec 28 20:28:04 2011 +0000
+++ b/sys/arch/sandpoint/pci/pci_machdep.c      Wed Dec 28 20:33:20 2011 +0000
@@ -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 @@
                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 @@
                panic("pci_intr_string: bogus handle 0x%x", ih);
 
        sprintf(irqstr, "irq %d", ih + I8259_ICU);
-       return (irqstr);
+       return irqstr;
        
 }
 
@@ -420,11 +423,26 @@
 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



Home | Main Index | Thread Index | Old Index