From patchwork Wed Nov 20 01:51:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 3205241 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 A7C7D9F26C for ; Wed, 20 Nov 2013 01:52:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2FBA206EB for ; Wed, 20 Nov 2013 01:52:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E20BE206DC for ; Wed, 20 Nov 2013 01:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261Ab3KTBwp (ORCPT ); Tue, 19 Nov 2013 20:52:45 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:31717 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752355Ab3KTBwo (ORCPT ); Tue, 19 Nov 2013 20:52:44 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAK1qaqv008936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Nov 2013 01:52:37 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAK1qZd7001827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Nov 2013 01:52:36 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAK1qZEX022184; Wed, 20 Nov 2013 01:52:35 GMT Received: from linux-siqj.site (/10.132.126.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Nov 2013 17:52:34 -0800 From: Yinghai Lu To: Bjorn Helgaas Cc: Gu Zheng , Guo Chao , linux-pci@vger.kernel.org, Yinghai Lu Subject: [PATCH 5/6] PCI: Add pcibios_bus_addr_to_res() Date: Tue, 19 Nov 2013 17:51:56 -0800 Message-Id: <1384912317-3721-6-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1384912317-3721-1-git-send-email-yinghai@kernel.org> References: <1384912317-3721-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.4 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 it takes addr and return converted address only. Signed-off-by: Yinghai Lu --- drivers/pci/host-bridge.c | 14 ++++++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index 2e7288b..c911adb 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -102,3 +102,17 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, __pcibios_bus_to_resource(dev->bus, res, region); } EXPORT_SYMBOL(pcibios_bus_to_resource); + +resource_size_t pcibios_bus_addr_to_res(struct pci_bus *bus, int flags, + resource_size_t addr) +{ + struct pci_bus_region region; + struct resource r; + + r.flags = flags; + region.start = addr; + region.end = addr; + __pcibios_bus_to_resource(bus, &r, ®ion); + + return r.end; +} diff --git a/include/linux/pci.h b/include/linux/pci.h index 55ee90f..3c6e399 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -745,6 +745,8 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +resource_size_t pcibios_bus_addr_to_res(struct pci_bus *bus, int flags, + resource_size_t addr); void pcibios_scan_specific_bus(int busn); struct pci_bus *pci_find_bus(int domain, int busnr); void pci_bus_add_devices(const struct pci_bus *bus);