From patchwork Fri Oct 11 12:19:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 3023751 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E7EB9F243 for ; Fri, 11 Oct 2013 12:21:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE2B32026F for ; Fri, 11 Oct 2013 12:21:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACA0D201ED for ; Fri, 11 Oct 2013 12:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757687Ab3JKMUv (ORCPT ); Fri, 11 Oct 2013 08:20:51 -0400 Received: from mga14.intel.com ([143.182.124.37]:64997 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757659Ab3JKMUt (ORCPT ); Fri, 11 Oct 2013 08:20:49 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 11 Oct 2013 05:20:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,1080,1371106800"; d="scan'208";a="373438134" Received: from unknown (HELO localhost) ([10.255.21.2]) by azsmga001.ch.intel.com with ESMTP; 11 Oct 2013 05:20:45 -0700 From: tianyu.lan@intel.com To: tony.luck@intel.com, bhelgaas@google.com, lenb@kernel.org, rjw@sisk.pl, yinghai@kernel.org Cc: Lan Tianyu , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [Resend PATCH 5/5] IA64/PCI/ACPI: Rework PCI root bridge ACPI resource conversion Date: Fri, 11 Oct 2013 20:19:01 +0800 Message-Id: <1381493941-4650-6-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1381493941-4650-1-git-send-email-tianyu.lan@intel.com> References: <1381493941-4650-1-git-send-email-tianyu.lan@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lan Tianyu Using ACPI resource functions to convert ACPI resource to generic resource Signed-off-by: Lan Tianyu --- This patch just passes through compilation test due to no ia64 machine on hand. arch/ia64/pci/pci.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 2326790..14fa175 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -232,8 +232,9 @@ out: return ~0; } -static acpi_status resource_to_window(struct acpi_resource *resource, - struct acpi_resource_address64 *addr) +static acpi_status resource_to_window(struct acpi_resource *ares, + struct acpi_resource_address64 *addr, + struct resource *res) { acpi_status status; @@ -244,7 +245,7 @@ static acpi_status resource_to_window(struct acpi_resource *resource, * - producers, i.e., the address space is routed downstream, * not consumed by the bridge itself */ - status = acpi_resource_to_address64(resource, addr); + status = acpi_dev_resource_address_space_full(ares, addr, res); if (ACPI_SUCCESS(status) && (addr->resource_type == ACPI_MEMORY_RANGE || addr->resource_type == ACPI_IO_RANGE) && @@ -255,51 +256,54 @@ static acpi_status resource_to_window(struct acpi_resource *resource, return AE_ERROR; } -static acpi_status count_window(struct acpi_resource *resource, void *data) +static acpi_status count_window(struct acpi_resource *ares, void *data) { unsigned int *windows = (unsigned int *) data; struct acpi_resource_address64 addr; + struct resource res; acpi_status status; - status = resource_to_window(resource, &addr); + status = resource_to_window(ares, &addr, &res); if (ACPI_SUCCESS(status)) (*windows)++; return AE_OK; } -static acpi_status add_window(struct acpi_resource *res, void *data) +static acpi_status add_window(struct acpi_resource *ares, void *data) { struct pci_root_info *info = data; - struct resource *resource; + struct resource *resource = &info->res[info->res_num]; struct acpi_resource_address64 addr; acpi_status status; - unsigned long flags, offset = 0; + unsigned long offset = 0; struct resource *root; /* Return AE_OK for non-window resources to keep scanning for more */ - status = resource_to_window(res, &addr); + status = resource_to_window(ares, &addr, resource); if (!ACPI_SUCCESS(status)) return AE_OK; - if (addr.resource_type == ACPI_MEMORY_RANGE) { - flags = IORESOURCE_MEM; + if (resource->flags & IORESOURCE_MEM) { root = &iomem_resource; offset = addr.translation_offset; - } else if (addr.resource_type == ACPI_IO_RANGE) { - flags = IORESOURCE_IO; + } else if (resource->flags & IORESOURCE_IO) { root = &ioport_resource; offset = add_io_space(info, &addr); if (offset == ~0) return AE_OK; + + /* + * io space address translation offset depends + * on the return value of add_io_space(). So + * Repopulate resource->start and end here. + */ + resource->start = addr.minimum + offset; + resource->end = resource->start + addr.address_length - 1; } else return AE_OK; - resource = &info->res[info->res_num]; resource->name = info->name; - resource->flags = flags; - resource->start = addr.minimum + offset; - resource->end = resource->start + addr.address_length - 1; info->res_offset[info->res_num] = offset; if (insert_resource(root, resource)) {