| @@ -1,40 +1,40 @@ | | | @@ -1,40 +1,40 @@ |
1 | /* $NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.3 2018/08/27 07:40:40 riastradh Exp $ */ | | 1 | /* $NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.4 2018/12/19 09:20:56 maya Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2015 Red Hat Inc. | | 4 | * Copyright 2015 Red Hat Inc. |
5 | * | | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | | 7 | * copy of this software and associated documentation files (the "Software"), |
8 | * to deal in the Software without restriction, including without limitation | | 8 | * to deal in the Software without restriction, including without limitation |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 | * and/or sell copies of the Software, and to permit persons to whom the | | 10 | * and/or sell copies of the Software, and to permit persons to whom the |
11 | * Software is furnished to do so, subject to the following conditions: | | 11 | * Software is furnished to do so, subject to the following conditions: |
12 | * | | 12 | * |
13 | * The above copyright notice and this permission notice shall be included in | | 13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. | | 14 | * all copies or substantial portions of the Software. |
15 | * | | 15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
22 | * OTHER DEALINGS IN THE SOFTWARE. | | 22 | * OTHER DEALINGS IN THE SOFTWARE. |
23 | * | | 23 | * |
24 | * Authors: Ben Skeggs <bskeggs@redhat.com> | | 24 | * Authors: Ben Skeggs <bskeggs@redhat.com> |
25 | */ | | 25 | */ |
26 | #include <sys/cdefs.h> | | 26 | #include <sys/cdefs.h> |
27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.3 2018/08/27 07:40:40 riastradh Exp $"); | | 27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.4 2018/12/19 09:20:56 maya Exp $"); |
28 | | | 28 | |
29 | #include "priv.h" | | 29 | #include "priv.h" |
30 | #include "agp.h" | | 30 | #include "agp.h" |
31 | | | 31 | |
32 | #include <core/option.h> | | 32 | #include <core/option.h> |
33 | #include <core/pci.h> | | 33 | #include <core/pci.h> |
34 | #include <subdev/mc.h> | | 34 | #include <subdev/mc.h> |
35 | | | 35 | |
36 | u32 | | 36 | u32 |
37 | nvkm_pci_rd32(struct nvkm_pci *pci, u16 addr) | | 37 | nvkm_pci_rd32(struct nvkm_pci *pci, u16 addr) |
38 | { | | 38 | { |
39 | return pci->func->rd32(pci, addr); | | 39 | return pci->func->rd32(pci, addr); |
40 | } | | 40 | } |
| @@ -132,29 +132,34 @@ nvkm_pci_init(struct nvkm_subdev *subdev | | | @@ -132,29 +132,34 @@ nvkm_pci_init(struct nvkm_subdev *subdev |
132 | | | 132 | |
133 | if (pci->agp.bridge) { | | 133 | if (pci->agp.bridge) { |
134 | ret = nvkm_agp_init(pci); | | 134 | ret = nvkm_agp_init(pci); |
135 | if (ret) | | 135 | if (ret) |
136 | return ret; | | 136 | return ret; |
137 | } | | 137 | } |
138 | | | 138 | |
139 | if (pci->func->init) | | 139 | if (pci->func->init) |
140 | pci->func->init(pci); | | 140 | pci->func->init(pci); |
141 | | | 141 | |
142 | #ifdef __NetBSD__ | | 142 | #ifdef __NetBSD__ |
143 | { | | 143 | { |
144 | const struct pci_attach_args *pa = &pdev->pd_pa; | | 144 | const struct pci_attach_args *pa = &pdev->pd_pa; |
| | | 145 | int counts[PCI_INTR_TYPE_SIZE] = { |
| | | 146 | [PCI_INTR_TYPE_INTX] = 1, |
| | | 147 | [PCI_INTR_TYPE_MSI] = 0, |
| | | 148 | [PCI_INTR_TYPE_MSIX] = 0, |
| | | 149 | }; |
145 | | | 150 | |
146 | /* XXX errno NetBSD->Linux */ | | 151 | /* XXX errno NetBSD->Linux */ |
147 | ret = -pci_intr_alloc(pa, &pci->pci_ihp, NULL, 0); | | 152 | ret = -pci_intr_alloc(pa, &pci->pci_ihp, counts, PCI_INTR_TYPE_INTX); |
148 | if (ret) | | 153 | if (ret) |
149 | return ret; | | 154 | return ret; |
150 | pci->pci_intrcookie = pci_intr_establish_xname(pa->pa_pc, | | 155 | pci->pci_intrcookie = pci_intr_establish_xname(pa->pa_pc, |
151 | pci->pci_ihp[0], IPL_DRM, nvkm_pci_intr, pci, | | 156 | pci->pci_ihp[0], IPL_DRM, nvkm_pci_intr, pci, |
152 | device_xname(pci_dev_dev(pdev))); | | 157 | device_xname(pci_dev_dev(pdev))); |
153 | if (pci->pci_intrcookie == NULL) | | 158 | if (pci->pci_intrcookie == NULL) |
154 | return -EIO; /* XXX er? */ | | 159 | return -EIO; /* XXX er? */ |
155 | } | | 160 | } |
156 | #else | | 161 | #else |
157 | ret = request_irq(pdev->irq, nvkm_pci_intr, IRQF_SHARED, "nvkm", pci); | | 162 | ret = request_irq(pdev->irq, nvkm_pci_intr, IRQF_SHARED, "nvkm", pci); |
158 | if (ret) | | 163 | if (ret) |
159 | return ret; | | 164 | return ret; |
160 | | | 165 | |