From patchwork Mon Apr 6 01:24:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuji Shimada X-Patchwork-Id: 16473 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 n361ORd1015741 for ; Mon, 6 Apr 2009 01:24:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752069AbZDFBY1 (ORCPT ); Sun, 5 Apr 2009 21:24:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752869AbZDFBY1 (ORCPT ); Sun, 5 Apr 2009 21:24:27 -0400 Received: from TYO202.gate.nec.co.jp ([202.32.8.206]:62207 "EHLO tyo202.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbZDFBY0 (ORCPT ); Sun, 5 Apr 2009 21:24:26 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n361OMtn011207; Mon, 6 Apr 2009 10:24:22 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n361OMF11925; Mon, 6 Apr 2009 10:24:22 +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 n361OM0h014417; Mon, 6 Apr 2009 10:24:22 +0900 (JST) Received: from tatewaki.jp.nec.com ([10.26.220.19] [10.26.220.19]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-348792; Mon, 6 Apr 2009 10:24:21 +0900 Received: from [10.58.63.124] ([10.58.63.124] [10.58.63.124]) by mail.jp.nec.com with ESMTP; Mon, 6 Apr 2009 10:24:21 +0900 Date: Mon, 06 Apr 2009 10:24:21 +0900 From: Yuji Shimada To: Jesse Barnes , linux-pci@vger.kernel.org Subject: [PATCH v2] Fix breakage of enable_cnt in quirk_resource_alignment In-Reply-To: <20090401164439.A78B.27C06F64@necst.nec.co.jp> References: <20090401164439.A78B.27C06F64@necst.nec.co.jp> Message-Id: <20090406102153.04A3.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. v1 -> v2 - Fix a message. 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..755dd32 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 releasing 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++) {