Subject: Re: [PATCH] powerpc: Fix irq routing on some PowerMac 32 bits

From: Zang Roy-r61911 <[email-masked]>
Date: 10 Jan 2007 16:57:20 +0800

On Wed, 2007-01-10 at 11:58, Benjamin Herrenschmidt wrote:
> > Stop here.
> 
> Probably the log is just the last console output you got from the
> early
> console before it switched to the main one. Do you use udbg on these
> boards for early boot messages ? If yes, have you tried the
> udbg-immortal option ? (Or just prevent udbg from unregistering).
> 
> Do you have access to a HW debugging tool maybe to trace what's going
> on ?
> 
> I have no idea what's wrong at this point, though it's likely to be a
> problem with your device-tree, I can't verify it without a bit more
> debug data. Have you tried adding some debug infos to the new
> implementation of pci_device_to_OF_node(), check how it's called and
> what it returns ? That might give you a clue about the problem.

Thanks for all your suggestions. I had thought you could point out where
was wrong :-). Now, I have to trace it myself. I do not have HW
debugging tools, I only have printk().

I catch the bug. In your patch:

+       /* not a root bus, we need to get our parent */
+       parent = scan_OF_for_pci_bus(bus->parent);
+       if (parent == NULL)
+               return NULL;
+
+       /* now iterate for children for a match */
+       np = scan_OF_for_pci_dev(parent, bus->self->devfn);
+       of_node_put(parent);
+
+       /* sanity check */
+       if (strcmp(np->type, "pci") != 0)
+               printk(KERN_WARNING "pci: wrong type \"%s\" for bridge %s\n",
+                      np->type, np->full_name);

I think you should judge np != NULL before using it.  If np == NULL,
np->type will cause memory access error. On CDS and some other Freescle
board, such as 8641HPCN, there is pci bridge, np = NULL , this will
cause error.
If you agree, you or I will provide a patch to fix it:-).
Thanks.
Roy