From owner-svn-src-all@freebsd.org Tue Dec 6 00:36:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26C29C594D4; Tue, 6 Dec 2016 00:36:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0E631B2E; Tue, 6 Dec 2016 00:36:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB60a30v074934; Tue, 6 Dec 2016 00:36:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB60a3FU074933; Tue, 6 Dec 2016 00:36:03 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612060036.uB60a3FU074933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Dec 2016 00:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309588 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2016 00:36:04 -0000 Author: jhb Date: Tue Dec 6 00:36:02 2016 New Revision: 309588 URL: https://svnweb.freebsd.org/changeset/base/309588 Log: 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. Tested by: royger MFC after: 2 weeks Modified: head/sys/dev/acpica/acpi_pcib_acpi.c Modified: head/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- head/sys/dev/acpica/acpi_pcib_acpi.c Tue Dec 6 00:35:20 2016 (r309587) +++ head/sys/dev/acpica/acpi_pcib_acpi.c Tue Dec 6 00:36:02 2016 (r309588) @@ -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));