128 lines
4.0 KiB
Plaintext
128 lines
4.0 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/spl @(#)spl 43.15 of 3/25/93
|
|
.\" Copyright 1991, 1992 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} spl D3 "" "DDI" "\&"
|
|
.if \nX=1 .ds x} spl D3 "" "DDI"
|
|
.if \nX=2 .ds x} spl D3 "" "\&"
|
|
.if \nX=3 .ds x} spl "" "" "\&"
|
|
.TH spl D3
|
|
.IX "\f4spl\fP(D3)"
|
|
.SH NAME
|
|
\f4spl\f1 \- block/allow interrupts on a processor
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
int splbase(void);
|
|
int spltimeout(void);
|
|
int spldisk(void);
|
|
int splstr(void);
|
|
int spltty(void);
|
|
int splhi(void);
|
|
int spl0(void);
|
|
int spl7(void);
|
|
.sp 0.4
|
|
void splx(int \f2oldlevel\fP);
|
|
.ft 1
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2oldlevel\f1" 10n
|
|
Last set priority value (only \f4splx\f1 has an input argument).
|
|
.RE
|
|
.SH DESCRIPTION
|
|
The \f4spl\f1 functions block or allow servicing of interrupts on the processor
|
|
on which the function is called.
|
|
.SS "Return Values"
|
|
All \f4spl\f1 functions except \f4splx\f1 return the previous priority level for use by \f4splx\f1.
|
|
.SH USAGE
|
|
Hardware devices are assigned to interrupt priority levels
|
|
depending on the type of device.
|
|
Each \f4spl\f1 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 \f4spl\f1 function is called.
|
|
.P
|
|
On a multiprocessor system, interrupts may be serviced by more than
|
|
one processor and, therefore, use of a \f4spl\f1 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
|
|
for this purpose [see \f4LOCK_ALLOC\f1(D3)].
|
|
.P
|
|
The \f4spl\f1 functions include the following:
|
|
.IP \f4splbase\fP 13n
|
|
Block no interrupts.
|
|
Should only be used by base-level code
|
|
that knows it is not nested within any section of protected critical code.
|
|
.IP \f4spltimeout\fP
|
|
Block functions scheduled by \f4itimeout\fP and \f4dtimeout\fP.
|
|
.IP \f4spldisk\fP
|
|
Block disk device interrupts.
|
|
.IP \f4splstr\fP
|
|
Block STREAMS interrupts.
|
|
.IP \f4spltty\fP
|
|
Used by a TTY driver to protect critical code.
|
|
\f4spltty\fP is mapped to \f4splstr\fP.
|
|
.IP \f4splhi\fP
|
|
Block all interrupts.
|
|
Can be used in any type of driver to mask out all interrupts
|
|
including the clock,
|
|
and should be used very sparingly.
|
|
.IP \f4spl0\fP
|
|
Equivalent to \f4splbase\fP.
|
|
.IP \f4spl7\fP
|
|
Equivalent to \f4splhi\fP.
|
|
.P
|
|
To ensure driver portability,
|
|
the named \f4spl\fP functions
|
|
(such as \f4splbase\fP or \f4spltimeout\fP)
|
|
should be used whenever possible.
|
|
The numbered \f4spl\fP functions
|
|
(\f4spl0\fP and \f4spl7\fP)
|
|
should be used only when an interrupt priority level
|
|
must be set to a specific value.
|
|
.P
|
|
Calling a given \f4spl\f1 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:
|
|
.P
|
|
.RS
|
|
.ft 4
|
|
splbase <= spltimeout <= spldisk,splstr <= splhi
|
|
.ft 1
|
|
.RE
|
|
The ordering of \f4spldisk\f1 and \f4splstr\f1 relative to each other
|
|
is not defined.
|
|
.P
|
|
When setting a given priority level, the previous level returned should
|
|
be saved and \f4splx\f1 or \f4UNLOCK\f1(D3)
|
|
should be used as appropriate to restore this level.
|
|
.P
|
|
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 \f4spldisk\f1, the handler must not call \f4spltimeout\f1.
|
|
.SS Level
|
|
Base or Interrupt.
|
|
.SS "Synchronization Considerations"
|
|
All \f4spl\f1 functions do not sleep.
|
|
.P
|
|
Driver-defined basic locks and read/write locks may be held across
|
|
calls to these functions, but the \f4spl\f1 call must not cause
|
|
the priority level to be lowered below the level associated with the lock.
|
|
.P
|
|
Driver-defined sleep locks may be held across calls to these functions.
|
|
.SH REFERENCES
|
|
.na
|
|
\f4LOCK\f1(D3),
|
|
\f4LOCK_ALLOC\f1(D3),
|
|
.ad
|