Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/pci Handle setting the proper interrupt l...



details:   https://anonhg.NetBSD.org/src/rev/2de1d21c8c67
branches:  trunk
changeset: 503468:2de1d21c8c67
user:      briggs <briggs%NetBSD.org@localhost>
date:      Wed Feb 07 05:49:17 2001 +0000

description:
Handle setting the proper interrupt line for devices behind bridges.

diffstat:

 sys/arch/sandpoint/pci/pci_machdep.c |  28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r e0914189d4db -r 2de1d21c8c67 sys/arch/sandpoint/pci/pci_machdep.c
--- a/sys/arch/sandpoint/pci/pci_machdep.c      Wed Feb 07 01:34:21 2001 +0000
+++ b/sys/arch/sandpoint/pci/pci_machdep.c      Wed Feb 07 05:49:17 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.1 2001/02/04 18:32:16 briggs Exp $   */
+/*     $NetBSD: pci_machdep.c,v 1.2 2001/02/07 05:49:17 briggs Exp $   */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -290,7 +290,29 @@
 }
 
 void
-pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int func, int *iline)
+pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int func, int swiz,
+    int *iline)
 {
-       *iline = dev;
+       if (bus == 0) {
+               *iline = dev;
+       } else {
+               /*
+                * If we are not on bus zero, we're behind a bridge, so we
+                * swizzle.
+                *
+                * The documentation lies about this.  In slot 3 (numbering
+                * from 0) aka device 16, INTD# becomes an interrupt for
+                * slot 2.  INTC# becomes an interrupt for slot 1, etc.
+                * In slot 2 aka device 16, INTD# becomes an interrupt for
+                * slot 1, etc.
+                *
+                * Verified for INTD# on device 16, INTC# on device 16,
+                * INTD# on device 15, INTD# on device 13, and INTC# on
+                * device 14.  I presume that the rest follow the same
+                * pattern.
+                *
+                * Slot 0 is device 13, and is the base for the rest.
+                */
+               *iline = 13 + ((swiz + dev + 3) & 3);
+       }
 }



Home | Main Index | Thread Index | Old Index