From patchwork Tue Mar 16 20:11:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 86201 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 o2GKBd5m027196 for ; Tue, 16 Mar 2010 20:11:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756157Ab0CPULj (ORCPT ); Tue, 16 Mar 2010 16:11:39 -0400 Received: from g5t0008.atlanta.hp.com ([15.192.0.45]:33194 "EHLO g5t0008.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755153Ab0CPULh (ORCPT ); Tue, 16 Mar 2010 16:11:37 -0400 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g5t0008.atlanta.hp.com (Postfix) with ESMTP id 2A67124257; Tue, 16 Mar 2010 20:11:37 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id E2493200F2; Tue, 16 Mar 2010 20:11:34 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id C0F01CF002A; Tue, 16 Mar 2010 14:11:34 -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 3hh4JGGwCxPQ; Tue, 16 Mar 2010 14:11:34 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id A13AFCF0024; Tue, 16 Mar 2010 14:11:34 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 8D73A2613F; Tue, 16 Mar 2010 14:11:34 -0600 (MDT) Subject: [PATCH] x86/PCI: ignore Consumer/Producer bit and parse additional _CRS resources To: Jesse Barnes From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, Pete Zaitcev , Thomas Renninger , linux-kernel@vger.kernel.org Date: Tue, 16 Mar 2010 14:11:34 -0600 Message-ID: <20100316201134.24527.87006.stgit@bob.kio> In-Reply-To: <20100316201046.24527.79634.stgit@bob.kio> References: <20100316201046.24527.79634.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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:11:40 +0000 (UTC) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index d255ce8..e0f45c2 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -65,14 +65,79 @@ resource_to_addr(struct acpi_resource *resource, struct acpi_resource_address64 *addr) { acpi_status status; + struct acpi_resource_io *io; + struct acpi_resource_fixed_io *fixed_io; + struct acpi_resource_memory24 *memory24; + struct acpi_resource_memory32 *memory32; + struct acpi_resource_fixed_memory32 *fixed_memory32; + struct acpi_resource_extended_address64 *ext_addr64; + + memset(addr, 0, sizeof(*addr)); + + switch (resource->type) { + case ACPI_RESOURCE_TYPE_IO: + io = &resource->data.io; + addr->resource_type = ACPI_IO_RANGE; + addr->minimum = io->minimum; + addr->address_length = io->address_length; + return AE_OK; + + case ACPI_RESOURCE_TYPE_FIXED_IO: + fixed_io = &resource->data.fixed_io; + addr->resource_type = ACPI_IO_RANGE; + addr->minimum = fixed_io->address; + addr->address_length = fixed_io->address_length; + return AE_OK; + + case ACPI_RESOURCE_TYPE_MEMORY24: + memory24 = &resource->data.memory24; + addr->resource_type = ACPI_MEMORY_RANGE; + addr->minimum = memory24->minimum; + addr->address_length = memory24->address_length; + return AE_OK; + + case ACPI_RESOURCE_TYPE_MEMORY32: + memory32 = &resource->data.memory32; + addr->resource_type = ACPI_MEMORY_RANGE; + addr->minimum = memory32->minimum; + addr->address_length = memory32->address_length; + return AE_OK; - status = acpi_resource_to_address64(resource, addr); - if (ACPI_SUCCESS(status) && - (addr->resource_type == ACPI_MEMORY_RANGE || - addr->resource_type == ACPI_IO_RANGE) && - addr->address_length > 0 && - addr->producer_consumer == ACPI_PRODUCER) { + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + fixed_memory32 = &resource->data.fixed_memory32; + addr->resource_type = ACPI_MEMORY_RANGE; + addr->minimum = fixed_memory32->address; + addr->address_length = fixed_memory32->address_length; return AE_OK; + + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: + status = acpi_resource_to_address64(resource, addr); + if (ACPI_SUCCESS(status) && + (addr->resource_type == ACPI_MEMORY_RANGE || + addr->resource_type == ACPI_IO_RANGE) && + addr->address_length > 0) { + return AE_OK; + } + break; + + case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: + ext_addr64 = &resource->data.ext_address64; + if ((ext_addr64->resource_type == ACPI_MEMORY_RANGE || + ext_addr64->resource_type == ACPI_IO_RANGE) && + ext_addr64->address_length > 0) { + addr->resource_type = ext_addr64->resource_type; + addr->minimum = ext_addr64->minimum; + addr->address_length = ext_addr64->address_length; + addr->translation_offset = + ext_addr64->translation_offset; + if (ext_addr64->resource_type == ACPI_MEMORY_RANGE) + addr->info.mem.caching = + ext_addr64->info.mem.caching; + return AE_OK; + } + break; } return AE_ERROR; }