From nobody Mon Oct 16 22:43:20 2023 X-Original-To: dev-commits-src-all@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 4S8XFh3C7hz4xtH6; Mon, 16 Oct 2023 22:43:20 +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 4S8XFh2P3Xz4XQS; Mon, 16 Oct 2023 22:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697496200; 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=3xpky8ZRrFi1ScpjAhYGJLg6HnStd91/KU2XrwxrKNY=; b=avIIaudaP7Tx0ACMdcGoVdz1x5+pfWFiDxHT4AmKvTvL9ykHMQji1GnwZQek3qq1UbuDRN PiovUwi6gSmAbofeeNb6aXW/PPex8JhLjjmOHzwc2GkWuMFnDlNNHTRyB6Uume4kauDObE YOjopaIlOaei9C3/lRq0DjoSqhE/BFiWMCy+lnoeb2ii6h3ouIDWiRz9rPKyI/RNwefLTl +prNkg2pqfWgubgWUuJKLjUfDktiiRkW/UQPIrZ7ulG7nXj6DtDqMtlJJ/ZZw+RpSkLa1S hDZOCuJPx0tpqSbU11kBvMEJ30keTfelrAiiMemuuzMqYlwKOXU1mp8dlziV9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697496200; a=rsa-sha256; cv=none; b=LBuPB33vpsTKPBIG7TkQziTg95mH9+TW/GfF1cY6vT41X+kA7Cz0oiagy2OGDWRJRqWSDA 5eIMxTYn7TRmiHmTyQzfkurSc+VR1BMkLyIaSzmqHpfkqxyqmKpGDt8RG8u90ejX8V+WNS Ed8tyi8ThrwGFzo5sgaHyvY6V6FzvGWy+c6auCE/khWQvezz/+mGYDeDNl7ikfvoSQGy6P GcDVHzEUifW/HtZFQJvT5GKaxz3cBry42GcDA83an/ytgepSgHejHJPXz/2t/57mqKJ8bt SeBCCm1SbQBJOdeYsYkUr7nvTdaZhNk641dLXRvzIRrbXcf3hn0G27qwo33dPw== 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=1697496200; 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=3xpky8ZRrFi1ScpjAhYGJLg6HnStd91/KU2XrwxrKNY=; b=fjzudjX9SUJPeAKEveeTsM6Skb/fxoWpT1booFbHN57PvHhyyC4CeJ/MrYK7aI/c6Zznde gApVGC3fxhN34a/QIjSqJHu6JXgs9li4vYNu7TbcNNhPSjPGU/yX3NN9eDvWjLLYsH/i+h EFK0sMilMvKbcUsBlOFVNo5wgwELeaoyzaPtp7Rp8P/WcjLPCC2X/bNjGxY4VNo3fCpTTI I3B8zRdnelHpRGAdz9LwjRUpCljG8De6ahbIbNTKh4yIO8KX6XBGi/yRQrkGNDsRsiX6J7 4OaCPbM+NAF6gsaKVKTLsR+It0jAoHhEHv0aIKyB1cAEZgw8gFOUUP8scz0YWw== 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 4S8XFh1Rn6zyG8; Mon, 16 Oct 2023 22:43:20 +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 39GMhKSb011763; Mon, 16 Oct 2023 22:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GMhKmn011760; Mon, 16 Oct 2023 22:43:20 GMT (envelope-from git) Date: Mon, 16 Oct 2023 22:43:20 GMT Message-Id: <202310162243.39GMhKmn011760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 22a6678b627b - main - acpi_pcib: Trust decoded bus range from _CRS over _BBN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 22a6678b627b39ceb94f7323be1010e928d92494 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=22a6678b627b39ceb94f7323be1010e928d92494 commit 22a6678b627b39ceb94f7323be1010e928d92494 Author: John Baldwin AuthorDate: 2023-10-16 22:19:07 +0000 Commit: John Baldwin CommitDate: 2023-10-16 22:33:10 +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 --- 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