diff options
author | jhb <jhb@FreeBSD.org> | 2016-12-23 19:42:17 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-12-23 19:42:17 +0000 |
commit | bff6b519ae43ad35a81ea361a71b814e97a51c7c (patch) | |
tree | 448020e3331ef8c4e1fb71e5e745f5d7deb40293 | |
parent | 47736d6328c101b7feaf37b7e7f2b8b02bbe9cb0 (diff) | |
download | FreeBSD-src-bff6b519ae43ad35a81ea361a71b814e97a51c7c.zip FreeBSD-src-bff6b519ae43ad35a81ea361a71b814e97a51c7c.tar.gz |
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.
-rw-r--r-- | sys/dev/acpica/acpi_pcib_acpi.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index da72b40..a7914a2 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -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 /* |