spl(D3DK) —
.IX \f4spl\fP(D3DK)
NAME
spl − block/allow interrupts on a processor
SYNOPSIS
pl_t splbase();
pl_t spltimeout();
pl_t spldisk();
pl_t splstr();
pl_t splhi();
pl_t splx(pl_t oldlevel);
ARGUMENTS
oldlevelLast set priority value (only splx has an input argument).
DESCRIPTION
The spl functions block or allow servicing of interrupts on the processor on which the function is called. Hardware devices are assigned to interrupt priority levels depending on the type of device. Each spl function which blocks interrupts is associated with some machine dependent interrupt priority level and will prevent interrupts occurring at or below this priority level from being serviced on the processor on which the spl function is called.
On a multiprocessor system, interrupts may be serviced by more than one processor and, therefore, use of a spl function alone is not sufficient to prevent interrupt code from executing and manipulating driver data structures during a critical section. Drivers that must prevent execution of interrupt-level code in order to protect the integrity of their data should use basic locks or read/write locks for this purpose [see LOCK_ALLOC(D3DK) or RW_ALLOC(D3DK)].
The spl functions include the following:
| splbase | Block no interrupts. |
| spltimeout | Block functions scheduled by itimeout and dtimeout. |
| spldisk | Block disk device interrupts. |
| splstr | Block STREAMS interrupts. |
| splhi | Block all interrupts. |
Calling a given spl function will block interrupts specified for that function as well as interrupts at equal and lower levels. The notion of low vs. high levels assumes a defined order of priority levels. The following partial order is defined:
splbase <= spltimeout <= spldisk,splstr <= splhi
The ordering of spldisk and splstr relative to each other is not defined.
RETURN VALUE
All spl functions return the previous priority level.
NOTES
All spl functions do not sleep.
Driver defined basic locks and read/write locks may be held across calls to these functions, but the spl call must not cause the priority level to be lowered below the level associated with the lock.
Driver defined sleep locks may be held across calls to these functions.
When setting a given priority level, the previous level returned should be saved and splx, UNLOCK(D3DK), or RW_UNLOCK(D3DK) should be used as appropriate to restore this level.
Interrupt-level code must never lower the interrupt priority level below the level at which the interrupt handler was entered. For example, if an interrupt handler is entered at the priority level associated with spldisk, the handler must not call spltimeout.
SEE ALSO
LOCK(D3DK), LOCK_ALLOC(D3DK), RW_RDLOCK(D3DK), RW_UNLOCK(D3DK), RW_WRLOCK(D3DK), RW_ALLOC(D3DK)
DDI