Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/acpi Try to get the starting bus number from _C...



details:   https://anonhg.NetBSD.org/src/rev/c71250407d71
branches:  trunk
changeset: 1009945:c71250407d71
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri May 08 14:44:23 2020 +0000

description:
Try to get the starting bus number from _CRS before falling back to _BBN.
There are apparently cases where the first bus in _CRS does not match the
value of _BBN, and the consensus is that _CRS should take precedence.

diffstat:

 sys/arch/arm/acpi/acpipchb.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 9b9539ba6a36 -r c71250407d71 sys/arch/arm/acpi/acpipchb.c
--- a/sys/arch/arm/acpi/acpipchb.c      Fri May 08 14:42:38 2020 +0000
+++ b/sys/arch/arm/acpi/acpipchb.c      Fri May 08 14:44:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.17 2020/01/21 11:24:47 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.18 2020/05/08 14:44:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.17 2020/01/21 11:24:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.18 2020/05/08 14:44:23 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -123,13 +123,22 @@
        struct acpi_attach_args *aa = aux;
        struct pcibus_attach_args pba;
        ACPI_INTEGER seg;
+       uint16_t bus_start;
 
        sc->sc_dev = self;
        sc->sc_memt = aa->aa_memt;
        sc->sc_handle = aa->aa_node->ad_handle;
 
-       if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_BBN", &sc->sc_bus)))
-               sc->sc_bus = 0;
+       /*
+        * First try to derive the base bus number from _CRS. If that fails,
+        * try _BBN. If that fails too, assume bus 0.
+        */
+       if (ACPI_SUCCESS(acpi_pcidev_pciroot_bus(sc->sc_handle, &bus_start))) {
+               sc->sc_bus = bus_start;
+       } else {
+               if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_BBN", &sc->sc_bus)))
+                       sc->sc_bus = 0;
+       }
 
        if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_SEG", &seg)))
                seg = 0;



Home | Main Index | Thread Index | Old Index