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>
This commit is contained in:
parent
5446a6bdb5
commit
0cdbe30f0b
1 changed files with 9 additions and 5 deletions
|
@ -36,17 +36,18 @@ EXPORT_SYMBOL(pcie_mch_quirk);
|
||||||
|
|
||||||
#ifdef CONFIG_PCI_QUIRKS
|
#ifdef CONFIG_PCI_QUIRKS
|
||||||
/*
|
/*
|
||||||
* This quirk function disables the device and releases resources
|
* This quirk function disables memory decoding and releases memory resources
|
||||||
* which is specified by kernel's boot parameter 'pci=resource_alignment='.
|
* of the device specified by kernel's boot parameter 'pci=resource_alignment='.
|
||||||
* It also rounds up size to specified alignment.
|
* It also rounds up size to specified alignment.
|
||||||
* Later on, the kernel will assign page-aligned memory resource back
|
* 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)
|
static void __devinit quirk_resource_alignment(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct resource *r;
|
struct resource *r;
|
||||||
resource_size_t align, size;
|
resource_size_t align, size;
|
||||||
|
u16 command;
|
||||||
|
|
||||||
if (!pci_is_reassigndev(dev))
|
if (!pci_is_reassigndev(dev))
|
||||||
return;
|
return;
|
||||||
|
@ -58,8 +59,11 @@ static void __devinit quirk_resource_alignment(struct pci_dev *dev)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&dev->dev, "Disabling device and release resources.\n");
|
dev_info(&dev->dev,
|
||||||
pci_disable_device(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);
|
align = pci_specified_resource_alignment(dev);
|
||||||
for (i=0; i < PCI_BRIDGE_RESOURCES; i++) {
|
for (i=0; i < PCI_BRIDGE_RESOURCES; i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue