Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2020 16:22:33 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368156 - head/sys/dev/pci
Message-ID:  <202011291622.0ATGMXZU060780@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <f0andrey_gmail.com>
  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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011291622.0ATGMXZU060780>