| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: acpi_pci_machdep.c,v 1.3 2018/10/21 00:42:05 jmcneill Exp $ */ | | 1 | /* $NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jared McNeill <jmcneill@invisible.ca>. | | 8 | * by Jared McNeill <jmcneill@invisible.ca>. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.3 2018/10/21 00:42:05 jmcneill Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/bus.h> | | 36 | #include <sys/bus.h> |
37 | #include <sys/device.h> | | 37 | #include <sys/device.h> |
38 | #include <sys/intr.h> | | 38 | #include <sys/intr.h> |
39 | #include <sys/systm.h> | | 39 | #include <sys/systm.h> |
40 | #include <sys/kernel.h> | | 40 | #include <sys/kernel.h> |
41 | #include <sys/extent.h> | | 41 | #include <sys/extent.h> |
42 | #include <sys/queue.h> | | 42 | #include <sys/queue.h> |
43 | #include <sys/mutex.h> | | 43 | #include <sys/mutex.h> |
44 | #include <sys/kmem.h> | | 44 | #include <sys/kmem.h> |
45 | | | 45 | |
46 | #include <machine/cpu.h> | | 46 | #include <machine/cpu.h> |
| @@ -177,41 +177,41 @@ acpi_pci_md_attach_hook(device_t parent, | | | @@ -177,41 +177,41 @@ acpi_pci_md_attach_hook(device_t parent, |
177 | handle = prtp->prt_handle; | | 177 | handle = prtp->prt_handle; |
178 | break; | | 178 | break; |
179 | } | | 179 | } |
180 | } | | 180 | } |
181 | } else { | | 181 | } else { |
182 | /* | | 182 | /* |
183 | * Lookup the ACPI device node for the root bus. | | 183 | * Lookup the ACPI device node for the root bus. |
184 | */ | | 184 | */ |
185 | ad = acpi_pciroot_find(seg, 0); | | 185 | ad = acpi_pciroot_find(seg, 0); |
186 | if (ad != NULL) | | 186 | if (ad != NULL) |
187 | handle = ad->ad_handle; | | 187 | handle = ad->ad_handle; |
188 | } | | 188 | } |
189 | | | 189 | |
190 | if (ad != NULL) { | | | |
191 | /* | | | |
192 | * This is a new ACPI managed bus. Add PCI link references. | | | |
193 | */ | | | |
194 | acpi_pci_md_pci_link(ad->ad_handle, pba->pba_bus); | | | |
195 | } | | | |
196 | | | | |
197 | if (handle != NULL) { | | 190 | if (handle != NULL) { |
198 | prt = kmem_alloc(sizeof(*prt), KM_SLEEP); | | 191 | prt = kmem_alloc(sizeof(*prt), KM_SLEEP); |
199 | prt->prt_bus = pba->pba_bus; | | 192 | prt->prt_bus = pba->pba_bus; |
200 | prt->prt_handle = handle; | | 193 | prt->prt_handle = handle; |
201 | TAILQ_INSERT_TAIL(&acpi_pci_irq_routes, prt, prt_list); | | 194 | TAILQ_INSERT_TAIL(&acpi_pci_irq_routes, prt, prt_list); |
202 | } | | 195 | } |
203 | | | 196 | |
204 | acpimcfg_map_bus(self, pba->pba_pc, pba->pba_bus); | | 197 | acpimcfg_map_bus(self, pba->pba_pc, pba->pba_bus); |
| | | 198 | |
| | | 199 | if (ad != NULL) { |
| | | 200 | /* |
| | | 201 | * This is a new ACPI managed bus. Add PCI link references. |
| | | 202 | */ |
| | | 203 | acpi_pci_md_pci_link(ad->ad_handle, pba->pba_bus); |
| | | 204 | } |
205 | } | | 205 | } |
206 | | | 206 | |
207 | static int | | 207 | static int |
208 | acpi_pci_md_bus_maxdevs(void *v, int busno) | | 208 | acpi_pci_md_bus_maxdevs(void *v, int busno) |
209 | { | | 209 | { |
210 | return 32; | | 210 | return 32; |
211 | } | | 211 | } |
212 | | | 212 | |
213 | static pcitag_t | | 213 | static pcitag_t |
214 | acpi_pci_md_make_tag(void *v, int b, int d, int f) | | 214 | acpi_pci_md_make_tag(void *v, int b, int d, int f) |
215 | { | | 215 | { |
216 | return (b << 16) | (d << 11) | (f << 8); | | 216 | return (b << 16) | (d << 11) | (f << 8); |
217 | } | | 217 | } |