Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Dec 2016 19:42:18 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica
Message-ID:  <201612231942.uBNJgIbo003680@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/11/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- stable/11/sys/dev/acpica/acpi_pcib_acpi.c	Fri Dec 23 19:30:14 2016	(r310486)
+++ stable/11/sys/dev/acpica/acpi_pcib_acpi.c	Fri Dec 23 19:42:17 2016	(r310487)
@@ -488,10 +488,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
     /*
@@ -514,6 +521,9 @@ acpi_pcib_acpi_attach(device_t dev)
 
     if (device_add_child(dev, "pci", -1) == NULL) {
 	device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	pcib_host_res_free(dev, &sc->ap_host_res);
+#endif
 	return (ENXIO);
     }
     return (bus_generic_attach(dev));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612231942.uBNJgIbo003680>