Commit 12c0b20f authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Jesse Barnes

x86/PCI: use dev_printk when possible

Convert printks to use dev_printk().

I converted DBG() to dev_dbg().  This DBG() is from arch/x86/pci/pci.h and
requires source-code modification to enable, so dev_dbg() seems roughly
equivalent.
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 756f7bc6
...@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d) ...@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
pci_read_config_byte(d, reg++, &busno); pci_read_config_byte(d, reg++, &busno);
pci_read_config_byte(d, reg++, &suba); pci_read_config_byte(d, reg++, &suba);
pci_read_config_byte(d, reg++, &subb); pci_read_config_byte(d, reg++, &subb);
DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
suba, subb);
if (busno) if (busno)
pci_scan_bus_with_sysdata(busno); /* Bus A */ pci_scan_bus_with_sysdata(busno); /* Bus A */
if (suba < subb) if (suba < subb)
......
...@@ -128,10 +128,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) ...@@ -128,10 +128,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
pr = pci_find_parent_resource(dev, r); pr = pci_find_parent_resource(dev, r);
if (!r->start || !pr || if (!r->start || !pr ||
request_resource(pr, r) < 0) { request_resource(pr, r) < 0) {
printk(KERN_ERR "PCI: Cannot allocate " dev_err(&dev->dev, "BAR %d: can't "
"resource region %d " "allocate resource\n", idx);
"of bridge %s\n",
idx, pci_name(dev));
/* /*
* Something is wrong with the region. * Something is wrong with the region.
* Invalidate the resource to prevent * Invalidate the resource to prevent
...@@ -166,15 +164,15 @@ static void __init pcibios_allocate_resources(int pass) ...@@ -166,15 +164,15 @@ static void __init pcibios_allocate_resources(int pass)
else else
disabled = !(command & PCI_COMMAND_MEMORY); disabled = !(command & PCI_COMMAND_MEMORY);
if (pass == disabled) { if (pass == disabled) {
DBG("PCI: Resource %08lx-%08lx " dev_dbg(&dev->dev, "resource %#08llx-%#08llx "
"(f=%lx, d=%d, p=%d)\n", "(f=%lx, d=%d, p=%d)\n",
r->start, r->end, r->flags, disabled, pass); (unsigned long long) r->start,
(unsigned long long) r->end,
r->flags, disabled, pass);
pr = pci_find_parent_resource(dev, r); pr = pci_find_parent_resource(dev, r);
if (!pr || request_resource(pr, r) < 0) { if (!pr || request_resource(pr, r) < 0) {
printk(KERN_ERR "PCI: Cannot allocate " dev_err(&dev->dev, "BAR %d: can't "
"resource region %d " "allocate resource\n", idx);
"of device %s\n",
idx, pci_name(dev));
/* We'll assign a new address later */ /* We'll assign a new address later */
r->end -= r->start; r->end -= r->start;
r->start = 0; r->start = 0;
...@@ -187,8 +185,7 @@ static void __init pcibios_allocate_resources(int pass) ...@@ -187,8 +185,7 @@ static void __init pcibios_allocate_resources(int pass)
/* Turn the ROM off, leave the resource region, /* Turn the ROM off, leave the resource region,
* but keep it unregistered. */ * but keep it unregistered. */
u32 reg; u32 reg;
DBG("PCI: Switching off ROM of %s\n", dev_dbg(&dev->dev, "disabling ROM\n");
pci_name(dev));
r->flags &= ~IORESOURCE_ROM_ENABLE; r->flags &= ~IORESOURCE_ROM_ENABLE;
pci_read_config_dword(dev, pci_read_config_dword(dev,
dev->rom_base_reg, &reg); dev->rom_base_reg, &reg);
...@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *dev) ...@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *dev)
lat = pcibios_max_latency; lat = pcibios_max_latency;
else else
return; return;
printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
pci_name(dev), lat);
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
} }
......
...@@ -436,7 +436,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) ...@@ -436,7 +436,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ {
WARN_ON_ONCE(pirq >= 9); WARN_ON_ONCE(pirq >= 9);
if (pirq > 8) { if (pirq > 8) {
printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
return 0; return 0;
} }
return read_config_nybble(router, 0x74, pirq-1); return read_config_nybble(router, 0x74, pirq-1);
...@@ -446,7 +446,7 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, ...@@ -446,7 +446,7 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
{ {
WARN_ON_ONCE(pirq >= 9); WARN_ON_ONCE(pirq >= 9);
if (pirq > 8) { if (pirq > 8) {
printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
return 0; return 0;
} }
write_config_nybble(router, 0x74, pirq-1, irq); write_config_nybble(router, 0x74, pirq-1, irq);
...@@ -492,14 +492,16 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq ...@@ -492,14 +492,16 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq
irq = 0; irq = 0;
if (pirq <= 4) if (pirq <= 4)
irq = read_config_nybble(router, 0x56, pirq - 1); irq = read_config_nybble(router, 0x56, pirq - 1);
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", dev_info(&dev->dev,
"AMD756: dev [%04x/%04x], router PIRQ %d get IRQ %d\n",
dev->vendor, dev->device, pirq, irq); dev->vendor, dev->device, pirq, irq);
return irq; return irq;
} }
static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{ {
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", dev_info(&dev->dev,
"AMD756: dev [%04x/%04x], router PIRQ %d set IRQ %d\n",
dev->vendor, dev->device, pirq, irq); dev->vendor, dev->device, pirq, irq);
if (pirq <= 4) if (pirq <= 4)
write_config_nybble(router, 0x56, pirq - 1, irq); write_config_nybble(router, 0x56, pirq - 1, irq);
...@@ -730,7 +732,6 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, ...@@ -730,7 +732,6 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
switch (device) { switch (device) {
case PCI_DEVICE_ID_AL_M1533: case PCI_DEVICE_ID_AL_M1533:
case PCI_DEVICE_ID_AL_M1563: case PCI_DEVICE_ID_AL_M1563:
printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
r->name = "ALI"; r->name = "ALI";
r->get = pirq_ali_get; r->get = pirq_ali_get;
r->set = pirq_ali_set; r->set = pirq_ali_set;
...@@ -840,11 +841,9 @@ static void __init pirq_find_router(struct irq_router *r) ...@@ -840,11 +841,9 @@ static void __init pirq_find_router(struct irq_router *r)
h->probe(r, pirq_router_dev, pirq_router_dev->device)) h->probe(r, pirq_router_dev, pirq_router_dev->device))
break; break;
} }
printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n", dev_info(&pirq_router_dev->dev, "%s IRQ router [%04x/%04x]\n",
pirq_router.name, pirq_router.name,
pirq_router_dev->vendor, pirq_router_dev->vendor, pirq_router_dev->device);
pirq_router_dev->device,
pci_name(pirq_router_dev));
/* The device remains referenced for the kernel lifetime */ /* The device remains referenced for the kernel lifetime */
} }
...@@ -877,7 +876,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -877,7 +876,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
/* Find IRQ pin */ /* Find IRQ pin */
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (!pin) { if (!pin) {
DBG(KERN_DEBUG " -> no interrupt pin\n"); dev_dbg(&dev->dev, "no interrupt pin\n");
return 0; return 0;
} }
pin = pin - 1; pin = pin - 1;
...@@ -887,20 +886,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -887,20 +886,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
if (!pirq_table) if (!pirq_table)
return 0; return 0;
DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
info = pirq_get_info(dev); info = pirq_get_info(dev);
if (!info) { if (!info) {
DBG(" -> not found in routing table\n" KERN_DEBUG); dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n",
'A' + pin);
return 0; return 0;
} }
pirq = info->irq[pin].link; pirq = info->irq[pin].link;
mask = info->irq[pin].bitmap; mask = info->irq[pin].bitmap;
if (!pirq) { if (!pirq) {
DBG(" -> not routed\n" KERN_DEBUG); dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin);
return 0; return 0;
} }
DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x",
pirq_table->exclusive_irqs); 'A' + pin, pirq, mask, pirq_table->exclusive_irqs);
mask &= pcibios_irq_mask; mask &= pcibios_irq_mask;
/* Work around broken HP Pavilion Notebooks which assign USB to /* Work around broken HP Pavilion Notebooks which assign USB to
...@@ -930,10 +929,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -930,10 +929,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
if (pci_probe & PCI_USE_PIRQ_MASK) if (pci_probe & PCI_USE_PIRQ_MASK)
newirq = 0; newirq = 0;
else else
printk("\n" KERN_WARNING dev_warn(&dev->dev, "IRQ %d doesn't match PIRQ mask "
"PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n" "%#x; try pci=usepirqmask\n", newirq, mask);
KERN_DEBUG, newirq,
pci_name(dev));
} }
if (!newirq && assign) { if (!newirq && assign) {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
...@@ -944,39 +941,35 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -944,39 +941,35 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
newirq = i; newirq = i;
} }
} }
DBG(" -> newirq=%d", newirq); dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin, newirq);
/* Check if it is hardcoded */ /* Check if it is hardcoded */
if ((pirq & 0xf0) == 0xf0) { if ((pirq & 0xf0) == 0xf0) {
irq = pirq & 0xf; irq = pirq & 0xf;
DBG(" -> hardcoded IRQ %d\n", irq); msg = "hardcoded";
msg = "Hardcoded";
} else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) { ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) {
DBG(" -> got IRQ %d\n", irq); msg = "found";
msg = "Found";
eisa_set_level_irq(irq); eisa_set_level_irq(irq);
} else if (newirq && r->set && } else if (newirq && r->set &&
(dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
DBG(" -> assigning IRQ %d", newirq);
if (r->set(pirq_router_dev, dev, pirq, newirq)) { if (r->set(pirq_router_dev, dev, pirq, newirq)) {
eisa_set_level_irq(newirq); eisa_set_level_irq(newirq);
DBG(" ... OK\n"); msg = "assigned";
msg = "Assigned";
irq = newirq; irq = newirq;
} }
} }
if (!irq) { if (!irq) {
DBG(" ... failed\n");
if (newirq && mask == (1 << newirq)) { if (newirq && mask == (1 << newirq)) {
msg = "Guessed"; msg = "guessed";
irq = newirq; irq = newirq;
} else } else {
dev_dbg(&dev->dev, "can't route interrupt\n");
return 0; return 0;
} }
printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, }
pci_name(dev)); dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin, irq);
/* Update IRQ for all devices with the same pirq value */ /* Update IRQ for all devices with the same pirq value */
while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
...@@ -996,16 +989,16 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) ...@@ -996,16 +989,16 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
(!(pci_probe & PCI_USE_PIRQ_MASK) || \ (!(pci_probe & PCI_USE_PIRQ_MASK) || \
((1 << dev2->irq) & mask))) { ((1 << dev2->irq) & mask))) {
#ifndef CONFIG_PCI_MSI #ifndef CONFIG_PCI_MSI
printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", dev_info(&dev2->dev, "IRQ routing conflict: "
pci_name(dev2), dev2->irq, irq); "have IRQ %d, want IRQ %d\n",
dev2->irq, irq);
#endif #endif
continue; continue;
} }
dev2->irq = irq; dev2->irq = irq;
pirq_penalty[irq]++; pirq_penalty[irq]++;
if (dev != dev2) if (dev != dev2)
printk(KERN_INFO dev_info(&dev->dev, "sharing IRQ %d with %s\n",
"PCI: Sharing IRQ %d with %s\n",
irq, pci_name(dev2)); irq, pci_name(dev2));
} }
} }
...@@ -1025,8 +1018,7 @@ static void __init pcibios_fixup_irqs(void) ...@@ -1025,8 +1018,7 @@ static void __init pcibios_fixup_irqs(void)
* already in use. * already in use.
*/ */
if (dev->irq >= 16) { if (dev->irq >= 16) {
DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", dev_dbg(&dev->dev, "ignoring bogus IRQ %d\n", dev->irq);
pci_name(dev), dev->irq);
dev->irq = 0; dev->irq = 0;
} }
/* /*
...@@ -1070,12 +1062,12 @@ static void __init pcibios_fixup_irqs(void) ...@@ -1070,12 +1062,12 @@ static void __init pcibios_fixup_irqs(void)
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
PCI_SLOT(bridge->devfn), pin); PCI_SLOT(bridge->devfn), pin);
if (irq >= 0) if (irq >= 0)
printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n",
pci_name(bridge), 'A' + pin, irq); pci_name(bridge),
'A' + pin, irq);
} }
if (irq >= 0) { if (irq >= 0) {
printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq);
pci_name(dev), 'A' + pin, irq);
dev->irq = irq; dev->irq = irq;
} }
} }
...@@ -1231,25 +1223,24 @@ static int pirq_enable_irq(struct pci_dev *dev) ...@@ -1231,25 +1223,24 @@ static int pirq_enable_irq(struct pci_dev *dev)
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
PCI_SLOT(bridge->devfn), pin); PCI_SLOT(bridge->devfn), pin);
if (irq >= 0) if (irq >= 0)
printk(KERN_WARNING dev_warn(&dev->dev, "using bridge %s "
"PCI: using PPB %s[%c] to get irq %d\n", "INT %c to get IRQ %d\n",
pci_name(bridge), pci_name(bridge), 'A' + pin,
'A' + pin, irq); irq);
dev = bridge; dev = bridge;
} }
dev = temp_dev; dev = temp_dev;
if (irq >= 0) { if (irq >= 0) {
printk(KERN_INFO dev_info(&dev->dev, "PCI->APIC IRQ transform: "
"PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", "INT %c -> IRQ %d\n", 'A' + pin, irq);
pci_name(dev), 'A' + pin, irq);
dev->irq = irq; dev->irq = irq;
return 0; return 0;
} else } else
msg = " Probably buggy MP table."; msg = "; probably buggy MP table";
} else if (pci_probe & PCI_BIOS_IRQ_SCAN) } else if (pci_probe & PCI_BIOS_IRQ_SCAN)
msg = ""; msg = "";
else else
msg = " Please try using pci=biosirq."; msg = "; please try using pci=biosirq";
/* /*
* With IDE legacy devices the IRQ lookup failure is not * With IDE legacy devices the IRQ lookup failure is not
...@@ -1259,9 +1250,8 @@ static int pirq_enable_irq(struct pci_dev *dev) ...@@ -1259,9 +1250,8 @@ static int pirq_enable_irq(struct pci_dev *dev)
!(dev->class & 0x5)) !(dev->class & 0x5))
return 0; return 0;
printk(KERN_WARNING dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n",
"PCI: No IRQ known for interrupt pin %c of device %s.%s\n", 'A' + pin, msg);
'A' + pin, pci_name(dev), msg);
} }
return 0; return 0;
} }
...@@ -131,13 +131,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d) ...@@ -131,13 +131,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
u8 busno, suba, subb; u8 busno, suba, subb;
int quad = BUS2QUAD(d->bus->number); int quad = BUS2QUAD(d->bus->number);
printk("PCI: Searching for i450NX host bridges on %s\n", pci_name(d)); dev_info(&d->dev, "searching for i450NX host bridges\n");
reg = 0xd0; reg = 0xd0;
for(pxb=0; pxb<2; pxb++) { for(pxb=0; pxb<2; pxb++) {
pci_read_config_byte(d, reg++, &busno); pci_read_config_byte(d, reg++, &busno);
pci_read_config_byte(d, reg++, &suba); pci_read_config_byte(d, reg++, &suba);
pci_read_config_byte(d, reg++, &subb); pci_read_config_byte(d, reg++, &subb);
DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n",
pxb, busno, suba, subb);
if (busno) { if (busno) {
/* Bus A */ /* Bus A */
pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));
......
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