Subject: Re: sharing IRQ
To: None <tsutsui@ceres.dti.ne.jp>
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
List: port-cobalt
Date: 10/09/2006 02:29:28
----Next_Part(Mon_Oct__9_02:29:28_2006_554)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi! tsutsui-san,


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Date: Wed, 20 Sep 2006 18:07:09 +0900

> So, before implemente shared IRQ support code, we should
> know hardware specification around cobalt PCI, i.e.
> we should know which IRQ pins each PIN A-D lines are
> connected to. If each PIN A-D lines of the PCI slot
> are connected to independent ICU irq pins, we don't
> have to have shared irq support at all.

I tried some multi-function cards.  However, my cobalt was not able to
booted.  Firmware hangs up.  When it is a card that uses a different pin
(A-D), it thinks like this.  The multi function card of different irq
might be not able to be used with cobalt. 

Thanks,
--
kiyohara


----Next_Part(Mon_Oct__9_02:29:28_2006_554)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="multifunc-card_irq.diff"

Index: arch/cobalt/cobalt/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/cobalt/machdep.c,v
retrieving revision 1.75
diff -u -r1.75 machdep.c
--- arch/cobalt/cobalt/machdep.c	16 Sep 2006 13:31:44 -0000	1.75
+++ arch/cobalt/cobalt/machdep.c	8 Oct 2006 17:05:16 -0000
@@ -66,6 +66,7 @@
 #include <sys/reboot.h>
 #include <sys/user.h>
 #include <sys/mount.h>
+#include <sys/malloc.h>
 #include <sys/kcore.h>
 #include <sys/boot_flag.h>
 #include <sys/ksyms.h>
@@ -513,8 +514,10 @@
 	struct cobalt_intrhand *ih;
 
 	ih = &icu_intrtab[irq];
-	if (ih->ih_func != NULL)
-		panic("icu_intr_establish(): irq %d is already in use", irq);
+	if (ih->ih_func != NULL) {
+		ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
+		LIST_INSERT_AFTER(&icu_intrtab[irq], ih, ih_q);
+	}
 
 	ih->ih_cookie_type = COBALT_COOKIE_TYPE_ICU;
 	ih->ih_func = func;
@@ -604,12 +607,14 @@
 		irq = OCW3_POLL_IRQ(ICU2_READ(PIC_OCW3)) + 8;
 	}
 
-	ih = &icu_intrtab[irq];
-	if (__predict_false(ih->ih_func == NULL)) {
-		printf("icu_intr(): spurious interrupt (irq = %d)\n", irq);
-	} else if (__predict_true((*ih->ih_func)(ih->ih_arg))) {
-		ih->ih_evcnt.ev_count++;
-		handled = 1;
+	for (ih = &icu_intrtab[irq]; ih != NULL; ih = LIST_NEXT(ih, ih_q)) {
+		if (__predict_false(ih->ih_func == NULL))
+			printf("icu_intr(): spurious interrupt (irq = %d)\n",
+			    irq);
+		else if (__predict_true((*ih->ih_func)(ih->ih_arg))) {
+			ih->ih_evcnt.ev_count++;
+			handled = 1;
+		}
 	}
 
 	/* issue EOI to ack */
Index: arch/cobalt/pci/pci_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/pci/pci_machdep.c,v
retrieving revision 1.24
diff -u -r1.24 pci_machdep.c
--- arch/cobalt/pci/pci_machdep.c	22 Aug 2006 21:42:19 -0000	1.24
+++ arch/cobalt/pci/pci_machdep.c	8 Oct 2006 17:05:16 -0000
@@ -160,6 +160,8 @@
 		*ihp = 16 + 1;
 	else if (bus == 0 && dev == 12 && pin == PCI_INTERRUPT_PIN_A)
 		*ihp = 16 + 2;
+	else if (bus == 0 && dev == 10 && line == 0)
+		*ihp = 9;
 	else
 		*ihp = line;
 

----Next_Part(Mon_Oct__9_02:29:28_2006_554)----