diff options
author | Yuji Shimada <shimada-yxb@necst.nec.co.jp> | 2009-04-05 21:24:21 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-04-06 14:27:58 -0400 |
commit | 0cdbe30f0b04466a1fee11b81b3667bd1b982549 (patch) | |
tree | 8efc02bd7f6fe405471eb343d936d384727cfea1 /drivers/pci/quirks.c | |
parent | 5446a6bdb51e71da7a203e395b0b4c668d559a3a (diff) |
PCI: don't corrupt enable_cnt when doing manual resource alignment
This patch fixes breakage of of enable_cnt in quirk_resource_alignment.
Currently, 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.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 51011a24589d..0254741bece0 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -36,17 +36,18 @@ EXPORT_SYMBOL(pcie_mch_quirk); | |||
36 | 36 | ||
37 | #ifdef CONFIG_PCI_QUIRKS | 37 | #ifdef CONFIG_PCI_QUIRKS |
38 | /* | 38 | /* |
39 | * This quirk function disables the device and releases resources | 39 | * This quirk function disables memory decoding and releases memory resources |
40 | * which is specified by kernel's boot parameter 'pci=resource_alignment='. | 40 | * of the device specified by kernel's boot parameter 'pci=resource_alignment='. |
41 | * It also rounds up size to specified alignment. | 41 | * It also rounds up size to specified alignment. |
42 | * Later on, the kernel will assign page-aligned memory resource back | 42 | * Later on, the kernel will assign page-aligned memory resource back |
43 | * to that device. | 43 | * to the device. |
44 | */ | 44 | */ |
45 | static void __devinit quirk_resource_alignment(struct pci_dev *dev) | 45 | static void __devinit quirk_resource_alignment(struct pci_dev *dev) |
46 | { | 46 | { |
47 | int i; | 47 | int i; |
48 | struct resource *r; | 48 | struct resource *r; |
49 | resource_size_t align, size; | 49 | resource_size_t align, size; |
50 | u16 command; | ||
50 | 51 | ||
51 | if (!pci_is_reassigndev(dev)) | 52 | if (!pci_is_reassigndev(dev)) |
52 | return; | 53 | return; |
@@ -58,8 +59,11 @@ static void __devinit quirk_resource_alignment(struct pci_dev *dev) | |||
58 | return; | 59 | return; |
59 | } | 60 | } |
60 | 61 | ||
61 | dev_info(&dev->dev, "Disabling device and release resources.\n"); | 62 | dev_info(&dev->dev, |
62 | pci_disable_device(dev); | 63 | "Disabling memory decoding and releasing memory resources.\n"); |
64 | pci_read_config_word(dev, PCI_COMMAND, &command); | ||
65 | command &= ~PCI_COMMAND_MEMORY; | ||
66 | pci_write_config_word(dev, PCI_COMMAND, command); | ||
63 | 67 | ||
64 | align = pci_specified_resource_alignment(dev); | 68 | align = pci_specified_resource_alignment(dev); |
65 | for (i=0; i < PCI_BRIDGE_RESOURCES; i++) { | 69 | for (i=0; i < PCI_BRIDGE_RESOURCES; i++) { |