| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: acpi_pci.c,v 1.34 2022/01/22 11:49:17 thorpej Exp $ */ | | 1 | /* $NetBSD: acpi_pci.c,v 1.35 2022/02/11 23:19:59 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2009, 2010 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 Christoph Egger and Gregoire Sutre. | | 8 | * by Christoph Egger and Gregoire Sutre. |
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. |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | __KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.34 2022/01/22 11:49:17 thorpej Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.35 2022/02/11 23:19:59 riastradh Exp $"); |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <sys/kmem.h> | | 36 | #include <sys/kmem.h> |
37 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
38 | | | 38 | |
39 | #include <dev/pci/pcireg.h> | | 39 | #include <dev/pci/pcireg.h> |
40 | #include <dev/pci/pcivar.h> | | 40 | #include <dev/pci/pcivar.h> |
41 | #include <dev/pci/pcidevs.h> | | 41 | #include <dev/pci/pcidevs.h> |
42 | #include <dev/pci/ppbreg.h> | | 42 | #include <dev/pci/ppbreg.h> |
43 | | | 43 | |
44 | #include <dev/pci/pci_calls.h> | | 44 | #include <dev/pci/pci_calls.h> |
45 | | | 45 | |
| @@ -462,29 +462,26 @@ acpi_pcidev_find_dev(struct acpi_devnode | | | @@ -462,29 +462,26 @@ acpi_pcidev_find_dev(struct acpi_devnode |
462 | ap = ad->ad_pciinfo; | | 462 | ap = ad->ad_pciinfo; |
463 | | | 463 | |
464 | if (ap->ap_function == 0xFFFF) | | 464 | if (ap->ap_function == 0xFFFF) |
465 | return NULL; | | 465 | return NULL; |
466 | | | 466 | |
467 | for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); | | 467 | for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); |
468 | dv != NULL; dv = deviter_next(&di)) { | | 468 | dv != NULL; dv = deviter_next(&di)) { |
469 | | | 469 | |
470 | pr = device_parent(dv); | | 470 | pr = device_parent(dv); |
471 | | | 471 | |
472 | if (pr == NULL || device_is_a(pr, "pci") != true) | | 472 | if (pr == NULL || device_is_a(pr, "pci") != true) |
473 | continue; | | 473 | continue; |
474 | | | 474 | |
475 | if (dv->dv_locators == NULL) /* This should not happen. */ | | | |
476 | continue; | | | |
477 | | | | |
478 | pci = device_private(pr); | | 475 | pci = device_private(pr); |
479 | | | 476 | |
480 | if (pci->sc_bus == ap->ap_bus && | | 477 | if (pci->sc_bus == ap->ap_bus && |
481 | device_locator(dv, PCICF_DEV) == ap->ap_device && | | 478 | device_locator(dv, PCICF_DEV) == ap->ap_device && |
482 | device_locator(dv, PCICF_FUNCTION) == ap->ap_function) | | 479 | device_locator(dv, PCICF_FUNCTION) == ap->ap_function) |
483 | break; | | 480 | break; |
484 | } | | 481 | } |
485 | | | 482 | |
486 | deviter_release(&di); | | 483 | deviter_release(&di); |
487 | | | 484 | |
488 | return dv; | | 485 | return dv; |
489 | } | | 486 | } |
490 | | | 487 | |