From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from acsinet15.oracle.com ([141.146.126.227]:25578 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162073Ab2CSFuB (ORCPT ); Mon, 19 Mar 2012 01:50:01 -0400 From: Yinghai Lu To: Jesse Barnes , x86 Cc: Bjorn Helgaas , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH -v2 22/26] PCI: Update pci_resource_bar() to support addon_resource Date: Sun, 18 Mar 2012 22:48:45 -0700 Message-Id: <1332136129-14010-23-git-send-email-yinghai@kernel.org> In-Reply-To: <1332136129-14010-1-git-send-email-yinghai@kernel.org> References: <1332136129-14010-1-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org List-ID: need to loop addon resource list to retrieve reg_addr in it. Signed-off-by: Yinghai Lu --- drivers/pci/pci.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5439033..8b9acf6 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3549,6 +3549,13 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) reg = pci_iov_resource_bar(dev, resno, type); if (reg) return reg; + } else if (resno >= PCI_NUM_RESOURCES) { + struct resource *res = pci_dev_resource_n(dev, resno); + + if (res) { + *type = pci_bar_unknown; + return to_pci_dev_addon_resource(res)->reg_addr; + } } dev_err(&dev->dev, "BAR %d: invalid resource\n", resno); -- 1.7.7