PCI: print resources consistently with %pRt
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Tue, 6 Oct 2009 21:33:44 +0000 (15:33 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 4 Nov 2009 16:47:18 +0000 (08:47 -0800)
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>
drivers/pci/pci.c
drivers/pci/probe.c
drivers/pci/setup-bus.c
drivers/pci/setup-res.c

index 3f8d971ac36e9c9cec418e274bb1850d7eaef11a..4859669f0ab51e6d4cd7c368fcd31bd66efc8008 100644 (file)
@@ -1678,9 +1678,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
        return 0;
 
 err_out:
-       dev_warn(&pdev->dev, "BAR %d: can't reserve %s region %pR\n",
-                bar,
-                pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
+       dev_warn(&pdev->dev, "BAR %d: can't reserve %pRt\n", bar,
                 &pdev->resource[bar]);
        return -EBUSY;
 }
index 8105e32117f67d8ce60317fb9a4151b305773434..2adb47574d860399eba7efcd9db7f83d09d190cd 100644 (file)
@@ -222,6 +222,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                if (!sz64)
                        goto fail;
 
+               res->flags |= IORESOURCE_MEM_64;
+
                if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) {
                        dev_err(&dev->dev, "can't handle 64-bit BAR\n");
                        goto fail;
@@ -234,14 +236,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                } else {
                        res->start = l64;
                        res->end = l64 + sz64;
-                       dev_printk(KERN_DEBUG, &dev->dev,
-                               "reg %x %s: %pR\n", pos,
-                                (res->flags & IORESOURCE_PREFETCH) ?
-                                       "64bit mmio pref" : "64bit mmio",
-                                res);
+                       dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n",
+                                  pos, res);
                }
-
-               res->flags |= IORESOURCE_MEM_64;
        } else {
                sz = pci_size(l, sz, mask);
 
@@ -251,11 +248,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                res->start = l;
                res->end = l + sz;
 
-               dev_printk(KERN_DEBUG, &dev->dev, "reg %x %s: %pR\n", pos,
-                       (res->flags & IORESOURCE_IO) ? "io port" :
-                        ((res->flags & IORESOURCE_PREFETCH) ?
-                                "32bit mmio pref" : "32bit mmio"),
-                       res);
+               dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n", pos, res);
        }
 
  out:
@@ -323,7 +316,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                        res->start = base;
                if (!res->end)
                        res->end = limit + 0xfff;
-               dev_printk(KERN_DEBUG, &dev->dev, "bridge io port: %pR\n", res);
+               dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
        }
 
        res = child->resource[1];
@@ -335,8 +328,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
                res->start = base;
                res->end = limit + 0xfffff;
-               dev_printk(KERN_DEBUG, &dev->dev, "bridge 32bit mmio: %pR\n",
-                       res);
+               dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
        }
 
        res = child->resource[2];
@@ -375,9 +367,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                        res->flags |= IORESOURCE_MEM_64;
                res->start = base;
                res->end = limit + 0xfffff;
-               dev_printk(KERN_DEBUG, &dev->dev, "bridge %sbit mmio pref: %pR\n",
-                       (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32",
-                       res);
+               dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
        }
 }
 
index cb1a027eb552228a08bc53cef27af8e7db34e70e..ceb75333862ba583599653a5974fa38c314fb8d8 100644 (file)
@@ -390,8 +390,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
                        align = pci_resource_alignment(dev, r);
                        order = __ffs(align) - 20;
                        if (order > 11) {
-                               dev_warn(&dev->dev, "BAR %d bad alignment %llx: "
-                                        "%pR\n", i, (unsigned long long)align, r);
+                               dev_warn(&dev->dev, "BAR %d: bad alignment %llx: "
+                                        "%pRt\n", i, (unsigned long long)align, r);
                                r->flags = 0;
                                continue;
                        }
@@ -582,10 +582,7 @@ static void pci_bus_dump_res(struct pci_bus *bus)
                 if (!res || !res->end)
                         continue;
 
-               dev_printk(KERN_DEBUG, &bus->dev, "resource %d %s %pR\n", i,
-                          (res->flags & IORESOURCE_IO) ? "io: " :
-                           ((res->flags & IORESOURCE_PREFETCH)? "pref mem":"mem:"),
-                          res);
+               dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pRt\n", i, res);
         }
 }
 
index c54526b206b5da957d78170a6e430ce5c3b9f95b..5e78f2096ce813e60aa1fc35512bb72e13c16673 100644 (file)
@@ -51,11 +51,9 @@ void pci_update_resource(struct pci_dev *dev, int resno)
 
        pcibios_resource_to_bus(dev, &region, res);
 
-       dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] "
-               "flags %#lx\n", resno, res,
-                (unsigned long long)region.start,
-                (unsigned long long)region.end,
-                (unsigned long)res->flags);
+       dev_dbg(&dev->dev, "BAR %d: got %pRf (bus addr [%#llx-%#llx])\n",
+               resno, res, (unsigned long long)region.start,
+               (unsigned long long)region.end);
 
        new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
        if (res->flags & IORESOURCE_IO)
@@ -91,9 +89,9 @@ void pci_update_resource(struct pci_dev *dev, int resno)
                }
        }
        res->flags &= ~IORESOURCE_UNSET;
-       dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n",
+       dev_dbg(&dev->dev, "BAR %d: moved to bus addr [%#llx-%#llx]\n",
                resno, (unsigned long long)region.start,
-               (unsigned long long)region.end, res->flags);
+               (unsigned long long)region.end);
 }
 
 int pci_claim_resource(struct pci_dev *dev, int resource)
@@ -110,7 +108,7 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
 
        if (err) {
                const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
-               dev_err(&dev->dev, "BAR %d: %s of %s %pR\n",
+               dev_err(&dev->dev, "BAR %d: %s %s %pRt\n",
                        resource,
                        root ? "address space collision on" :
                                "no parent found for",
@@ -181,9 +179,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
 
        align = pci_resource_alignment(dev, res);
        if (!align) {
-               dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus "
-                       "alignment) %pR flags %#lx\n",
-                       resno, res, res->flags);
+               dev_info(&dev->dev, "BAR %d: can't allocate %pRf "
+                        "(bogus alignment)\n", resno, res);
                return -EINVAL;
        }
 
@@ -199,8 +196,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
        }
 
        if (ret)
-               dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
-                       resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
+               dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n",
+                        resno, res);
 
        return ret;
 }
@@ -225,9 +222,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
 
                r_align = pci_resource_alignment(dev, r);
                if (!r_align) {
-                       dev_warn(&dev->dev, "BAR %d: bogus alignment "
-                               "%pR flags %#lx\n",
-                               i, r, r->flags);
+                       dev_warn(&dev->dev, "BAR %d: bogus alignment %pRf\n",
+                                i, r);
                        continue;
                }
                for (list = head; ; list = list->next) {