Subject: IST_* constants
To: None <tech-kern@NetBSD.ORG>
From: Charles M. Hannum <>
List: tech-kern
Date: 03/27/1996 13:39:32
It's come to my attention that some people don't understand what the
IST_* constants are for.  I will attempt to explain their purpose

The need for them comes from the fact that different pieces of
hardware expect interrupts to be triggered in different ways.  It's
very important, for example, that an IRQ being used for an
edge-triggered device not be configured for level-trigger mode, or you
could get a flood of spurious interrupts.

There are two purposes to the `interrupt sharing types':

1) to inform the low-level code how to properly configure the PIC[*],

2) to prevent mixing and matching handlers for devices that treat the
IRQ incompatibly.

It should then be obvious where the names `IST_EDGE' and `IST_LEVEL'
come from; they simply correspond to the triggering mode the device
expects to use.

The origin of `IST_PULSE' is a little more complicated.  There are
some devices, like the PC timer chip and some types of mice, that
simply generate interrupts periodically.  Some devices of this nature
could just use `IST_EDGE' or `IST_LEVEL', as appropriate, and work
fine.  However, if the device is edge-triggered and doesn't give you
any way to determine that it generated the interrupt on that IRQ, then
it can't correctly share the IRQ with any other device.  In this case,
the lame device should use `IST_PULSE', to indicate that the IRQ must
not be shared.

For busses that only support level-trigger, it's okay to not bother
having the sharing types; this is why they're primarily useful for
busses used in PCs.

[*] The i386 port currently takes a couple of shortcuts in how it
configures the PICs, which I hope to get 'round to fixing RSN.