From patchwork Mon Jan 12 19:23:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 5615691 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C4D29F3A0 for ; Mon, 12 Jan 2015 19:27:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B5F820411 for ; Mon, 12 Jan 2015 19:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6A002039E for ; Mon, 12 Jan 2015 19:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757148AbbALT10 (ORCPT ); Mon, 12 Jan 2015 14:27:26 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:46391 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755863AbbALTZA (ORCPT ); Mon, 12 Jan 2015 14:25:00 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0CJOoKW030365 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Jan 2015 19:24:51 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 t0CJOnEh009652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 12 Jan 2015 19:24:50 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0CJOmlF027322; Mon, 12 Jan 2015 19:24:48 GMT Received: from linux-siqj.site (/10.132.126.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Jan 2015 11:24:48 -0800 From: Yinghai Lu To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu , "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org Subject: [PATCH 08/10] PCI, parisc: clip firmware assigned resource under parent bridge's Date: Mon, 12 Jan 2015 11:23:18 -0800 Message-Id: <1421090600-9750-9-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1421090600-9750-1-git-send-email-yinghai@kernel.org> References: <1421090600-9750-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars. We'd like to fix other arches instead of just x86. Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491 Reported-by: Marek Kordik Fixes: 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources") Signed-off-by: Yinghai Lu Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: linux-parisc@vger.kernel.org Acked-by: Helge Deller --- drivers/parisc/lba_pci.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 37e71ff..e6ab352 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -692,11 +692,25 @@ lba_fixup_bus(struct pci_bus *bus) */ if (bus->parent) { int i; + bool changed = false; + + dev = bus->self; /* PCI-PCI Bridge */ pci_read_bridge_bases(bus); for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { - pci_claim_resource(bus->self, i); + struct resource *res = &dev->resource[i]; + + if (pci_claim_resource(dev, i) >= 0) + continue; + + if (pci_bus_clip_resource(dev, res)) { + changed = true; + if (pci_claim_resource(dev, i) >= 0) + continue; + } } + if (changed) + pci_setup_bridge(bus); } else { /* Host-PCI Bridge */ int err; @@ -776,7 +790,15 @@ lba_fixup_bus(struct pci_bus *bus) ** that share expansion ROMs (think quad tulip), but ** isn't harmful. */ - pci_claim_resource(dev, i); + if (pci_claim_resource(dev, i) >= 0) + continue; + + /* try again with clip */ + if (i != PCI_ROM_RESOURCE && + pci_bus_clip_resource(dev, res)) { + pci_update_resource(dev, i); + pci_claim_resource(dev, i); + } } #ifdef FBB_SUPPORT