Questions on interrupt vector assignment on MPC8641D
Scott Wood
scottwood at freescale.com
Fri Oct 8 07:26:26 EST 2010
On Thu, 7 Oct 2010 15:12:26 -0500
<david.hagood at gmail.com> wrote:
> > On Tue, 21 Sep 2010 17:37:15 -0400
> > The MPIC interrupt numberspace in the device tree (which is not
> > virtual; it is a private numberspace to MPIC) is based on the offset of
> > the registers for that interrupt source. External interrupts start at
> > zero (which is valid), internal at 16, and special things like MSIs at
> > higher numbers (I don't think it's quite 256).
>
> OK, so I'm slowly wrapping my head around this (OT: Has anybody considered
> sending this information to the folks doing the Linux Device Drivers
> books? They are just a bit x86 centric right now...).
>
> As I understand, what I have to do is somehow get a device_node *, then
> make a call to irq_of_parse_and_map() to convert that into a system IRQ.
>
> What I am doing right now is:
> device_node *mpic = of_find_node_by_type(0,"open-pic");
> irq = irq_of_parse_and_map(mpic,256);
This is asking for the 256th specifier in the interrupts property in
the mpic node -- not what you want.
Ideally you would have a node for your device with an interrupt
specifier that you could look up with irq_of_parse_and_map(). But if
not, you can use irq_create_mapping() to directly convert an MPIC IRQ
number to a virtual IRQ.
What interrupt are you trying to select with 256? That doesn't look
like a valid MPIC interrupt number.
> 2) How do I know for certain that 256 is the right value for the first MSI
> signaled via MSIR0?
It isn't. The vector/priority register (MSIVPR0) is at offset
0x51c00. Each interrupt source is 32 bytes. The first interrupt
source is at 0x50000.
So the interrupt number is (0x51c00 - 0x50000) / 32 = 224.
BTW, the MSIs are already described in an msi node in the device tree.
Are you trying to do something different with them than PCI MSIs? If
not, is the existing MSI driver not working? If you are trying to do
something different, you should bind to that node yourself and use
irq_of_parse_and_map() on it.
-Scott
More information about the Linuxppc-dev
mailing list