From patchwork Wed Apr 1 07:48:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuji Shimada X-Patchwork-Id: 15591 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 n317m9kC008875 for ; Wed, 1 Apr 2009 07:48:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760190AbZDAHsJ (ORCPT ); Wed, 1 Apr 2009 03:48:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760268AbZDAHsJ (ORCPT ); Wed, 1 Apr 2009 03:48:09 -0400 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:46571 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760190AbZDAHsI (ORCPT ); Wed, 1 Apr 2009 03:48:08 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n317m5PM017713; Wed, 1 Apr 2009 16:48:05 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n317m5j16161; Wed, 1 Apr 2009 16:48:05 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv.nec.co.jp (8.13.8/8.13.4) with ESMTP id n317m4qu021680; Wed, 1 Apr 2009 16:48:04 +0900 (JST) Received: from matabe.jp.nec.com ([10.26.220.20] [10.26.220.20]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-269308; Wed, 1 Apr 2009 16:48:03 +0900 Received: from [10.58.40.47] ([10.58.40.47] [10.58.40.47]) by mail.jp.nec.com with ESMTP; Wed, 1 Apr 2009 16:48:03 +0900 Date: Wed, 01 Apr 2009 16:48:05 +0900 From: Yuji Shimada To: Jesse Barnes , linux-pci@vger.kernel.org Subject: [PATCH] Fix breakage of enable_cnt in quirk_resource_alignment Message-Id: <20090401164439.A78B.27C06F64@necst.nec.co.jp> MIME-Version: 1.0 X-Mailer: Becky! ver. 2.50 [ja] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This patch fixes breakage of of enable_cnt in quirk_resource_alignment. Current quirk_resource_alignment calls pci_disable_device. pci_disable_device decrements enable_cnt, so that enable_cnt becomes -1. The patch disables memory decoding, writing command register directly. So enable_cnt is not broken. Thanks, --- Yuji Shimada Signed-off-by: Yuji Shimada -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 9b2f0d9..11cbfe8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -36,17 +36,18 @@ EXPORT_SYMBOL(pcie_mch_quirk); #ifdef CONFIG_PCI_QUIRKS /* - * This quirk function disables the device and releases resources - * which is specified by kernel's boot parameter 'pci=resource_alignment='. + * This quirk function disables memory decoding and releases memory resources + * of the device specified by kernel's boot parameter 'pci=resource_alignment='. * It also rounds up size to specified alignment. * Later on, the kernel will assign page-aligned memory resource back - * to that device. + * to the device. */ static void __devinit quirk_resource_alignment(struct pci_dev *dev) { int i; struct resource *r; resource_size_t align, size; + u16 command; if (!pci_is_reassigndev(dev)) return; @@ -58,8 +59,11 @@ static void __devinit quirk_resource_alignment(struct pci_dev *dev) return; } - dev_info(&dev->dev, "Disabling device and release resources.\n"); - pci_disable_device(dev); + dev_info(&dev->dev, + "Disabling memory decoding and release memory resources.\n"); + pci_read_config_word(dev, PCI_COMMAND, &command); + command &= ~PCI_COMMAND_MEMORY; + pci_write_config_word(dev, PCI_COMMAND, command); align = pci_specified_resource_alignment(dev); for (i=0; i < PCI_BRIDGE_RESOURCES; i++) {