diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-02-16 00:40:31 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-24 17:37:26 -0500 |
commit | 2069ecfbe14ebd71a6f98e8a00724e9adf4fe4ee (patch) | |
tree | 5a0328d6e545a6488e85face05b0a4d78676bedf /drivers/pci/quirks.c | |
parent | 8474ecd9231434d71a39cd1ba118629e1b036137 (diff) |
PCI: Move "pci reassigndev resource alignment" out of quirks.c
This isn't really a quirk; calling it directly from pci_add_device makes
more sense.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index e198589d0990..f8f81d4f29ff 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -32,69 +32,6 @@ | |||
32 | #include "pci.h" | 32 | #include "pci.h" |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * This quirk function disables memory decoding and releases memory resources | ||
36 | * of the device specified by kernel's boot parameter 'pci=resource_alignment='. | ||
37 | * It also rounds up size to specified alignment. | ||
38 | * Later on, the kernel will assign page-aligned memory resource back | ||
39 | * to the device. | ||
40 | */ | ||
41 | static void __devinit quirk_resource_alignment(struct pci_dev *dev) | ||
42 | { | ||
43 | int i; | ||
44 | struct resource *r; | ||
45 | resource_size_t align, size; | ||
46 | u16 command; | ||
47 | |||
48 | if (!pci_is_reassigndev(dev)) | ||
49 | return; | ||
50 | |||
51 | if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL && | ||
52 | (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) { | ||
53 | dev_warn(&dev->dev, | ||
54 | "Can't reassign resources to host bridge.\n"); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | dev_info(&dev->dev, | ||
59 | "Disabling memory decoding and releasing memory resources.\n"); | ||
60 | pci_read_config_word(dev, PCI_COMMAND, &command); | ||
61 | command &= ~PCI_COMMAND_MEMORY; | ||
62 | pci_write_config_word(dev, PCI_COMMAND, command); | ||
63 | |||
64 | align = pci_specified_resource_alignment(dev); | ||
65 | for (i=0; i < PCI_BRIDGE_RESOURCES; i++) { | ||
66 | r = &dev->resource[i]; | ||
67 | if (!(r->flags & IORESOURCE_MEM)) | ||
68 | continue; | ||
69 | size = resource_size(r); | ||
70 | if (size < align) { | ||
71 | size = align; | ||
72 | dev_info(&dev->dev, | ||
73 | "Rounding up size of resource #%d to %#llx.\n", | ||
74 | i, (unsigned long long)size); | ||
75 | } | ||
76 | r->end = size - 1; | ||
77 | r->start = 0; | ||
78 | } | ||
79 | /* Need to disable bridge's resource window, | ||
80 | * to enable the kernel to reassign new resource | ||
81 | * window later on. | ||
82 | */ | ||
83 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | ||
84 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
85 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { | ||
86 | r = &dev->resource[i]; | ||
87 | if (!(r->flags & IORESOURCE_MEM)) | ||
88 | continue; | ||
89 | r->end = resource_size(r) - 1; | ||
90 | r->start = 0; | ||
91 | } | ||
92 | pci_disable_bridge_window(dev); | ||
93 | } | ||
94 | } | ||
95 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_resource_alignment); | ||
96 | |||
97 | /* | ||
98 | * Decoding should be disabled for a PCI device during BAR sizing to avoid | 35 | * Decoding should be disabled for a PCI device during BAR sizing to avoid |
99 | * conflict. But doing so may cause problems on host bridge and perhaps other | 36 | * conflict. But doing so may cause problems on host bridge and perhaps other |
100 | * key system devices. For devices that need to have mmio decoding always-on, | 37 | * key system devices. For devices that need to have mmio decoding always-on, |