Commit 80ccba11 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Jesse Barnes

PCI: use dev_printk when possible

Convert printks to use dev_printk().

I converted pr_debug() to dev_dbg().  Both use KERN_DEBUG and are enabled
only when DEBUG is defined.

I converted printk(KERN_DEBUG) to dev_printk(KERN_DEBUG), not to dev_dbg(),
because dev_dbg() is only enabled when DEBUG is defined.

I converted DBG(KERN_INFO) (only in setup-bus.c) to dev_info().  The DBG()
name makes it sound like debug, but it's been enabled forever, so dev_info()
preserves the previous behavior.

I tried to make the resource assignment formats more consistent, e.g.,
  "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] flags %#lx\n"
instead of sometimes using "start-end" and sometimes using "size@start".
I'm not attached to one or the other; I'd just like them consistent.
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent b86ec7ed
...@@ -565,9 +565,8 @@ int pci_enable_msi(struct pci_dev* dev) ...@@ -565,9 +565,8 @@ int pci_enable_msi(struct pci_dev* dev)
/* Check whether driver already requested for MSI-X irqs */ /* Check whether driver already requested for MSI-X irqs */
if (dev->msix_enabled) { if (dev->msix_enabled) {
printk(KERN_INFO "PCI: %s: Can't enable MSI. " dev_info(&dev->dev, "can't enable MSI "
"Device already has MSI-X enabled\n", "(MSI-X already enabled)\n");
pci_name(dev));
return -EINVAL; return -EINVAL;
} }
status = msi_capability_init(dev); status = msi_capability_init(dev);
...@@ -690,9 +689,8 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) ...@@ -690,9 +689,8 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
/* Check whether driver already requested for MSI irq */ /* Check whether driver already requested for MSI irq */
if (dev->msi_enabled) { if (dev->msi_enabled) {
printk(KERN_INFO "PCI: %s: Can't enable MSI-X. " dev_info(&dev->dev, "can't enable MSI-X "
"Device already has an MSI irq assigned\n", "(MSI IRQ already assigned)\n");
pci_name(dev));
return -EINVAL; return -EINVAL;
} }
status = msix_capability_init(dev, entries, nvec); status = msix_capability_init(dev, entries, nvec);
......
...@@ -422,8 +422,8 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -422,8 +422,8 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
* to sleep if we're already in a low power state * to sleep if we're already in a low power state
*/ */
if (state != PCI_D0 && dev->current_state > state) { if (state != PCI_D0 && dev->current_state > state) {
printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n", dev_err(&dev->dev, "invalid power transition "
__func__, pci_name(dev), state, dev->current_state); "(from state %d to %d)\n", dev->current_state, state);
return -EINVAL; return -EINVAL;
} else if (dev->current_state == state) } else if (dev->current_state == state)
return 0; /* we're already there */ return 0; /* we're already there */
...@@ -431,9 +431,8 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -431,9 +431,8 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc); pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
printk(KERN_DEBUG dev_printk(KERN_DEBUG, &dev->dev, "unsupported PM cap regs "
"PCI: %s has unsupported PM cap regs version (%u)\n", "version (%u)\n", pmc & PCI_PM_CAP_VER_MASK);
pci_name(dev), pmc & PCI_PM_CAP_VER_MASK);
return -EIO; return -EIO;
} }
...@@ -541,7 +540,8 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) ...@@ -541,7 +540,8 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
case PM_EVENT_HIBERNATE: case PM_EVENT_HIBERNATE:
return PCI_D3hot; return PCI_D3hot;
default: default:
printk("Unrecognized suspend event %d\n", state.event); dev_info(&dev->dev, "unrecognized suspend event %d\n",
state.event);
BUG(); BUG();
} }
return PCI_D0; return PCI_D0;
...@@ -566,7 +566,7 @@ static int pci_save_pcie_state(struct pci_dev *dev) ...@@ -566,7 +566,7 @@ static int pci_save_pcie_state(struct pci_dev *dev)
else else
found = 1; found = 1;
if (!save_state) { if (!save_state) {
dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
return -ENOMEM; return -ENOMEM;
} }
cap = (u16 *)&save_state->data[0]; cap = (u16 *)&save_state->data[0];
...@@ -617,7 +617,7 @@ static int pci_save_pcix_state(struct pci_dev *dev) ...@@ -617,7 +617,7 @@ static int pci_save_pcix_state(struct pci_dev *dev)
else else
found = 1; found = 1;
if (!save_state) { if (!save_state) {
dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
return -ENOMEM; return -ENOMEM;
} }
cap = (u16 *)&save_state->data[0]; cap = (u16 *)&save_state->data[0];
...@@ -683,10 +683,9 @@ pci_restore_state(struct pci_dev *dev) ...@@ -683,10 +683,9 @@ pci_restore_state(struct pci_dev *dev)
for (i = 15; i >= 0; i--) { for (i = 15; i >= 0; i--) {
pci_read_config_dword(dev, i * 4, &val); pci_read_config_dword(dev, i * 4, &val);
if (val != dev->saved_config_space[i]) { if (val != dev->saved_config_space[i]) {
printk(KERN_DEBUG "PM: Writing back config space on " dev_printk(KERN_DEBUG, &dev->dev, "restoring config "
"device %s at offset %x (was %x, writing %x)\n", "space at offset %#x (was %#x, writing %#x)\n",
pci_name(dev), i, i, val, (int)dev->saved_config_space[i]);
val, (int)dev->saved_config_space[i]);
pci_write_config_dword(dev,i * 4, pci_write_config_dword(dev,i * 4,
dev->saved_config_space[i]); dev->saved_config_space[i]);
} }
...@@ -1114,13 +1113,11 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) ...@@ -1114,13 +1113,11 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
return 0; return 0;
err_out: err_out:
printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%llx@%llx " dev_warn(&pdev->dev, "BAR %d: can't reserve %s region [%#llx-%#llx]\n",
"for device %s\n",
pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
bar + 1, /* PCI BAR # */ bar + 1, /* PCI BAR # */
(unsigned long long)pci_resource_len(pdev, bar), pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
(unsigned long long)pci_resource_start(pdev, bar), (unsigned long long)pci_resource_start(pdev, bar),
pci_name(pdev)); (unsigned long long)pci_resource_end(pdev, bar));
return -EBUSY; return -EBUSY;
} }
...@@ -1212,7 +1209,7 @@ pci_set_master(struct pci_dev *dev) ...@@ -1212,7 +1209,7 @@ pci_set_master(struct pci_dev *dev)
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (! (cmd & PCI_COMMAND_MASTER)) { if (! (cmd & PCI_COMMAND_MASTER)) {
pr_debug("PCI: Enabling bus mastering for device %s\n", pci_name(dev)); dev_dbg(&dev->dev, "enabling bus mastering\n");
cmd |= PCI_COMMAND_MASTER; cmd |= PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, cmd); pci_write_config_word(dev, PCI_COMMAND, cmd);
} }
...@@ -1277,8 +1274,8 @@ pci_set_cacheline_size(struct pci_dev *dev) ...@@ -1277,8 +1274,8 @@ pci_set_cacheline_size(struct pci_dev *dev)
if (cacheline_size == pci_cache_line_size) if (cacheline_size == pci_cache_line_size)
return 0; return 0;
printk(KERN_DEBUG "PCI: cache line size of %d is not supported " dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not "
"by device %s\n", pci_cache_line_size << 2, pci_name(dev)); "supported\n", pci_cache_line_size << 2);
return -EINVAL; return -EINVAL;
} }
...@@ -1303,8 +1300,7 @@ pci_set_mwi(struct pci_dev *dev) ...@@ -1303,8 +1300,7 @@ pci_set_mwi(struct pci_dev *dev)
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (! (cmd & PCI_COMMAND_INVALIDATE)) { if (! (cmd & PCI_COMMAND_INVALIDATE)) {
pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
pci_name(dev));
cmd |= PCI_COMMAND_INVALIDATE; cmd |= PCI_COMMAND_INVALIDATE;
pci_write_config_word(dev, PCI_COMMAND, cmd); pci_write_config_word(dev, PCI_COMMAND, cmd);
} }
......
...@@ -277,8 +277,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) ...@@ -277,8 +277,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
res->end = res->start + sz64; res->end = res->start + sz64;
#else #else
if (sz64 > 0x100000000ULL) { if (sz64 > 0x100000000ULL) {
printk(KERN_ERR "PCI: Unable to handle 64-bit " dev_err(&dev->dev, "BAR %d: can't handle 64-bit"
"BAR for device %s\n", pci_name(dev)); " BAR\n", pos);
res->start = 0; res->start = 0;
res->flags = 0; res->flags = 0;
} else if (lhi) { } else if (lhi) {
...@@ -329,7 +329,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) ...@@ -329,7 +329,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
return; return;
if (dev->transparent) { if (dev->transparent) {
printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev)); dev_info(&dev->dev, "transparent bridge\n");
for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
child->resource[i] = child->parent->resource[i - 3]; child->resource[i] = child->parent->resource[i - 3];
} }
...@@ -392,7 +392,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) ...@@ -392,7 +392,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
limit |= ((long) mem_limit_hi) << 32; limit |= ((long) mem_limit_hi) << 32;
#else #else
if (mem_base_hi || mem_limit_hi) { if (mem_base_hi || mem_limit_hi) {
printk(KERN_ERR "PCI: Unable to handle 64-bit address space for bridge %s\n", pci_name(dev)); dev_err(&dev->dev, "can't handle 64-bit "
"address space for bridge\n");
return; return;
} }
#endif #endif
...@@ -512,8 +513,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, ...@@ -512,8 +513,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
pr_debug("PCI: Scanning behind PCI bridge %s, config %06x, pass %d\n", dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n",
pci_name(dev), buses & 0xffffff, pass); buses & 0xffffff, pass);
/* Disable MasterAbortMode during probing to avoid reporting /* Disable MasterAbortMode during probing to avoid reporting
of bus errors (in some architectures) */ of bus errors (in some architectures) */
...@@ -536,8 +537,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, ...@@ -536,8 +537,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
* ignore it. This can happen with the i450NX chipset. * ignore it. This can happen with the i450NX chipset.
*/ */
if (pci_find_bus(pci_domain_nr(bus), busnr)) { if (pci_find_bus(pci_domain_nr(bus), busnr)) {
printk(KERN_INFO "PCI: Bus %04x:%02x already known\n", dev_info(&dev->dev, "bus %04x:%02x already known\n",
pci_domain_nr(bus), busnr); pci_domain_nr(bus), busnr);
goto out; goto out;
} }
...@@ -721,7 +722,7 @@ static int pci_setup_device(struct pci_dev * dev) ...@@ -721,7 +722,7 @@ static int pci_setup_device(struct pci_dev * dev)
dev->class = class; dev->class = class;
class >>= 8; class >>= 8;
pr_debug("PCI: Found %s [%04x/%04x] %06x %02x\n", pci_name(dev), dev_dbg(&dev->dev, "found [%04x/%04x] class %06x header type %02x\n",
dev->vendor, dev->device, class, dev->hdr_type); dev->vendor, dev->device, class, dev->hdr_type);
/* "Unknown power state" */ /* "Unknown power state" */
...@@ -789,13 +790,13 @@ static int pci_setup_device(struct pci_dev * dev) ...@@ -789,13 +790,13 @@ static int pci_setup_device(struct pci_dev * dev)
break; break;
default: /* unknown header */ default: /* unknown header */
printk(KERN_ERR "PCI: device %s has unknown header type %02x, ignoring.\n", dev_err(&dev->dev, "unknown header type %02x, "
pci_name(dev), dev->hdr_type); "ignoring device\n", dev->hdr_type);
return -1; return -1;
bad: bad:
printk(KERN_ERR "PCI: %s: class %x doesn't match header type %02x. Ignoring class.\n", dev_err(&dev->dev, "ignoring class %02x (doesn't match header "
pci_name(dev), class, dev->hdr_type); "type %02x)\n", class, dev->hdr_type);
dev->class = PCI_CLASS_NOT_DEFINED; dev->class = PCI_CLASS_NOT_DEFINED;
} }
...@@ -971,7 +972,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) ...@@ -971,7 +972,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
return NULL; return NULL;
/* Card hasn't responded in 60 seconds? Must be stuck. */ /* Card hasn't responded in 60 seconds? Must be stuck. */
if (delay > 60 * 1000) { if (delay > 60 * 1000) {
printk(KERN_WARNING "Device %04x:%02x:%02x.%d not " printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not "
"responding\n", pci_domain_nr(bus), "responding\n", pci_domain_nr(bus),
bus->number, PCI_SLOT(devfn), bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn)); PCI_FUNC(devfn));
......
...@@ -27,13 +27,6 @@ ...@@ -27,13 +27,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#define DEBUG_CONFIG 1
#if DEBUG_CONFIG
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
static void pbus_assign_resources_sorted(struct pci_bus *bus) static void pbus_assign_resources_sorted(struct pci_bus *bus)
{ {
struct pci_dev *dev; struct pci_dev *dev;
...@@ -81,8 +74,8 @@ void pci_setup_cardbus(struct pci_bus *bus) ...@@ -81,8 +74,8 @@ void pci_setup_cardbus(struct pci_bus *bus)
struct pci_dev *bridge = bus->self; struct pci_dev *bridge = bus->self;
struct pci_bus_region region; struct pci_bus_region region;
printk("PCI: Bus %d, cardbus bridge: %s\n", dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n",
bus->number, pci_name(bridge)); pci_domain_nr(bus), bus->number);
pcibios_resource_to_bus(bridge, &region, bus->resource[0]); pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
if (bus->resource[0]->flags & IORESOURCE_IO) { if (bus->resource[0]->flags & IORESOURCE_IO) {
...@@ -90,7 +83,7 @@ void pci_setup_cardbus(struct pci_bus *bus) ...@@ -90,7 +83,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
* The IO resource is allocated a range twice as large as it * The IO resource is allocated a range twice as large as it
* would normally need. This allows us to set both IO regs. * would normally need. This allows us to set both IO regs.
*/ */
printk(KERN_INFO " IO window: 0x%08lx-0x%08lx\n", dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
...@@ -101,7 +94,7 @@ void pci_setup_cardbus(struct pci_bus *bus) ...@@ -101,7 +94,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
pcibios_resource_to_bus(bridge, &region, bus->resource[1]); pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
if (bus->resource[1]->flags & IORESOURCE_IO) { if (bus->resource[1]->flags & IORESOURCE_IO) {
printk(KERN_INFO " IO window: 0x%08lx-0x%08lx\n", dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
...@@ -112,7 +105,7 @@ void pci_setup_cardbus(struct pci_bus *bus) ...@@ -112,7 +105,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
pcibios_resource_to_bus(bridge, &region, bus->resource[2]); pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
if (bus->resource[2]->flags & IORESOURCE_MEM) { if (bus->resource[2]->flags & IORESOURCE_MEM) {
printk(KERN_INFO " PREFETCH window: 0x%08lx-0x%08lx\n", dev_info(&bridge->dev, " PREFETCH window: %#08lx-%#08lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
...@@ -123,7 +116,7 @@ void pci_setup_cardbus(struct pci_bus *bus) ...@@ -123,7 +116,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
pcibios_resource_to_bus(bridge, &region, bus->resource[3]); pcibios_resource_to_bus(bridge, &region, bus->resource[3]);
if (bus->resource[3]->flags & IORESOURCE_MEM) { if (bus->resource[3]->flags & IORESOURCE_MEM) {
printk(KERN_INFO " MEM window: 0x%08lx-0x%08lx\n", dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
...@@ -151,7 +144,8 @@ static void pci_setup_bridge(struct pci_bus *bus) ...@@ -151,7 +144,8 @@ static void pci_setup_bridge(struct pci_bus *bus)
struct pci_bus_region region; struct pci_bus_region region;
u32 l, bu, lu, io_upper16; u32 l, bu, lu, io_upper16;
DBG(KERN_INFO "PCI: Bridge: %s\n", pci_name(bridge)); dev_info(&bridge->dev, "PCI bridge, secondary bus %04x:%02x\n",
pci_domain_nr(bus), bus->number);
/* Set up the top and bottom of the PCI I/O segment for this bus. */ /* Set up the top and bottom of the PCI I/O segment for this bus. */
pcibios_resource_to_bus(bridge, &region, bus->resource[0]); pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
...@@ -162,7 +156,7 @@ static void pci_setup_bridge(struct pci_bus *bus) ...@@ -162,7 +156,7 @@ static void pci_setup_bridge(struct pci_bus *bus)
l |= region.end & 0xf000; l |= region.end & 0xf000;
/* Set up upper 16 bits of I/O base/limit. */ /* Set up upper 16 bits of I/O base/limit. */
io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); io_upper16 = (region.end & 0xffff0000) | (region.start >> 16);
DBG(KERN_INFO " IO window: %04lx-%04lx\n", dev_info(&bridge->dev, " IO window: %#04lx-%#04lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
} }
...@@ -170,7 +164,7 @@ static void pci_setup_bridge(struct pci_bus *bus) ...@@ -170,7 +164,7 @@ static void pci_setup_bridge(struct pci_bus *bus)
/* Clear upper 16 bits of I/O base/limit. */ /* Clear upper 16 bits of I/O base/limit. */
io_upper16 = 0; io_upper16 = 0;
l = 0x00f0; l = 0x00f0;
DBG(KERN_INFO " IO window: disabled.\n"); dev_info(&bridge->dev, " IO window: disabled\n");
} }
/* Temporarily disable the I/O range before updating PCI_IO_BASE. */ /* Temporarily disable the I/O range before updating PCI_IO_BASE. */
pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff); pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff);
...@@ -185,13 +179,13 @@ static void pci_setup_bridge(struct pci_bus *bus) ...@@ -185,13 +179,13 @@ static void pci_setup_bridge(struct pci_bus *bus)
if (bus->resource[1]->flags & IORESOURCE_MEM) { if (bus->resource[1]->flags & IORESOURCE_MEM) {
l = (region.start >> 16) & 0xfff0; l = (region.start >> 16) & 0xfff0;
l |= region.end & 0xfff00000; l |= region.end & 0xfff00000;
DBG(KERN_INFO " MEM window: 0x%08lx-0x%08lx\n", dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n",
(unsigned long)region.start, (unsigned long)region.start,
(unsigned long)region.end); (unsigned long)region.end);
} }
else { else {
l = 0x0000fff0; l = 0x0000fff0;
DBG(KERN_INFO " MEM window: disabled.\n"); dev_info(&bridge->dev, " MEM window: disabled\n");
} }
pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
...@@ -208,13 +202,13 @@ static void pci_setup_bridge(struct pci_bus *bus) ...@@ -208,13 +202,13 @@ static void pci_setup_bridge(struct pci_bus *bus)
l |= region.end & 0xfff00000; l |= region.end & 0xfff00000;
bu = upper_32_bits(region.start); bu = upper_32_bits(region.start);
lu = upper_32_bits(region.end); lu = upper_32_bits(region.end);
DBG(KERN_INFO " PREFETCH window: 0x%016llx-0x%016llx\n", dev_info(&bridge->dev, " PREFETCH window: %#016llx-%#016llx\n",
(unsigned long long)region.start, (unsigned long long)region.start,
(unsigned long long)region.end); (unsigned long long)region.end);
} }
else { else {
l = 0x0000fff0; l = 0x0000fff0;
DBG(KERN_INFO " PREFETCH window: disabled.\n"); dev_info(&bridge->dev, " PREFETCH window: disabled\n");
} }
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l); pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
...@@ -361,9 +355,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long ...@@ -361,9 +355,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long
align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start; align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start;
order = __ffs(align) - 20; order = __ffs(align) - 20;
if (order > 11) { if (order > 11) {
printk(KERN_WARNING "PCI: region %s/%d " dev_warn(&dev->dev, "BAR %d too large: "
"too large: 0x%016llx-0x%016llx\n", "%#016llx-%#016llx\n", i,
pci_name(dev), i,
(unsigned long long)r->start, (unsigned long long)r->start,
(unsigned long long)r->end); (unsigned long long)r->end);
r->flags = 0; r->flags = 0;
...@@ -529,8 +522,8 @@ void __ref pci_bus_assign_resources(struct pci_bus *bus) ...@@ -529,8 +522,8 @@ void __ref pci_bus_assign_resources(struct pci_bus *bus)
break; break;
default: default:
printk(KERN_INFO "PCI: not setting up bridge %s " dev_info(&dev->dev, "not setting up bridge for bus "
"for bus %d\n", pci_name(dev), b->number); "%04x:%02x\n", pci_domain_nr(b), b->number);
break; break;
} }
} }
......
...@@ -47,8 +47,7 @@ pdev_fixup_irq(struct pci_dev *dev, ...@@ -47,8 +47,7 @@ pdev_fixup_irq(struct pci_dev *dev,
} }
dev->irq = irq; dev->irq = irq;
pr_debug("PCI: fixup irq: (%s) got %d\n", dev_dbg(&dev->dev, "fixup irq: got %d\n", dev->irq);
kobject_name(&dev->dev.kobj), dev->irq);
/* Always tell the device, so the driver knows what is /* Always tell the device, so the driver knows what is
the real IRQ to use; the device does not use it. */ the real IRQ to use; the device does not use it. */
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
#include "pci.h" #include "pci.h"
void void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
{ {
struct pci_bus_region region; struct pci_bus_region region;
u32 new, check, mask; u32 new, check, mask;
...@@ -43,20 +42,20 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) ...@@ -43,20 +42,20 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
/* /*
* Ignore non-moveable resources. This might be legacy resources for * Ignore non-moveable resources. This might be legacy resources for
* which no functional BAR register exists or another important * which no functional BAR register exists or another important
* system resource we should better not move around in system address * system resource we shouldn't move around.
* space.
*/ */
if (res->flags & IORESOURCE_PCI_FIXED) if (res->flags & IORESOURCE_PCI_FIXED)
return; return;
pcibios_resource_to_bus(dev, &region, res); pcibios_resource_to_bus(dev, &region, res);
pr_debug(" got res [%llx:%llx] bus [%llx:%llx] flags %lx for " dev_dbg(&dev->dev, "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] "
"BAR %d of %s\n", (unsigned long long)res->start, "flags %#lx\n", resno,
(unsigned long long)res->start,
(unsigned long long)res->end, (unsigned long long)res->end,
(unsigned long long)region.start, (unsigned long long)region.start,
(unsigned long long)region.end, (unsigned long long)region.end,
(unsigned long)res->flags, resno, pci_name(dev)); (unsigned long)res->flags);
new = region.start | (res->flags & PCI_REGION_FLAG_MASK); new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
if (res->flags & IORESOURCE_IO) if (res->flags & IORESOURCE_IO)
...@@ -81,9 +80,8 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) ...@@ -81,9 +80,8 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
pci_read_config_dword(dev, reg, &check); pci_read_config_dword(dev, reg, &check);
if ((new ^ check) & mask) { if ((new ^ check) & mask) {
printk(KERN_ERR "PCI: Error while updating region " dev_err(&dev->dev, "BAR %d: error updating (%#08x != %#08x)\n",
"%s/%d (%08x != %08x)\n", pci_name(dev), resno, resno, new, check);
new, check);
} }
if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
...@@ -92,15 +90,14 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) ...@@ -92,15 +90,14 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
pci_write_config_dword(dev, reg + 4, new); pci_write_config_dword(dev, reg + 4, new);
pci_read_config_dword(dev, reg + 4, &check); pci_read_config_dword(dev, reg + 4, &check);
if (check != new) { if (check != new) {
printk(KERN_ERR "PCI: Error updating region " dev_err(&dev->dev, "BAR %d: error updating "
"%s/%d (high %08x != %08x)\n", "(high %#08x != %#08x)\n", resno, new, check);
pci_name(dev), resno, new, check);
} }
} }
res->flags &= ~IORESOURCE_UNSET; res->flags &= ~IORESOURCE_UNSET;
pr_debug("PCI: moved device %s resource %d (%lx) to %x\n", dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n",
pci_name(dev), resno, res->flags, resno, (unsigned long long)region.start,
new & ~PCI_REGION_FLAG_MASK); (unsigned long long)region.end, res->flags);
} }
int pci_claim_resource(struct pci_dev *dev, int resource) int pci_claim_resource(struct pci_dev *dev, int resource)
...@@ -117,10 +114,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource) ...@@ -117,10 +114,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
err = insert_resource(root, res); err = insert_resource(root, res);
if (err) { if (err) {
printk(KERN_ERR "PCI: %s region %d of %s %s [%llx:%llx]\n", dev_err(&dev->dev, "BAR %d: %s of %s [%#llx-%#llx]\n",
root ? "Address space collision on" : resource,
"No parent found for", root ? "address space collision on" :
resource, dtype, pci_name(dev), "no parent found for",
dtype,
(unsigned long long)res->start, (unsigned long long)res->start,
(unsigned long long)res->end); (unsigned long long)res->end);
} }
...@@ -140,11 +138,10 @@ int pci_assign_resource(struct pci_dev *dev, int resno) ...@@ -140,11 +138,10 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
align = resource_alignment(res); align = resource_alignment(res);
if (!align) { if (!align) {
printk(KERN_ERR "PCI: Cannot allocate resource (bogus " dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus "
"alignment) %d [%llx:%llx] (flags %lx) of %s\n", "alignment) [%#llx-%#llx] flags %#lx\n",
resno, (unsigned long long)res->start, resno, (unsigned long long)res->start,
(unsigned long long)res->end, res->flags, (unsigned long long)res->end, res->flags);
pci_name(dev));
return -EINVAL; return -EINVAL;
} }
...@@ -165,11 +162,11 @@ int pci_assign_resource(struct pci_dev *dev, int resno) ...@@ -165,11 +162,11 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
} }
if (ret) { if (ret) {
printk(KERN_ERR "PCI: Failed to allocate %s resource " dev_err(&dev->dev, "BAR %d: can't allocate %s resource "
"#%d:%llx@%llx for %s\n", "[%#llx-%#llx]\n", resno,
res->flags & IORESOURCE_IO ? "I/O" : "mem", res->flags & IORESOURCE_IO ? "I/O" : "mem",
resno, (unsigned long long)size, (unsigned long long)res->start,
(unsigned long long)res->start, pci_name(dev)); (unsigned long long)res->end);
} else { } else {
res->flags &= ~IORESOURCE_STARTALIGN; res->flags &= ~IORESOURCE_STARTALIGN;
if (resno < PCI_BRIDGE_RESOURCES) if (resno < PCI_BRIDGE_RESOURCES)
...@@ -205,11 +202,11 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno) ...@@ -205,11 +202,11 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
} }
if (ret) { if (ret) {
printk(KERN_ERR "PCI: Failed to allocate %s resource " dev_err(&dev->dev, "BAR %d: can't allocate %s resource "
"#%d:%llx@%llx for %s\n", "[%#llx-%#llx\n]", resno,
res->flags & IORESOURCE_IO ? "I/O" : "mem", res->flags & IORESOURCE_IO ? "I/O" : "mem",
resno, (unsigned long long)(res->end - res->start + 1), (unsigned long long)res->start,
(unsigned long long)res->start, pci_name(dev)); (unsigned long long)res->end);
} else if (resno < PCI_BRIDGE_RESOURCES) { } else if (resno < PCI_BRIDGE_RESOURCES) {
pci_update_resource(dev, res, resno); pci_update_resource(dev, res, resno);
} }
...@@ -239,11 +236,10 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) ...@@ -239,11 +236,10 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
r_align = resource_alignment(r); r_align = resource_alignment(r);
if (!r_align) { if (!r_align) {
printk(KERN_WARNING "PCI: bogus alignment of resource " dev_warn(&dev->dev, "BAR %d: bogus alignment "
"%d [%llx:%llx] (flags %lx) of %s\n", "[%#llx-%#llx] flags %#lx\n",
i, (unsigned long long)r->start, i, (unsigned long long)r->start,
(unsigned long long)r->end, r->flags, (unsigned long long)r->end, r->flags);
pci_name(dev));
continue; continue;
} }
for (list = head; ; list = list->next) { for (list = head; ; list = list->next) {
...@@ -291,7 +287,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask) ...@@ -291,7 +287,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask)
if (!r->parent) { if (!r->parent) {
dev_err(&dev->dev, "device not available because of " dev_err(&dev->dev, "device not available because of "
"BAR %d [%llx:%llx] collisions\n", i, "BAR %d [%#llx-%#llx] collisions\n", i,
(unsigned long long) r->start, (unsigned long long) r->start,
(unsigned long long) r->end); (unsigned long long) r->end);
return -EINVAL; return -EINVAL;
......
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