|
|
int prefixintr(void *idata);
The interrupt handler is responsible for determining the reason for an interrupt, servicing the interrupt, and waking up any threads that are blocked waiting for an event associated with the interrupt.
For example, when a disk drive has transferred information to the host to satisfy a read request, the disk drive's controller generates an interrupt. The CPU acknowledges the interrupt and calls the interrupt handler associated with that controller and disk drive. The interrupt routine services the interrupt and then signals completion of the I/O with the biodone(D3) function, which unblocks any threads that are blocked with the biowait(D3) function, waiting on this request. The base-level portion of the driver then conveys the data to the user.
In general, most interrupt routines do the following tasks:
There are also many tasks the intr routine must perform that are driver-type and device specific. For example, the following types of drivers require different functions from their intr routines:
In addition, the functions of an intr routine are device dependent. You should know the exact chip set that produces the interrupt for your device. You need to know the exact bit patterns of the device's control and status register and how data is transmitted into and out of your computer. These specifics differ for every device you access.
The intr routine for an adapter that does not use individual interrupt vectors for each subdevice must access the adapter's status to determine which subdevice generated the interrupt. It must also update the status information, set/clear flags, set/clear error indicators, and so forth to complete the handling of a job. The code should also be able to handle a spurious completion interrupt identified by an empty completion queue. When the routine finishes, it should advance the unload pointer to the next entry in the completion queue.
If the driver blocked with a syncronization primitive in HDK Technical Reference to await the completion of an operation, the intr( ) routine must call an appropriate function to signal the process to resume:
The interrupt routine runs at the interrupt priority level (IPL) in HDK Technical Reference that is associated with the interrupt level for the given device. Lower priority interrupts are deferred while the interrupt routine is active. See spl(D3) for more information.
The intr routine must never
drop the interrupt priority level
below the level at which the interrupt routine was entered
or call the
uiomove(D3),
ureadc(D3),
or
uwritec(D3)
functions
when the uio_segflg
member of the
uio(D4)
structure
is set to UIO_USERSPACE
(indicating a transfer between user and kernel space).
void prefixintr(int ivec);
ivec is a number used by the operating system to associate a driver's interrupt handler with an interrupting device. The makeup and interpretation of ivec is specific to each system implementation. On some systems, this number may be the logical device number, or a combination of logical device and logical controller numbers, used to map the correct interrupt routine with a subdevice. On others, this number could be the interrupt vector number.
For non-loadable or non-autoconfigured DDI versions prior to version 8 that use the mod_drvattach(D3) function to attach interrupts, intr( ) is a named entry point and must be defined as a global symbol with the $entry intr string in the driver's Master(DSP/4dsp) file.
``Interrupts'' in HDK Technical Reference
``Interrupt handlers, attaching and registering'' in HDK Technical Reference