Port-powerpc archive

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

Re: ext_intr thoughts



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Apr 27, 2007, at 03:04, Tim Rightnour wrote:

Looking at all the ext_intr() routines, they all seem to be more or less
indentical, except:

each one needs a struct intrsource that has all the interrupt sources/handlers
each one needs an int imen;
each one needs a get_irq(), mask_irq() and eoi_irq() function.

Based on this.. I think we could write just one, but we need to do two things:

1) for the openpic+ISA case, we want to register the ext_intr routine with isa
irq bits as the handler for irq 0.

2) when we initially install the ext_intr handler, we want to specify which set
of routines to use.

What I'm not sure of, is how we can make just one routine, and have it do the right thing. Any ideas here? (ie, register it once as the primary external interrupt handler, and then register it again, but this time as the isa handler
for the cascaded openpic interrupt)

I think we should have something like this:
struct pic_ops {
        int pic_irq_base;       /* first IRQ number this PIC deals with */
        int pic_num_irqs;       /* ho many IRQs does it handle */
        void *pic_cookie;       /* pointer to the hardware? */
        int (*pic_init)(void *);        /* initialize the PIC */
        void (*pic_extint)(void *);     /* take an interrupt or more */
        void *(*pic_establish)(...);    /* establish a handler on this PIC */
        void (*pic_disestablish)();     /* get rid of a handler */
};

Each method takes a (struct pic_ops *) as first parameter.

The extintr() we register globally would be the 'master' pic ( 1st ohare or heathrow, OpenPIC etc. ), then we register any secondary PIC's extintr() ( 8259, another ohare or heathrow ) with its parent as ordinary interrupt handler. The global (dis)establish() functions would have to walk a (short) table to figure out which global IRQ number corresponds to what number on what PIC - unproblematic I think since we don't switch around handlers very often. What we'd still need globally is do_pending_intrs(), mapping hw IRQ numbers to something do_pending_intrs() understands, spl stuff, etc. Not sure if we'd need mask/unmask functions - on macppc they're never called from outside extintr.c IIRC, each PIC handles masking/unmasking of pending or blocked IRQs on its own, as in an IRQ is masked if it fires and found to be blocked by spl - then we just mark it pending instead of calling any handler.

Did I miss anything?

have fun
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iQEVAwUBRjH6qspnzkX8Yg2nAQK2PwgAif2s9axm9bC2ES7MHFRVk8tu6yUJAMKW
lWDvMNL0aZtwv3Hr/8SzgBA9q2yVITevfBmCwRK8aXP4p6tZKWeAXv0Zw+WuYIgN
KRKhvcIS2lhg5vrOPh9n8nYlOQdgGKQ2ck5Rmkqa+1DzXGQVKEZpMGs9QR3uoDP7
+icQYUIJoF1gvHAdAkUp31H/CjoLHTzGe2OrCQYM5Nh9D7ibJs+QCJhTPeCPzIh5
czZpIMYrJ9/ohXZ23Y1ZPFXGAHNMKkqby8Lj/zfsuOJsTcNugTF9Wvj9n282jJKO
ZoBL8nn9dCxKjIodolZFscv2DM8prqSSreFtTAhja+sU3WI0aV2Pog==
=r1hP
-----END PGP SIGNATURE-----




Home | Main Index | Thread Index | Old Index