| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: pci_intr.9,v 1.20 2015/08/06 06:56:00 wiz Exp $ | | 1 | .\" $NetBSD: pci_intr.9,v 1.21 2015/10/13 04:34:38 msaitoh Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2000 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2000 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This code is derived from software contributed to The NetBSD Foundation | | 6 | .\" This code is derived from software contributed to The NetBSD Foundation |
7 | .\" by Bill Sommerfeld | | 7 | .\" by Bill Sommerfeld |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -17,50 +17,52 @@ | | | @@ -17,50 +17,52 @@ |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd August 4, 2015 | | 30 | .Dd October 13, 2015 |
31 | .Dt PCI_INTR 9 | | 31 | .Dt PCI_INTR 9 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm pci_intr , | | 34 | .Nm pci_intr , |
35 | .Nm pci_intr_map , | | 35 | .Nm pci_intr_map , |
36 | .Nm pci_intr_string , | | 36 | .Nm pci_intr_string , |
37 | .Nm pci_intr_evcnt , | | 37 | .Nm pci_intr_evcnt , |
38 | .Nm pci_intr_establish , | | 38 | .Nm pci_intr_establish , |
39 | .Nm pci_intr_disestablish | | 39 | .Nm pci_intr_disestablish |
| | | 40 | .Nm pci_intr_setattr |
40 | .Nd PCI bus interrupt manipulation functions | | 41 | .Nd PCI bus interrupt manipulation functions |
41 | .Sh SYNOPSIS | | 42 | .Sh SYNOPSIS |
42 | .In dev/pci/pcivar.h | | 43 | .In dev/pci/pcivar.h |
43 | .Ft int | | 44 | .Ft int |
44 | .Fn pci_intr_map "const struct pci_attach_args *pa" "pci_intr_handle_t *ih" | | 45 | .Fn pci_intr_map "const struct pci_attach_args *pa" "pci_intr_handle_t *ih" |
45 | .Ft const char * | | 46 | .Ft const char * |
46 | .Fn pci_intr_string "pci_chipset_tag_t pc" "pci_intr_handle_t ih" "char *buf" "size_t len" | | 47 | .Fn pci_intr_string "pci_chipset_tag_t pc" "pci_intr_handle_t ih" "char *buf" "size_t len" |
47 | .Ft const struct evcnt * | | 48 | .Ft const struct evcnt * |
48 | .Fn pci_intr_evcnt "pci_chipset_tag_t pc" "pci_intr_handle_t ih" | | 49 | .Fn pci_intr_evcnt "pci_chipset_tag_t pc" "pci_intr_handle_t ih" |
49 | .Ft void * | | 50 | .Ft void * |
50 | .Fn pci_intr_establish "pci_chipset_tag_t pc" "pci_intr_handle_t ih" \ | | 51 | .Fn pci_intr_establish "pci_chipset_tag_t pc" "pci_intr_handle_t ih" \ |
51 | "int ipl" "int (*intrhand)(void *)" "void *intrarg" | | 52 | "int ipl" "int (*intrhand)(void *)" "void *intrarg" |
52 | .Ft void | | 53 | .Ft void |
53 | .Fn pci_intr_disestablish "pci_chipset_tag_t pc" "void *ih" | | 54 | .Fn pci_intr_disestablish "pci_chipset_tag_t pc" "void *ih" |
| | | 55 | .Fn pci_intr_setattr "pci_chipset_tag_t pc" "pci_intr_handle_t *ih" "int attr" "uint64_t data" |
54 | .Sh DESCRIPTION | | 56 | .Sh DESCRIPTION |
55 | The | | 57 | The |
56 | .Nm | | 58 | .Nm |
57 | functions exist to allow device drivers machine-independent access to | | 59 | functions exist to allow device drivers machine-independent access to |
58 | PCI bus interrupts. | | 60 | PCI bus interrupts. |
59 | The functions described in this page are typically declared in a port's | | 61 | The functions described in this page are typically declared in a port's |
60 | .In machine/pci_machdep.h | | 62 | .In machine/pci_machdep.h |
61 | header file; however, drivers should generally include | | 63 | header file; however, drivers should generally include |
62 | .In dev/pci/pcivar.h | | 64 | .In dev/pci/pcivar.h |
63 | to get other PCI-specific declarations as well. | | 65 | to get other PCI-specific declarations as well. |
64 | .Pp | | 66 | .Pp |
65 | Each driver has an | | 67 | Each driver has an |
66 | .Fn attach | | 68 | .Fn attach |
| @@ -101,26 +103,44 @@ to actually establish the handler; when | | | @@ -101,26 +103,44 @@ to actually establish the handler; when |
101 | will be called with a single argument | | 103 | will be called with a single argument |
102 | .Fa intrarg , | | 104 | .Fa intrarg , |
103 | and will run at the interrupt priority level | | 105 | and will run at the interrupt priority level |
104 | .Fa ipl . | | 106 | .Fa ipl . |
105 | .Pp | | 107 | .Pp |
106 | The return value of | | 108 | The return value of |
107 | .Fn pci_intr_establish | | 109 | .Fn pci_intr_establish |
108 | may be saved and passed to | | 110 | may be saved and passed to |
109 | .Fn pci_intr_disestablish | | 111 | .Fn pci_intr_disestablish |
110 | to disable the interrupt handler | | 112 | to disable the interrupt handler |
111 | when the driver is no longer interested in interrupts from the device. | | 113 | when the driver is no longer interested in interrupts from the device. |
112 | .Pp | | 114 | .Pp |
113 | The | | 115 | The |
| | | 116 | .Fn pci_intr_setattr |
| | | 117 | function sets an attribute |
| | | 118 | .Fa attr |
| | | 119 | of the interrupt handler to |
| | | 120 | .Fa data . |
| | | 121 | Currenty, only the following attribute is supported: |
| | | 122 | .Bl -tag -width PCI_INTR_MPSAFE |
| | | 123 | .It Dv PCI_INTR_MPSAFE |
| | | 124 | If this attribute is set to |
| | | 125 | .Dv true , |
| | | 126 | it specifies that the interrupt handler is multiprocessor safe and works its |
| | | 127 | own locking; otherwise the kernel lock will be held for the call to the |
| | | 128 | interrupt handler. |
| | | 129 | The default is |
| | | 130 | .Dv false . |
| | | 131 | .El |
| | | 132 | .Pp |
| | | 133 | The |
114 | .Fn pci_intr_evcnt | | 134 | .Fn pci_intr_evcnt |
115 | function should return an evcnt structure pointer or | | 135 | function should return an evcnt structure pointer or |
116 | .Dv NULL | | 136 | .Dv NULL |
117 | if there is no evcnt associated with this interrupt. | | 137 | if there is no evcnt associated with this interrupt. |
118 | See | | 138 | See |
119 | .Xr evcnt 9 | | 139 | .Xr evcnt 9 |
120 | for more details. | | 140 | for more details. |
121 | .Ss PORTING | | 141 | .Ss PORTING |
122 | A port's implementation of | | 142 | A port's implementation of |
123 | .Fn pci_intr_map | | 143 | .Fn pci_intr_map |
124 | may use the following members of | | 144 | may use the following members of |
125 | .Ft struct pci_attach_args | | 145 | .Ft struct pci_attach_args |
126 | to determine how the device's interrupts are routed. | | 146 | to determine how the device's interrupts are routed. |