From patchwork Tue Mar 16 20:26:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 86206 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2GKQXGu031081 for ; Tue, 16 Mar 2010 20:26:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756891Ab0CPU0d (ORCPT ); Tue, 16 Mar 2010 16:26:33 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:22957 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756424Ab0CPU0c (ORCPT ); Tue, 16 Mar 2010 16:26:32 -0400 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 8AC921C170; Tue, 16 Mar 2010 20:26:28 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g1t0039.austin.hp.com (Postfix) with ESMTP id 47389340FC; Tue, 16 Mar 2010 20:26:28 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 25A1FCF0027; Tue, 16 Mar 2010 14:26:28 -0600 (MDT) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nP6KgsduOxPF; Tue, 16 Mar 2010 14:26:28 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 066E6CF0024; Tue, 16 Mar 2010 14:26:28 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id D572226141; Tue, 16 Mar 2010 14:26:27 -0600 (MDT) Subject: [PATCH v1] PNPACPI: ignore Consumer/Producer bit; all bridge resources are windows To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org, Adam Belay Date: Tue, 16 Mar 2010 14:26:27 -0600 Message-ID: <20100316202627.25544.28033.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 16 Mar 2010 20:26:34 +0000 (UTC) diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 54514aa..7158882 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -176,6 +176,33 @@ static int dma_flags(struct pnp_dev *dev, int type, int bus_master, return flags; } +/* + * BIOS vendors haven't used the Consumer/Producer bit in Address Space + * Descriptors consistently, so it was removed in ACPI 2.0c. It was + * mistakenly re-added in ACPI 3.0, but is still useless because we have + * no way of knowing when it's valid. All we can really do is assume that + * all resources on bridge devices are Producers. Most bridges put their + * Consumer resources in PCI config space, but HP's vendor-defined CCSR + * resource can be used for non-PCI config Consumer resources if necessary. + */ +static struct acpi_device_id acpi_bridge_list[] = { + { "PNP0A00" }, + { "PNP0A01" }, + { "PNP0A02" }, + { "PNP0A03" }, + { "PNP0A08" }, + { "" }, +}; + +static int resource_is_window(struct pnp_dev *dev, struct acpi_resource *res) +{ + struct acpi_device *acpi_dev = dev->data; + + if (acpi_match_device_ids(acpi_dev, acpi_bridge_list) == 0) + return 1; + return 0; +} + static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, u64 len, int io_decode, int window) @@ -287,7 +314,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, return; } - window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; + window = resource_is_window(dev, res); if (p->resource_type == ACPI_MEMORY_RANGE) pnpacpi_parse_allocated_memresource(dev, @@ -309,7 +336,7 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, struct acpi_resource_extended_address64 *p = &res->data.ext_address64; int window; - window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; + window = resource_is_window(dev, res); if (p->resource_type == ACPI_MEMORY_RANGE) pnpacpi_parse_allocated_memresource(dev, @@ -387,7 +414,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, pnpacpi_parse_allocated_ioresource(dev, io->minimum, io->address_length, - io->io_decode, 0); + io->io_decode, resource_is_window(dev, res)); break; case ACPI_RESOURCE_TYPE_START_DEPENDENT: @@ -399,7 +426,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, pnpacpi_parse_allocated_ioresource(dev, fixed_io->address, fixed_io->address_length, - ACPI_DECODE_10, 0); + ACPI_DECODE_10, resource_is_window(dev, res)); break; case ACPI_RESOURCE_TYPE_VENDOR: @@ -415,21 +442,22 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, pnpacpi_parse_allocated_memresource(dev, memory24->minimum, memory24->address_length, - memory24->write_protect, 0); + memory24->write_protect, resource_is_window(dev, res)); break; case ACPI_RESOURCE_TYPE_MEMORY32: memory32 = &res->data.memory32; pnpacpi_parse_allocated_memresource(dev, memory32->minimum, memory32->address_length, - memory32->write_protect, 0); + memory32->write_protect, resource_is_window(dev, res)); break; case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: fixed_memory32 = &res->data.fixed_memory32; pnpacpi_parse_allocated_memresource(dev, fixed_memory32->address, fixed_memory32->address_length, - fixed_memory32->write_protect, 0); + fixed_memory32->write_protect, + resource_is_window(dev, res)); break; case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS32: