PowerPC/Openpic interrupt problem (bug?)
VALETTE Eric
valette at crf.canon.fr
Mon Jun 25 07:47:27 UTC 2001
Till Straumann wrote:
> Hi.
>
> I wanted to connect an IRQ handler to one of the openpic's timers using
>
> BSP_install_rtems_irq_handler().
>
> The first interrupt crashed the system.
>
> That's what I found:
>
> - BSP_install_rtems_irq_handler(irqData) interprets irqData->name
> as an IRQ "level" which must lie in the range
>
> BSP_LOWEST_OFFSET..BSP_MAX_OFFSET
>
> (roughly 16 ISA irqs + 16 PCI irqs). If the level is found to be
> valid, the handler
> is installed in
>
> rtems_hdl_tbl[d->name];
>
> - However, when it comes to handle the interrupt, RTEMS' global handler
>
> reads the irq VECTOR from the openpic and uses it as the table
> index:
>
> irq=openpic_irq(0);
> ...
> rtems_hdl_tbl[irq].hdl();
>
> Obviously, if the vector number and the IRQ level disagree, the wrong
> table entry is dispatched.
>
> Was it a deliberate decision to implicitely assume/enforce that IRQ
> level and vector numbers are identical? IMO using the vector number as
> the table index (reserving the lower numbers for ISA irqs) would be
> cleaner and would allow for sharing of levels among devices.
Well I assume the contrary irq index and openpic index are the same
except for the isa irqs which are multiplexed on irq 0.
Rationale for the decision is that PCI irq are handled by the openpic
and must be as fast as possible (removing the need for computation while
isa interrupt are slower anyway as we need to manipualte two interrupt
controllers. Anyway you must have offset either for ISA or PCI. I prefer
to have offset for ISA legacy hardware.
Note that this is the way Linux does and if you look at the code for
serial line you will see how to correct ISA interrupt correctly.
My choice as code author :-)
--
__
/ ` Eric Valette - Canon CRF
/-- __ o _. Canon Development Europe Team Leader
(___, / (_(_(__ Rue de la touche lambert
35517 Cesson-Sevigne Cedex
FRANCE
Tel: +33 (0)2 99 87 68 91 Fax: +33 (0)2 99 84 11 30
E-mail: valette at crf.canon.fr http://www.crf.canon.fr
More information about the users
mailing list