diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/pci/setup-res.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r-- | drivers/pci/setup-res.c | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index c54526b206b5..17bed18d24ad 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -51,12 +51,6 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
51 | 51 | ||
52 | pcibios_resource_to_bus(dev, ®ion, res); | 52 | pcibios_resource_to_bus(dev, ®ion, res); |
53 | 53 | ||
54 | dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] " | ||
55 | "flags %#lx\n", resno, res, | ||
56 | (unsigned long long)region.start, | ||
57 | (unsigned long long)region.end, | ||
58 | (unsigned long)res->flags); | ||
59 | |||
60 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); | 54 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); |
61 | if (res->flags & IORESOURCE_IO) | 55 | if (res->flags & IORESOURCE_IO) |
62 | mask = (u32)PCI_BASE_ADDRESS_IO_MASK; | 56 | mask = (u32)PCI_BASE_ADDRESS_IO_MASK; |
@@ -91,40 +85,39 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
91 | } | 85 | } |
92 | } | 86 | } |
93 | res->flags &= ~IORESOURCE_UNSET; | 87 | res->flags &= ~IORESOURCE_UNSET; |
94 | dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n", | 88 | dev_info(&dev->dev, "BAR %d: set to %pR (PCI address [%#llx-%#llx]\n", |
95 | resno, (unsigned long long)region.start, | 89 | resno, res, (unsigned long long)region.start, |
96 | (unsigned long long)region.end, res->flags); | 90 | (unsigned long long)region.end); |
97 | } | 91 | } |
98 | 92 | ||
99 | int pci_claim_resource(struct pci_dev *dev, int resource) | 93 | int pci_claim_resource(struct pci_dev *dev, int resource) |
100 | { | 94 | { |
101 | struct resource *res = &dev->resource[resource]; | 95 | struct resource *res = &dev->resource[resource]; |
102 | struct resource *root; | 96 | struct resource *root, *conflict; |
103 | int err; | ||
104 | 97 | ||
105 | root = pci_find_parent_resource(dev, res); | 98 | root = pci_find_parent_resource(dev, res); |
99 | if (!root) { | ||
100 | dev_err(&dev->dev, "no compatible bridge window for %pR\n", | ||
101 | res); | ||
102 | return -EINVAL; | ||
103 | } | ||
106 | 104 | ||
107 | err = -EINVAL; | 105 | conflict = request_resource_conflict(root, res); |
108 | if (root != NULL) | 106 | if (conflict) { |
109 | err = request_resource(root, res); | 107 | dev_err(&dev->dev, |
110 | 108 | "address space collision: %pR conflicts with %s %pR\n", | |
111 | if (err) { | 109 | res, conflict->name, conflict); |
112 | const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; | 110 | return -EBUSY; |
113 | dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", | ||
114 | resource, | ||
115 | root ? "address space collision on" : | ||
116 | "no parent found for", | ||
117 | dtype, res); | ||
118 | } | 111 | } |
119 | 112 | ||
120 | return err; | 113 | return 0; |
121 | } | 114 | } |
122 | EXPORT_SYMBOL(pci_claim_resource); | 115 | EXPORT_SYMBOL(pci_claim_resource); |
123 | 116 | ||
124 | #ifdef CONFIG_PCI_QUIRKS | 117 | #ifdef CONFIG_PCI_QUIRKS |
125 | void pci_disable_bridge_window(struct pci_dev *dev) | 118 | void pci_disable_bridge_window(struct pci_dev *dev) |
126 | { | 119 | { |
127 | dev_dbg(&dev->dev, "Disabling bridge window.\n"); | 120 | dev_info(&dev->dev, "disabling bridge mem windows\n"); |
128 | 121 | ||
129 | /* MMIO Base/Limit */ | 122 | /* MMIO Base/Limit */ |
130 | pci_write_config_dword(dev, PCI_MEMORY_BASE, 0x0000fff0); | 123 | pci_write_config_dword(dev, PCI_MEMORY_BASE, 0x0000fff0); |
@@ -165,6 +158,7 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, | |||
165 | 158 | ||
166 | if (!ret) { | 159 | if (!ret) { |
167 | res->flags &= ~IORESOURCE_STARTALIGN; | 160 | res->flags &= ~IORESOURCE_STARTALIGN; |
161 | dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); | ||
168 | if (resno < PCI_BRIDGE_RESOURCES) | 162 | if (resno < PCI_BRIDGE_RESOURCES) |
169 | pci_update_resource(dev, resno); | 163 | pci_update_resource(dev, resno); |
170 | } | 164 | } |
@@ -178,12 +172,12 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
178 | resource_size_t align; | 172 | resource_size_t align; |
179 | struct pci_bus *bus; | 173 | struct pci_bus *bus; |
180 | int ret; | 174 | int ret; |
175 | char *type; | ||
181 | 176 | ||
182 | align = pci_resource_alignment(dev, res); | 177 | align = pci_resource_alignment(dev, res); |
183 | if (!align) { | 178 | if (!align) { |
184 | dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus " | 179 | dev_info(&dev->dev, "BAR %d: can't assign %pR " |
185 | "alignment) %pR flags %#lx\n", | 180 | "(bogus alignment)\n", resno, res); |
186 | resno, res, res->flags); | ||
187 | return -EINVAL; | 181 | return -EINVAL; |
188 | } | 182 | } |
189 | 183 | ||
@@ -198,9 +192,20 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
198 | break; | 192 | break; |
199 | } | 193 | } |
200 | 194 | ||
201 | if (ret) | 195 | if (ret) { |
202 | dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", | 196 | if (res->flags & IORESOURCE_MEM) |
203 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); | 197 | if (res->flags & IORESOURCE_PREFETCH) |
198 | type = "mem pref"; | ||
199 | else | ||
200 | type = "mem"; | ||
201 | else if (res->flags & IORESOURCE_IO) | ||
202 | type = "io"; | ||
203 | else | ||
204 | type = "unknown"; | ||
205 | dev_info(&dev->dev, | ||
206 | "BAR %d: can't assign %s (size %#llx)\n", | ||
207 | resno, type, (unsigned long long) resource_size(res)); | ||
208 | } | ||
204 | 209 | ||
205 | return ret; | 210 | return ret; |
206 | } | 211 | } |
@@ -225,9 +230,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
225 | 230 | ||
226 | r_align = pci_resource_alignment(dev, r); | 231 | r_align = pci_resource_alignment(dev, r); |
227 | if (!r_align) { | 232 | if (!r_align) { |
228 | dev_warn(&dev->dev, "BAR %d: bogus alignment " | 233 | dev_warn(&dev->dev, "BAR %d: %pR has bogus alignment\n", |
229 | "%pR flags %#lx\n", | 234 | i, r); |
230 | i, r, r->flags); | ||
231 | continue; | 235 | continue; |
232 | } | 236 | } |
233 | for (list = head; ; list = list->next) { | 237 | for (list = head; ; list = list->next) { |
@@ -274,8 +278,8 @@ int pci_enable_resources(struct pci_dev *dev, int mask) | |||
274 | continue; | 278 | continue; |
275 | 279 | ||
276 | if (!r->parent) { | 280 | if (!r->parent) { |
277 | dev_err(&dev->dev, "device not available because of " | 281 | dev_err(&dev->dev, "device not available " |
278 | "BAR %d %pR collisions\n", i, r); | 282 | "(can't reserve %pR)\n", r); |
279 | return -EINVAL; | 283 | return -EINVAL; |
280 | } | 284 | } |
281 | 285 | ||