aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-10-06 17:33:44 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-04 11:47:18 -0500
commita369c791e881503a6253dafc0d0ad5e41e5557e5 (patch)
tree20de1e773f328875afbfaf96fedd3991e9288f68
parentfd95541e23e2c9acb1e38cd41fc0c7cc37fceb53 (diff)
PCI: print resources consistently with %pRt
This uses %pRt to print additional resource information (type, size, prefetchability, etc.) consistently. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/pci.c4
-rw-r--r--drivers/pci/probe.c26
-rw-r--r--drivers/pci/setup-bus.c9
-rw-r--r--drivers/pci/setup-res.c28
4 files changed, 24 insertions, 43 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 3f8d971ac36e..4859669f0ab5 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1678,9 +1678,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
1678 return 0; 1678 return 0;
1679 1679
1680err_out: 1680err_out:
1681 dev_warn(&pdev->dev, "BAR %d: can't reserve %s region %pR\n", 1681 dev_warn(&pdev->dev, "BAR %d: can't reserve %pRt\n", bar,
1682 bar,
1683 pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
1684 &pdev->resource[bar]); 1682 &pdev->resource[bar]);
1685 return -EBUSY; 1683 return -EBUSY;
1686} 1684}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8105e32117f6..2adb47574d86 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -222,6 +222,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
222 if (!sz64) 222 if (!sz64)
223 goto fail; 223 goto fail;
224 224
225 res->flags |= IORESOURCE_MEM_64;
226
225 if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) { 227 if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) {
226 dev_err(&dev->dev, "can't handle 64-bit BAR\n"); 228 dev_err(&dev->dev, "can't handle 64-bit BAR\n");
227 goto fail; 229 goto fail;
@@ -234,14 +236,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
234 } else { 236 } else {
235 res->start = l64; 237 res->start = l64;
236 res->end = l64 + sz64; 238 res->end = l64 + sz64;
237 dev_printk(KERN_DEBUG, &dev->dev, 239 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n",
238 "reg %x %s: %pR\n", pos, 240 pos, res);
239 (res->flags & IORESOURCE_PREFETCH) ?
240 "64bit mmio pref" : "64bit mmio",
241 res);
242 } 241 }
243
244 res->flags |= IORESOURCE_MEM_64;
245 } else { 242 } else {
246 sz = pci_size(l, sz, mask); 243 sz = pci_size(l, sz, mask);
247 244
@@ -251,11 +248,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
251 res->start = l; 248 res->start = l;
252 res->end = l + sz; 249 res->end = l + sz;
253 250
254 dev_printk(KERN_DEBUG, &dev->dev, "reg %x %s: %pR\n", pos, 251 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n", pos, res);
255 (res->flags & IORESOURCE_IO) ? "io port" :
256 ((res->flags & IORESOURCE_PREFETCH) ?
257 "32bit mmio pref" : "32bit mmio"),
258 res);
259 } 252 }
260 253
261 out: 254 out:
@@ -323,7 +316,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
323 res->start = base; 316 res->start = base;
324 if (!res->end) 317 if (!res->end)
325 res->end = limit + 0xfff; 318 res->end = limit + 0xfff;
326 dev_printk(KERN_DEBUG, &dev->dev, "bridge io port: %pR\n", res); 319 dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
327 } 320 }
328 321
329 res = child->resource[1]; 322 res = child->resource[1];
@@ -335,8 +328,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
335 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 328 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
336 res->start = base; 329 res->start = base;
337 res->end = limit + 0xfffff; 330 res->end = limit + 0xfffff;
338 dev_printk(KERN_DEBUG, &dev->dev, "bridge 32bit mmio: %pR\n", 331 dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
339 res);
340 } 332 }
341 333
342 res = child->resource[2]; 334 res = child->resource[2];
@@ -375,9 +367,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
375 res->flags |= IORESOURCE_MEM_64; 367 res->flags |= IORESOURCE_MEM_64;
376 res->start = base; 368 res->start = base;
377 res->end = limit + 0xfffff; 369 res->end = limit + 0xfffff;
378 dev_printk(KERN_DEBUG, &dev->dev, "bridge %sbit mmio pref: %pR\n", 370 dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
379 (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32",
380 res);
381 } 371 }
382} 372}
383 373
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index cb1a027eb552..ceb75333862b 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -390,8 +390,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
390 align = pci_resource_alignment(dev, r); 390 align = pci_resource_alignment(dev, r);
391 order = __ffs(align) - 20; 391 order = __ffs(align) - 20;
392 if (order > 11) { 392 if (order > 11) {
393 dev_warn(&dev->dev, "BAR %d bad alignment %llx: " 393 dev_warn(&dev->dev, "BAR %d: bad alignment %llx: "
394 "%pR\n", i, (unsigned long long)align, r); 394 "%pRt\n", i, (unsigned long long)align, r);
395 r->flags = 0; 395 r->flags = 0;
396 continue; 396 continue;
397 } 397 }
@@ -582,10 +582,7 @@ static void pci_bus_dump_res(struct pci_bus *bus)
582 if (!res || !res->end) 582 if (!res || !res->end)
583 continue; 583 continue;
584 584
585 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %s %pR\n", i, 585 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pRt\n", i, res);
586 (res->flags & IORESOURCE_IO) ? "io: " :
587 ((res->flags & IORESOURCE_PREFETCH)? "pref mem":"mem:"),
588 res);
589 } 586 }
590} 587}
591 588
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index c54526b206b5..5e78f2096ce8 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -51,11 +51,9 @@ void pci_update_resource(struct pci_dev *dev, int resno)
51 51
52 pcibios_resource_to_bus(dev, &region, res); 52 pcibios_resource_to_bus(dev, &region, res);
53 53
54 dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] " 54 dev_dbg(&dev->dev, "BAR %d: got %pRf (bus addr [%#llx-%#llx])\n",
55 "flags %#lx\n", resno, res, 55 resno, res, (unsigned long long)region.start,
56 (unsigned long long)region.start, 56 (unsigned long long)region.end);
57 (unsigned long long)region.end,
58 (unsigned long)res->flags);
59 57
60 new = region.start | (res->flags & PCI_REGION_FLAG_MASK); 58 new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
61 if (res->flags & IORESOURCE_IO) 59 if (res->flags & IORESOURCE_IO)
@@ -91,9 +89,9 @@ void pci_update_resource(struct pci_dev *dev, int resno)
91 } 89 }
92 } 90 }
93 res->flags &= ~IORESOURCE_UNSET; 91 res->flags &= ~IORESOURCE_UNSET;
94 dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n", 92 dev_dbg(&dev->dev, "BAR %d: moved to bus addr [%#llx-%#llx]\n",
95 resno, (unsigned long long)region.start, 93 resno, (unsigned long long)region.start,
96 (unsigned long long)region.end, res->flags); 94 (unsigned long long)region.end);
97} 95}
98 96
99int pci_claim_resource(struct pci_dev *dev, int resource) 97int pci_claim_resource(struct pci_dev *dev, int resource)
@@ -110,7 +108,7 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
110 108
111 if (err) { 109 if (err) {
112 const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; 110 const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
113 dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", 111 dev_err(&dev->dev, "BAR %d: %s %s %pRt\n",
114 resource, 112 resource,
115 root ? "address space collision on" : 113 root ? "address space collision on" :
116 "no parent found for", 114 "no parent found for",
@@ -181,9 +179,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
181 179
182 align = pci_resource_alignment(dev, res); 180 align = pci_resource_alignment(dev, res);
183 if (!align) { 181 if (!align) {
184 dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus " 182 dev_info(&dev->dev, "BAR %d: can't allocate %pRf "
185 "alignment) %pR flags %#lx\n", 183 "(bogus alignment)\n", resno, res);
186 resno, res, res->flags);
187 return -EINVAL; 184 return -EINVAL;
188 } 185 }
189 186
@@ -199,8 +196,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
199 } 196 }
200 197
201 if (ret) 198 if (ret)
202 dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", 199 dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n",
203 resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); 200 resno, res);
204 201
205 return ret; 202 return ret;
206} 203}
@@ -225,9 +222,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
225 222
226 r_align = pci_resource_alignment(dev, r); 223 r_align = pci_resource_alignment(dev, r);
227 if (!r_align) { 224 if (!r_align) {
228 dev_warn(&dev->dev, "BAR %d: bogus alignment " 225 dev_warn(&dev->dev, "BAR %d: bogus alignment %pRf\n",
229 "%pR flags %#lx\n", 226 i, r);
230 i, r, r->flags);
231 continue; 227 continue;
232 } 228 }
233 for (list = head; ; list = list->next) { 229 for (list = head; ; list = list->next) {