1ddi_intr_enable(9F)      Kernel Functions for Drivers      ddi_intr_enable(9F)
2
3
4

NAME

6       ddi_intr_enable,        ddi_intr_block_enable,        ddi_intr_disable,
7       ddi_intr_block_disable - enable or disable a given interrupt  or  range
8       of interrupts
9

SYNOPSIS

11       #include <sys/types.h>
12       #include <sys/conf.h>
13       #include <sys/ddi.h>
14       #include <sys/sunddi.h>
15
16
17
18       int ddi_intr_enable(ddi_intr_handle_t h);
19
20
21       int ddi_intr_block_enable(ddi_intr_handle_t *h_array, int count);
22
23
24       int ddi_intr_disable(ddi_intr_handle_t h);
25
26
27       int ddi_intr_block_disable(ddi_intr_handle_t *h_array, int count);
28
29

INTERFACE LEVEL

31       Solaris DDI specific (Solaris DDI).
32

PARAMETERS

34       ddi_intr_enable()
35
36       h    DDI interrupt handle
37
38
39
40       ddi_intr_block_enable()
41
42       h_array    Pointer to an array of DDI interrupt handles
43
44
45       count      Number of interrupts
46
47
48
49       ddi_intr_disable()
50
51       h    DDI interrupt handle
52
53
54
55       ddi_intr_block_disable()
56
57       h_array    Pointer to an array of DDI interrupt handles
58
59
60       count      Number of interrupts
61
62

DESCRIPTION

64       The  ddi_intr_enable()  function  enables  the  interrupt  given by the
65       interrupt handle h.
66
67
68       The ddi_intr_block_enable() function  enables  a  range  of  interrupts
69       given  by the count and h_array arguments, where count must be at least
70       1 and h_array is pointer to a count-sized array of interrupt handles.
71
72
73       The ddi_intr_block_enable() function can be used only if the device  or
74       host   bridge   supports   the   block   enable/disable   feature.  The
75       ddi_intr_get_cap() function returns the RO flag DDI_INTR_FLAG_BLOCK  if
76       the  device  or host bridge supports the interrupt block enable/disable
77       feature for the given interrupt type. The ddi_intr_block_enable() func‐
78       tion is useful for enabling MSI interrupts when the optional per-vector
79       masking capability is not supported.
80
81
82       The ddi_intr_enable()  or  ddi_intr_block_enable()  functions  must  be
83       called  after  the  required  interrupt  resources  are  allocated with
84       ddi_intr_alloc(),   the   interrupt   handlers   are   added    through
85       ddi_intr_add_handler(),  and  the  required  locks  are  initialized by
86       mutex(9F) or rwlock(9F).
87
88
89       Once enabled by either of the enable calls, the interrupt can be  taken
90       and  passed  to  the  driver's  interrupt  service routine. Enabling an
91       interrupt implies clearing any system or device  mask  bits  associated
92       with the interrupt.
93
94
95       The  ddi_intr_disable()  function  disables  the interrupt given by the
96       interrupt handle h.
97
98
99       The ddi_intr_block_disable() function disables a  range  of  interrupts
100       given  by the count and h_array arguments, where count must be at least
101       1 and h_array is pointer to a count-sized array of interrupt handles.
102
103
104       The ddi_intr_block_disable() function can be used only if the device or
105       host   bridge   supports   the   block   enable/disable   feature.  The
106       ddi_intr_get_cap() function returns the RO flag DDI_INTR_FLAG_BLOCK  if
107       the  device  or host bridge supports the interrupt block enable/disable
108       feature for the  given  interrupt  type.  The  ddi_intr_block_disable()
109       function  is useful for disabling MSI interrupts when the optional per-
110       vector masking capability is not supported.
111
112
113       The ddi_intr_disable() or ddi_intr_block_disable()  functions  must  be
114       called  before  removing  the  interrupt handler and freeing the corre‐
115       sponding interrupt with ddi_intr_remove_handler() and  ddi_intr_free(),
116       respectively. The ddi_intr_block_disable() function should be called if
117       the ddi_intr_block_enable() function was used to enable the interrupts.
118

RETURN VALUES

120       The ddi_intr_enable(), ddi_intr_block_enable(), ddi_intr_disable(), and
121       ddi_intr_block_disable() functions return:
122
123       DDI_SUCCESS    On success.
124
125
126       DDI_EINVAL     On encountering invalid input parameters.
127
128
129       DDI_FAILURE    On any implementation specific failure.
130
131

CONTEXT

133       The ddi_intr_enable(), ddi_intr_block_enable(), ddi_intr_disable(), and
134       ddi_intr_block_disable() functions can be called from kernel non-inter‐
135       rupt context.
136

ATTRIBUTES

138       See attributes(5) for descriptions of the following attributes:
139
140
141
142
143       ┌─────────────────────────────┬─────────────────────────────┐
144       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
145       ├─────────────────────────────┼─────────────────────────────┤
146       │Interface Stability          │Committed                    │
147       └─────────────────────────────┴─────────────────────────────┘
148

SEE ALSO

150       attributes(5),       ddi_intr_add_handler(9F),      ddi_intr_alloc(9F),
151       ddi_intr_dup_handler(9F),   ddi_intr_free(9F),    ddi_intr_get_cap(9F),
152       ddi_intr_remove_handler(9F), mutex(9F), rwlock(9F)
153
154
155       Writing Device Drivers
156

NOTES

158       Consumers  of  these  interfaces should verify that the return value is
159       not equal to DDI_SUCCESS. Incomplete checking for failure  codes  could
160       result in inconsistent behavior among platforms.
161
162
163       If  a  device  driver  that  uses  MSI  and MSI-X interrupts resets the
164       device, the device might reset its configuration  space  modifications.
165       Such  a  reset  could  cause  a device driver to lose any MSI and MSI-X
166       interrupt usage settings that have been applied.
167
168
169
170SunOS 5.11                        22 Apr 2005              ddi_intr_enable(9F)
Impressum