linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] "multifunc-device": fix IRQ assignment by also scanning dummy nodes
@ 2009-01-05 20:00 Tom Arbuckle
  2009-01-20 19:17 ` Tom Arbuckle
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Arbuckle @ 2009-01-05 20:00 UTC (permalink / raw)
  To: linuxppc-dev

Kernel: 2.6.28; function: scan_OF_pci_childs; file: arch/powerpc/kernel/pci_32.c
Quoting from line 206 : 'some OFs create a parent node "multifunc-device" as a
fake root for all functions of a multi-function device. we go down
them as well.'

Function scan_OF_for_pci_dev (line 225) also needs to be taught about
these dummy nodes to prevent misallocation/non-allocation of IRQs for
this class of devices.

Why RFC? I have chosen to scan all 'unusual' nodes as possible
multifunc-devices. Is this too many?

Bug seen when using a bt878 multimedia controller card on a G3 Powermac.
This PCI card has separate audio and video nodes and was not being properly
assigned interrupts. (Either 'cannot grab irq 0' or type of assigned
interrupt wrt 'edge/level' was incorrect).

Signed off by: Tom Arbuckle <tom.d.arbuckle (at) gmail.com>


Regards,


Tom Arbuckle

Homepage: http://www.ece.ul.ie/homepage/Tom_Arbuckle/
LinkedIn: http://www.linkedin.com/in/tomarbuckle


--- linux-2.6.28/arch/powerpc/kernel/pci_32.c.orig	2008-12-27
16:32:48.000000000 +0000
+++ linux-2.6.28/arch/powerpc/kernel/pci_32.c	2008-12-27
16:36:15.000000000 +0000
@@ -226,15 +226,21 @@ static struct device_node *scan_OF_for_p
 					       unsigned int devfn)
 {
 	struct device_node *np;
+	struct device_node *np_sub = NULL;
 	const u32 *reg;
 	unsigned int psize;

 	for_each_child_of_node(parent, np) {
 		reg = of_get_property(np, "reg", &psize);
-		if (reg == NULL || psize < 4)
-			continue;
-		if (((reg[0] >> 8) & 0xff) == devfn)
-			return np;
+		if (reg && psize >= 4) {
+			if (((reg[0] >> 8) & 0xff) == devfn)
+				return np;
+		}
+		if (!strcmp(np->name, "multifunc-device")) {
+			np_sub = scan_OF_for_pci_dev(np, devfn);
+			if (np_sub)
+				return np_sub;
+		}
 	}
 	return NULL;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] "multifunc-device": fix IRQ assignment by also scanning dummy nodes
  2009-01-05 20:00 [RFC PATCH] "multifunc-device": fix IRQ assignment by also scanning dummy nodes Tom Arbuckle
@ 2009-01-20 19:17 ` Tom Arbuckle
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Arbuckle @ 2009-01-20 19:17 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

Did anybody pick up on this patch necessary to have OF understand
so-called "multifunc-devices". I received no feedback on it.

I note that the problem persists with 2.6.28.1 (although it was
introduced by the PCI reorg for 2.6.20). File pci_32.c is unchanged in
the latest release.

Regards,


Tom Arbuckle

Homepage: http://www.ece.ul.ie/homepage/Tom_Arbuckle/
LinkedIn: http://www.linkedin.com/in/tomarbuckle


---------- Original message ----------

Kernel: 2.6.28; function: scan_OF_pci_childs; file: arch/powerpc/kernel/pci_32.c
Quoting from line 206 : 'some OFs create a parent node "multifunc-device" as a
fake root for all functions of a multi-function device. we go down
them as well.'

Function scan_OF_for_pci_dev (line 225) also needs to be taught about
these dummy nodes to prevent misallocation/non-allocation of IRQs for
this class of devices.

Why RFC? I have chosen to scan all 'unusual' nodes as possible
multifunc-devices. Is this too many?

Bug seen when using a bt878 multimedia controller card on a G3 Powermac.
This PCI card has separate audio and video nodes and was not being properly
assigned interrupts. (Either 'cannot grab irq 0' or type of assigned
interrupt wrt 'edge/level' was incorrect).

Signed off by: Tom Arbuckle <tom.d.arbuckle (at) gmail.com>


--- linux-2.6.28/arch/powerpc/kernel/pci_32.c.orig      2008-12-27
16:32:48.000000000 +0000
+++ linux-2.6.28/arch/powerpc/kernel/pci_32.c   2008-12-27
16:36:15.000000000 +0000
@@ -226,15 +226,21 @@ static struct device_node *scan_OF_for_p
                                              unsigned int devfn)
 {
       struct device_node *np;
+       struct device_node *np_sub = NULL;
       const u32 *reg;
       unsigned int psize;

       for_each_child_of_node(parent, np) {
               reg = of_get_property(np, "reg", &psize);
-               if (reg == NULL || psize < 4)
-                       continue;
-               if (((reg[0] >> 8) & 0xff) == devfn)
-                       return np;
+               if (reg && psize >= 4) {
+                       if (((reg[0] >> 8) & 0xff) == devfn)
+                               return np;
+               }
+               if (!strcmp(np->name, "multifunc-device")) {
+                       np_sub = scan_OF_for_pci_dev(np, devfn);
+                       if (np_sub)
+                               return np_sub;
+               }
       }
       return NULL;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-20 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 20:00 [RFC PATCH] "multifunc-device": fix IRQ assignment by also scanning dummy nodes Tom Arbuckle
2009-01-20 19:17 ` Tom Arbuckle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).