From owner-svn-src-all@freebsd.org Sun Nov 29 16:22:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6D854A6DF6; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkYYP5Bd4z4qwR; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A54FA14715; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATGMXNW060781; Sun, 29 Nov 2020 16:22:33 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATGMXZU060780; Sun, 29 Nov 2020 16:22:33 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202011291622.0ATGMXZU060780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 29 Nov 2020 16:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368156 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 368156 X-SVN-Commit-Repository: base 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.34 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: Sun, 29 Nov 2020 16:22:33 -0000 Author: andrew Date: Sun Nov 29 16:22:33 2020 New Revision: 368156 URL: https://svnweb.freebsd.org/changeset/base/368156 Log: Only set the PCI bus end when we are reducing it We read the bus end value from the _CRS method. On some systems we need to further limit it based on the MCFG table. Support this by setting a default value, then update it if needed in the _CRS table, and finally reduce it if it is past the end of the MCFG tabel. This will allow for both systems that use either method to encode this value. This partially reverts r347929, removing the error printf. Reviewed by: philip Tested by: philip, Andrey Fesenko MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D27274 Modified: head/sys/dev/pci/pci_host_generic_acpi.c Modified: head/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- head/sys/dev/pci/pci_host_generic_acpi.c Sun Nov 29 15:39:54 2020 (r368155) +++ head/sys/dev/pci/pci_host_generic_acpi.c Sun Nov 29 16:22:33 2020 (r368156) @@ -201,7 +201,8 @@ pci_host_acpi_get_ecam_resource(device_t dev) mcfg_entry++; } if (found) { - sc->base.bus_end = mcfg_entry->EndBusNumber; + if (mcfg_entry->EndBusNumber < sc->base.bus_end) + sc->base.bus_end = mcfg_entry->EndBusNumber; base = mcfg_entry->Address; } else { device_printf(dev, "MCFG exists, but does not have bus %d-%d\n", @@ -210,10 +211,9 @@ pci_host_acpi_get_ecam_resource(device_t dev) } } else { status = acpi_GetInteger(handle, "_CBA", &val); - if (ACPI_SUCCESS(status)) { + if (ACPI_SUCCESS(status)) base = val; - sc->base.bus_end = 255; - } else + else return (ENXIO); } @@ -246,6 +246,7 @@ pci_host_generic_acpi_init(device_t dev) device_printf(dev, "No _BBN, using start bus 0\n"); sc->base.bus_start = 0; } + sc->base.bus_end = 255; /* Get PCI Segment (domain) needed for MCFG lookup */ status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam);