| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: msipic.c,v 1.11 2017/07/28 14:26:50 maxv Exp $ */ | | 1 | /* $NetBSD: msipic.c,v 1.12 2019/04/01 06:20:40 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2015 Internet Initiative Japan Inc. | | 4 | * Copyright (c) 2015 Internet Initiative Japan Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.11 2017/07/28 14:26:50 maxv Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.12 2019/04/01 06:20:40 msaitoh Exp $"); |
31 | | | 31 | |
32 | #include "opt_intrdebug.h" | | 32 | #include "opt_intrdebug.h" |
33 | | | 33 | |
34 | #include <sys/types.h> | | 34 | #include <sys/types.h> |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/errno.h> | | 37 | #include <sys/errno.h> |
38 | #include <sys/kmem.h> | | 38 | #include <sys/kmem.h> |
39 | #include <sys/mutex.h> | | 39 | #include <sys/mutex.h> |
40 | | | 40 | |
41 | #include <dev/pci/pcivar.h> | | 41 | #include <dev/pci/pcivar.h> |
42 | | | 42 | |
43 | #include <machine/i82489reg.h> | | 43 | #include <machine/i82489reg.h> |
| @@ -84,27 +84,27 @@ struct msipic { | | | @@ -84,27 +84,27 @@ struct msipic { |
84 | bus_size_t mp_bssize; | | 84 | bus_size_t mp_bssize; |
85 | struct pic *mp_pic; | | 85 | struct pic *mp_pic; |
86 | | | 86 | |
87 | LIST_ENTRY(msipic) mp_list; | | 87 | LIST_ENTRY(msipic) mp_list; |
88 | }; | | 88 | }; |
89 | | | 89 | |
90 | static kmutex_t msipic_list_lock; | | 90 | static kmutex_t msipic_list_lock; |
91 | | | 91 | |
92 | static LIST_HEAD(, msipic) msipic_list = | | 92 | static LIST_HEAD(, msipic) msipic_list = |
93 | LIST_HEAD_INITIALIZER(msipic_list); | | 93 | LIST_HEAD_INITIALIZER(msipic_list); |
94 | | | 94 | |
95 | /* | | 95 | /* |
96 | * This struct managements "devid" to use the same "devid" for the device | | 96 | * This struct managements "devid" to use the same "devid" for the device |
97 | * re-attached. If the device's bus number and device numer and function | | 97 | * re-attached. If the device's bus number and device number and function |
98 | * number are equal, it is assumed re-attached. | | 98 | * number are equal, it is assumed re-attached. |
99 | */ | | 99 | */ |
100 | struct dev_last_used_seq { | | 100 | struct dev_last_used_seq { |
101 | bool ds_using; | | 101 | bool ds_using; |
102 | int ds_bus; | | 102 | int ds_bus; |
103 | int ds_dev; | | 103 | int ds_dev; |
104 | int ds_fun; | | 104 | int ds_fun; |
105 | }; | | 105 | }; |
106 | /* The number of MSI/MSI-X devices supported by system. */ | | 106 | /* The number of MSI/MSI-X devices supported by system. */ |
107 | #define NUM_MSI_DEVS 256 | | 107 | #define NUM_MSI_DEVS 256 |
108 | /* Record devids to use the same devid when the device is re-attached. */ | | 108 | /* Record devids to use the same devid when the device is re-attached. */ |
109 | static struct dev_last_used_seq dev_seqs[NUM_MSI_DEVS]; | | 109 | static struct dev_last_used_seq dev_seqs[NUM_MSI_DEVS]; |
110 | | | 110 | |