Port-powerpc archive

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

Re: Interrupt handling and routing: The Big Picture

Jochen Kunz wrote:

> Finally I stated to hack port-ofppc to support my Efika.

That's great! I always wanted to start with it myself, but I repeatedly
decided to work on other hardware first, because Efika-support is so
difficult to add.

I have three Efikas here. One is running MorphOS.

Also Robert Swindells tried to start a port some time ago:

> Interrupts are next on the plan. The MPC5200 has its own, special
> interrupt controller that is not compatible to any other interrupt
> controller like OpenPIC. So everything in that area has to be coded new
> from the ground up.

Yes. This is one of the reasons which frightened me away from it. The others
are the many MPC5200-specific embedded devices, which you need to support.

I found the MPC5200B User's Manual very hard to read. I was always confused
what the meaning of local-bus and XLB-bus is... ;)

> I tried to reverse engineer the existing code.
> (arch/ofppc/ofppc/mainbus.c:init_ofppc_interrupt(),
> arch/powerpc/pci/pci_machdep_ofw.c:genofw_find_ofpics(), stuff in
> arch/powerpc/pic/) But I am lost. I simply don't get The Big Picture
> about how all this works and how different parts of the kernel
> interact. (Is genofw_find_ofpics() only usable on PCI busses? Seems not
> to me but it is located in pci_machdep_ofw.c)

You're right. I don't see much reasons that genofw_find_ofpics() is in
pci_machdep_ofw.c either. Maybe it should be in powerpc/ofw_machdep.c.

> It would be a big help
> for me if a PPC guru would explain the general concepts of interrupt
> handling and routing in the NetBSD kernel in genral and in particular
> for PPC ports.

Compared to earlier times the interrupt handling for PPC has much
simplified. The most important file is powerpc/pic/intr.c. There you have
intr_establish() and intr_disestablish().

It is responsible for calling the hardware-dependant PIC functions, which
are implemented in powerpc/pic/pic_*.c.

To support the MPC5200 PIC you probably have to do two things:
- Implement powerpc/pic/pic_mpc5200.c. It just contains the hw-dependant
  functions for establising/disestablishing, enalbing/disabling interrupts.
- Define a new PICNODE_TYPE_5200 and detect it in genofw_find_ofpics().
  You may even check the model_name for it, when there is no other way to
  find it.

Make sure to have a look at pic_mpcsoc.c (which is used for the MPC824x, for
example). There may be similarities to the MPC5200 PIC.

Frank Wille

Home | Main Index | Thread Index | Old Index