From patchwork Wed Nov 4 17:39:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 57712 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA4Hf3uh014081 for ; Wed, 4 Nov 2009 17:41:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932480AbZKDRjT (ORCPT ); Wed, 4 Nov 2009 12:39:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932458AbZKDRjR (ORCPT ); Wed, 4 Nov 2009 12:39:17 -0500 Received: from g6t0186.atlanta.hp.com ([15.193.32.63]:44582 "EHLO g6t0186.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932464AbZKDRjO (ORCPT ); Wed, 4 Nov 2009 12:39:14 -0500 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g6t0186.atlanta.hp.com (Postfix) with ESMTP id 611972C16C; Wed, 4 Nov 2009 17:39:19 +0000 (UTC) Received: from ldl (linux.corp.hp.com [15.11.146.101]) by g1t0039.austin.hp.com (Postfix) with ESMTP id DA96D34051; Wed, 4 Nov 2009 17:39:18 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id BBF5BCF000B; Wed, 4 Nov 2009 10:39:18 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6gNJdt81LoOz; Wed, 4 Nov 2009 10:39:18 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id A7092CF0007; Wed, 4 Nov 2009 10:39:18 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 9079326142; Wed, 4 Nov 2009 10:39:18 -0700 (MST) Subject: [PATCH 2/2] x86/PCI: fix bogus host bridge window start/end alignment from _CRS To: Jesse Barnes From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Date: Wed, 04 Nov 2009 10:39:18 -0700 Message-ID: <20091104173918.17517.1738.stgit@bob.kio> In-Reply-To: <20091104173601.17517.71697.stgit@bob.kio> References: <20091104173601.17517.71697.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 54db5a0..8ddf4f4 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -59,6 +59,30 @@ bus_has_transparent_bridge(struct pci_bus *bus) return false; } +static void +align_resource(struct acpi_device *bridge, struct resource *res) +{ + int align = (res->flags & IORESOURCE_MEM) ? 16 : 4; + + /* + * Host bridge windows are not BARs, but the decoders on the PCI side + * that claim this address space have starting alignment and length + * constraints, so fix any obvious BIOS goofs. + */ + if (res->start & (align - 1)) { + dev_printk(KERN_DEBUG, &bridge->dev, + "host bridge window %pR invalid; " + "aligning start to %d-byte boundary\n", res, align); + res->start &= ~(align - 1); + } + if ((res->end + 1) & (align - 1)) { + dev_printk(KERN_DEBUG, &bridge->dev, + "host bridge window %pR invalid; " + "aligning end to %d-byte boundary\n", res, align); + res->end = roundup(res->end, align) - 1; + } +} + static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data) { @@ -107,6 +131,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data) res->start = start; res->end = end; res->child = NULL; + align_resource(info->bridge, res); if (!(pci_probe & PCI_USE__CRS)) { dev_printk(KERN_DEBUG, &info->bridge->dev,