From nobody Tue Oct 24 19:25:53 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 4SFMV95y3Xz4yPSM; Tue, 24 Oct 2023 19:25:53 +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 4SFMV95VPQz4N0H; Tue, 24 Oct 2023 19:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698175553; 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=u7pFNfg3HCWgqnl93SclTiqvk7LEv7meDp6OQceuZsk=; b=Am3u8yBG67YBRG7NivdZjPZ9UANWoPoB4Pdpzaox26WfPqJMNu0JSSF0nP0sw3gRfLBgiu Q1iUEn/OzdZsW2+HOP60Th1FE5P6FK/h69TmMLbPWRUqbzJuDj8pmPkMDmhS2BBuz9MZYI RB+/HPMjajY2d2Qkn3Mj5mKrtwbjmM8biDoj8+48B1Wglb800oIWpJ7+wSFkkFVvnNFkiG U6vN63lJGiSwQ2A5KBms8U5DJDWBI7A6nRFl78EkOtZxCbijp2Z6DtIpMmac4E27jLMcup Vbw/IElOLn4p44sn3Rrh6zjgWojoRP5YfbA5xU52Rg3BhbsTziyAyFBqQf5Q3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698175553; a=rsa-sha256; cv=none; b=A5lvjniCFzCFJjl9AJQXRLzzQmSMfwY8y6uxvMaNliE93/IGDbK//+y/gvXHH8rn2QtUu3 iFDmDNwvxnHxjb1XwEd1G3hjJQyYnE7kinVo0CP9PDmraMvQpDS0FC8Vjx7IrlCnR39pi6 rGh7+z/cb1LA49NFEV69k/jvVHeOWyRM+Raxtz8H6yuHsFaAWHIXGDv2wWU8t+ALk7VWuL 7paGQ6QMlYtVg00nTEG0WokDjaj1SY5W07ccvqg6HYZDVqtWd9mSKzg3cXlVU1k1bykzQj cZyJvrKSawi7k7OqIG7uS4xhWwyxwPVG872HvldJLgks06ZvTDf28mxJM1u9aQ== 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=1698175553; 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=u7pFNfg3HCWgqnl93SclTiqvk7LEv7meDp6OQceuZsk=; b=aNYbPlTHNgjiwd8yGK5HLs/uVPuYBxVfhn1an2tQpN3SvACstT6n6rMcobUwIjpzUKayJ4 jGMN5DV2nrvd5GwZ10R/4+bmJDKzzwZllsbe36r9Q5kiMYyc+qGadtPp5BcAVJPP/0XrvV ZlruCs9xAbx4TkNBaBW/YjpeJiyKJnJLbaT/HrKSWcN1O1tGUhGbPAKwZObGoCEfNdr70/ yUL8ZDr8VzeMlBbrLkBqfr3gEtP005alg7Y+TWa8KKY1jpTFekIJKithESnCVUbu3FWgRh ap56cxFzxToost0GaJKK6mOJspoZkg+R20YIBFu9Yx141np0BRk/3eloPpx68Q== 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 4SFMV94YpWzbBx; Tue, 24 Oct 2023 19:25:53 +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 39OJPrh1074042; Tue, 24 Oct 2023 19:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OJPrG8074039; Tue, 24 Oct 2023 19:25:53 GMT (envelope-from git) Date: Tue, 24 Oct 2023 19:25:53 GMT Message-Id: <202310241925.39OJPrG8074039@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: 76b37faac869 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 76b37faac869aac7e889da3ac291207606a20e51 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=76b37faac869aac7e889da3ac291207606a20e51 commit 76b37faac869aac7e889da3ac291207606a20e51 Author: John Baldwin AuthorDate: 2023-10-16 22:19:07 +0000 Commit: John Baldwin CommitDate: 2023-10-24 19:00:57 +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) --- 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