From cd1d23f937557e11d5acb365ab1d042371eff91c Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 29 Dec 2011 16:23:14 +0000 Subject: [PATCH 29/65] Further relax the strictness of enforcing allocations to only come from decoded ranges. Pass any request for a specific range that fails because it is not in a decoded range for an ACPI Host-PCI bridge up to the parent to see if it can still be allocated. This is based on the assumption that many BIOSes are inconsistent/broken and that settings programmed into BARs or resources assigned to other built-in components are more trustworthy than the list of decoded resource ranges in _CRS. This effectively limits the decoded ranges to only being used for "wildcard" ranges when allocating fresh resources for a BAR, etc. At some point I would like to only be this permissive during an early scan of firmware-assigned resources during boot and to be strict about all later allocations, but that isn't viable currently. MFC after: 2 weeks git-svn-id: http://svn.freebsd.org/base/head@228961 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit 6f2134b21fcd2bee481339aa7b7f072ebf4fe7a8) Signed-off-by: Xin Li --- sys/dev/acpica/acpi_pcib_acpi.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 3284fc5..af98fa8 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -512,8 +512,17 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, sc = device_get_softc(dev); res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, count, flags); + + /* + * XXX: If this is a request for a specific range, assume it is + * correct and pass it up to the parent. What we probably want to + * do long-term is explicitly trust any firmware-configured + * resources during the initial bus scan on boot and then disable + * this after that. + */ if (res == NULL && start + count - 1 == end) - res = acpi_alloc_sysres(child, type, rid, start, end, count, flags); + res = bus_generic_alloc_resource(dev, child, type, rid, start, end, + count, flags); return (res); #else return (bus_generic_alloc_resource(dev, child, type, rid, start, end, -- 1.7.8.3