From nobody Wed Oct 25 00:41:44 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SFVVd1MTMz4xlFt; Wed, 25 Oct 2023 00:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFVVd0hZCz3RyC; Wed, 25 Oct 2023 00:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698194505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yMQobGMR+4KZfCWwjEHHVsF+JRTNnLApOrsJUUpmHio=; b=FD3a5wlL7mz7wYjzBJyT/V1gGIzulWdwDIrGWAVe+qbGX5VtNN8pAd52Hs0ta2WBYqmvJ6 zHQmWEgn47bgM0F5DsNTwx1gMrs1JW/JjdtB6K3h3tI1bZhcPPrTjskG44uBfgJJX65UCS +5CyHlQ9Edm1G03SYTFNI9QSIae4uTG54jG7UngwjFxpVPhmFNKZb5eZOlVbG8NnkskPkX IdP1bv0j84T8HOykBk/yUQC2QD3ALDsXo0ZnXvHNISo3wG0eG2xIOMo6jHrft0NF+TOjvY m42TcE0JTizMHqtmpazl8AqHdBsbfWpQn7gvF36nM4CTaEOt1yEVvFC/nqsB0g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698194505; a=rsa-sha256; cv=none; b=wDuCTTenbCosZIdxItsnciI4DhPJhKHL5a+ZU8dRVSOL24XIhFBxBJBG6ZkWeJOPJye25f tvugNSwxXjOjyRt/XHE8yi/L1/4/rTnbfouNoh9hDRSYKmrlIlhcIwW2iIaA6Ay6hkpOBd 1EthsRpqO9A8Ao1T4CIywmQZUBL3kk5/CGbvuyMHfA4lV7S6aZP9DZJvb8z0QoQbqw7VRg qIK59J8MMo/yvrtxXnRTTobE/ASCpicAIFHiY459V8nhFLzZnX9QBxRrxiFf1MoaUA8+Rg Y/gr6xm7iEHb2NdkeLOHdAk16uzcoeDw3fsydlwT5vmRMFvNKi+8Ag/81qfxKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698194505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yMQobGMR+4KZfCWwjEHHVsF+JRTNnLApOrsJUUpmHio=; b=LI7/ahTeoi3FTP0S/cch42kGqYtRBeIkYPM5h2uU62pDRzs9+Awm560CL+TTMmJi+1ZHgN jN7jcrZnInpQXgxZKKWzKulJvyqqmJKqs9mEU5IGulUovlN67p0hMNvW/XEOrnqqz51JLM zo92NfGqfCif6YZqtfDZtrSK7nTRwy4dfRrTGGPwfG3gsisxmg1+z9okZiYbv1WXYoNZ6g Qb0inkxNh43BXOYLoy+yW05QCqSXMppFcN+qK/ciTPRu5jI86YopzuVlK3KZkWC6+HZn3s s0cwzasoLesCHjh7z5ZSAuRaWzK4b539EAmU50obvId9Z/H0FfDy35PDSnfsuA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SFVVc6LdCzksW; Wed, 25 Oct 2023 00:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39P0fiFd005655; Wed, 25 Oct 2023 00:41:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39P0fik0005652; Wed, 25 Oct 2023 00:41:44 GMT (envelope-from git) Date: Wed, 25 Oct 2023 00:41:44 GMT Message-Id: <202310250041.39P0fik0005652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ec31ca0a48e4 - releng/14.0 - acpi_pcib: Trust decoded bus range from _CRS over _BBN List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: ec31ca0a48e4f2a6d4c406a1aacc6b44e5cbb7aa Auto-Submitted: auto-generated The branch releng/14.0 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ec31ca0a48e4f2a6d4c406a1aacc6b44e5cbb7aa commit ec31ca0a48e4f2a6d4c406a1aacc6b44e5cbb7aa Author: John Baldwin AuthorDate: 2023-10-16 22:19:07 +0000 Commit: John Baldwin CommitDate: 2023-10-24 19:27:31 +0000 acpi_pcib: Trust decoded bus range from _CRS over _BBN Currently if _BBN doesn't match the first bus in the decoded bus range from _CRS for a Host to PCI bridge, the driver fails to attach as a defensive measure. There is now firmware in the field where these do not match, and the _BBN values are clearly wrong, so rather than failing attach, trust the range from _CRS over _BBN. Co-authored-by: Justin Gibbs Reported by: gibbs Reviewed by: imp (earlier version) Differential Revision: https://reviews.freebsd.org/D42231 (cherry picked from commit 22a6678b627b39ceb94f7323be1010e928d92494) (cherry picked from commit 76b37faac869aac7e889da3ac291207606a20e51) Approved by: re (gjb) --- sys/dev/acpica/acpi_pcib_acpi.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 0575b1d83bb1..02e3a0be5956 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -289,7 +289,8 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) #if defined(NEW_PCIB) && defined(PCI_RES_BUS) static int -first_decoded_bus(struct acpi_hpcib_softc *sc, rman_res_t *startp) +decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp, + rman_res_t *endp) { struct resource_list_entry *rle; @@ -297,6 +298,7 @@ first_decoded_bus(struct acpi_hpcib_softc *sc, rman_res_t *startp) if (rle == NULL) return (ENXIO); *startp = rle->start; + *endp = rle->end; return (0); } #endif @@ -366,7 +368,7 @@ acpi_pcib_acpi_attach(device_t dev) u_int slot, func, busok; #if defined(NEW_PCIB) && defined(PCI_RES_BUS) struct resource *bus_res; - rman_res_t start; + rman_res_t end, start; int rid; #endif int error, domain; @@ -495,7 +497,7 @@ acpi_pcib_acpi_attach(device_t dev) * If we have a region of bus numbers, use the first * number for our bus. */ - if (first_decoded_bus(sc, &start) == 0) + if (decoded_bus_range(sc, &start, &end) == 0) sc->ap_bus = start; else { rid = 0; @@ -512,15 +514,21 @@ acpi_pcib_acpi_attach(device_t dev) } } else { /* - * Require the bus number from _BBN to match the start of any - * decoded range. + * If there is a decoded bus range, assume the bus number is + * the first value in the range. Warn if _BBN doesn't match. */ - 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); + if (decoded_bus_range(sc, &start, &end) == 0) { + if (sc->ap_bus != start) { + device_printf(dev, + "WARNING: BIOS configured bus number (%d) is " + "not within decoded bus number range " + "(%ju - %ju).\n", + sc->ap_bus, (uintmax_t)start, (uintmax_t)end); + device_printf(dev, + "Using range start (%ju) as bus number.\n", + (uintmax_t)start); + sc->ap_bus = start; + } } } #else