Author: jhb
Date: Fri Dec 23 19:42:17 2016
New Revision: 310487
URL: https://svnweb.freebsd.org/changeset/base/310487

Log:
  MFC 309588: Don't attach to Host-PCI bridges with a bad bus number.
  
  If the bus number assigned to a Host-PCI bridge doesn't match the first
  bus number in the associated producer range from _CRS, print a warning and
  fail to attach rather than panicking due to an assertion failure.
  
  At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge
  device in the ACPI namespace that seems to correspond to the I/O hub in
  the second socket of a two-socket machine.  However, the BIOS doesn't
  configure the settings for this "ghost" bridge correctly, nor does it have
  any PCI devices behind it.

Modified:
  stable/10/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- stable/10/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:30:14 2016        
(r310486)
+++ stable/10/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:42:17 2016        
(r310487)
@@ -480,10 +480,17 @@ acpi_pcib_acpi_attach(device_t dev)
                    pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res);
            }
     } else {
-#ifdef INVARIANTS
-           if (first_decoded_bus(sc, &start) == 0)
-                   KASSERT(start == sc->ap_bus, ("bus number mismatch"));
-#endif
+           /*
+            * Require the bus number from _BBN to match the start of any
+            * decoded range.
+            */
+           if (first_decoded_bus(sc, &start) == 0 && sc->ap_bus != start) {
+                   device_printf(dev,
+               "bus number %d does not match start of decoded range %ju\n",
+                       sc->ap_bus, (uintmax_t)start);
+                   pcib_host_res_free(dev, &sc->ap_host_res);
+                   return (ENXIO);
+           }
     }
 #else
     /*
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to