Commit ae2a84b4 authored by Kevin Hao's avatar Kevin Hao Committed by Michael Ellerman

powerpc: pci: use %pR for printing struct resource

Use %pR to simplify the debug code. This also make the debug info more
readable.
Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
[mpe: Unsplit multi-line printk strings]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 368857c1
...@@ -823,23 +823,15 @@ static void pcibios_fixup_resources(struct pci_dev *dev) ...@@ -823,23 +823,15 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
(reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
/* Only print message if not re-assigning */ /* Only print message if not re-assigning */
if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC))
pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " pr_debug("PCI:%s Resource %d %pR is unassigned\n",
"is unassigned\n", pci_name(dev), i, res);
pci_name(dev), i,
(unsigned long long)res->start,
(unsigned long long)res->end,
(unsigned int)res->flags);
res->end -= res->start; res->end -= res->start;
res->start = 0; res->start = 0;
res->flags |= IORESOURCE_UNSET; res->flags |= IORESOURCE_UNSET;
continue; continue;
} }
pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n", pr_debug("PCI:%s Resource %d %pR\n", pci_name(dev), i, res);
pci_name(dev), i,
(unsigned long long)res->start,\
(unsigned long long)res->end,
(unsigned int)res->flags);
} }
/* Call machine specific resource fixup */ /* Call machine specific resource fixup */
...@@ -943,11 +935,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus) ...@@ -943,11 +935,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus)
continue; continue;
} }
pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x]\n", pr_debug("PCI:%s Bus rsrc %d %pR\n", pci_name(dev), i, res);
pci_name(dev), i,
(unsigned long long)res->start,\
(unsigned long long)res->end,
(unsigned int)res->flags);
/* Try to detect uninitialized P2P bridge resources, /* Try to detect uninitialized P2P bridge resources,
* and clear them out so they get re-assigned later * and clear them out so they get re-assigned later
...@@ -1132,10 +1120,8 @@ static int reparent_resources(struct resource *parent, ...@@ -1132,10 +1120,8 @@ static int reparent_resources(struct resource *parent,
*pp = NULL; *pp = NULL;
for (p = res->child; p != NULL; p = p->sibling) { for (p = res->child; p != NULL; p = p->sibling) {
p->parent = res; p->parent = res;
pr_debug("PCI: Reparented %s [%llx..%llx] under %s\n", pr_debug("PCI: Reparented %s %pR under %s\n",
p->name, p->name, p, res->name);
(unsigned long long)p->start,
(unsigned long long)p->end, res->name);
} }
return 0; return 0;
} }
...@@ -1204,14 +1190,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) ...@@ -1204,14 +1190,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
} }
} }
pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " pr_debug("PCI: %s (bus %d) bridge rsrc %d: %pR, parent %p (%s)\n",
"[0x%x], parent %p (%s)\n", bus->self ? pci_name(bus->self) : "PHB", bus->number,
bus->self ? pci_name(bus->self) : "PHB", i, res, pr, (pr && pr->name) ? pr->name : "nil");
bus->number, i,
(unsigned long long)res->start,
(unsigned long long)res->end,
(unsigned int)res->flags,
pr, (pr && pr->name) ? pr->name : "nil");
if (pr && !(pr->flags & IORESOURCE_UNSET)) { if (pr && !(pr->flags & IORESOURCE_UNSET)) {
struct pci_dev *dev = bus->self; struct pci_dev *dev = bus->self;
...@@ -1253,11 +1234,8 @@ static inline void alloc_resource(struct pci_dev *dev, int idx) ...@@ -1253,11 +1234,8 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
{ {
struct resource *pr, *r = &dev->resource[idx]; struct resource *pr, *r = &dev->resource[idx];
pr_debug("PCI: Allocating %s: Resource %d: %016llx..%016llx [%x]\n", pr_debug("PCI: Allocating %s: Resource %d: %pR\n",
pci_name(dev), idx, pci_name(dev), idx, r);
(unsigned long long)r->start,
(unsigned long long)r->end,
(unsigned int)r->flags);
pr = pci_find_parent_resource(dev, r); pr = pci_find_parent_resource(dev, r);
if (!pr || (pr->flags & IORESOURCE_UNSET) || if (!pr || (pr->flags & IORESOURCE_UNSET) ||
...@@ -1265,11 +1243,7 @@ static inline void alloc_resource(struct pci_dev *dev, int idx) ...@@ -1265,11 +1243,7 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
printk(KERN_WARNING "PCI: Cannot allocate resource region %d" printk(KERN_WARNING "PCI: Cannot allocate resource region %d"
" of device %s, will remap\n", idx, pci_name(dev)); " of device %s, will remap\n", idx, pci_name(dev));
if (pr) if (pr)
pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n", pr_debug("PCI: parent is %p: %pR\n", pr, pr);
pr,
(unsigned long long)pr->start,
(unsigned long long)pr->end,
(unsigned int)pr->flags);
/* We'll assign a new address later */ /* We'll assign a new address later */
r->flags |= IORESOURCE_UNSET; r->flags |= IORESOURCE_UNSET;
r->end -= r->start; r->end -= r->start;
...@@ -1431,12 +1405,8 @@ void pcibios_claim_one_bus(struct pci_bus *bus) ...@@ -1431,12 +1405,8 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
if (r->parent || !r->start || !r->flags) if (r->parent || !r->start || !r->flags)
continue; continue;
pr_debug("PCI: Claiming %s: " pr_debug("PCI: Claiming %s: Resource %d: %pR\n",
"Resource %d: %016llx..%016llx [%x]\n", pci_name(dev), i, r);
pci_name(dev), i,
(unsigned long long)r->start,
(unsigned long long)r->end,
(unsigned int)r->flags);
if (pci_claim_resource(dev, i) == 0) if (pci_claim_resource(dev, i) == 0)
continue; continue;
...@@ -1520,11 +1490,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, ...@@ -1520,11 +1490,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
} else { } else {
offset = pcibios_io_space_offset(hose); offset = pcibios_io_space_offset(hose);
pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n", pr_debug("PCI: PHB IO resource = %pR off 0x%08llx\n",
(unsigned long long)res->start, res, (unsigned long long)offset);
(unsigned long long)res->end,
(unsigned long)res->flags,
(unsigned long long)offset);
pci_add_resource_offset(resources, res, offset); pci_add_resource_offset(resources, res, offset);
} }
...@@ -1541,11 +1508,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, ...@@ -1541,11 +1508,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
offset = hose->mem_offset[i]; offset = hose->mem_offset[i];
pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i, pr_debug("PCI: PHB MEM resource %d = %pR off 0x%08llx\n", i,
(unsigned long long)res->start, res, (unsigned long long)offset);
(unsigned long long)res->end,
(unsigned long)res->flags,
(unsigned long long)offset);
pci_add_resource_offset(resources, res, offset); pci_add_resource_offset(resources, res, offset);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment