x86/PCI: print resources consistently with %pRt
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Tue, 6 Oct 2009 21:33:49 +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>
arch/x86/pci/acpi.c
arch/x86/pci/i386.c

index 1014eb4bfc37ac15cec9e3b24b3f980a1a52e7d9..9b3daf976732a0fc535de5c81c11272b9d11544a 100644 (file)
@@ -7,6 +7,7 @@
 #include <asm/pci_x86.h>
 
 struct pci_root_info {
+       struct acpi_device *bridge;
        char *name;
        unsigned int res_num;
        struct resource *res;
@@ -107,12 +108,18 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
        res->child = NULL;
 
        if (insert_resource(root, res)) {
-               printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx "
-                       "from %s for %s\n", (unsigned long) res->start,
-                       (unsigned long) res->end, root->name, info->name);
+               dev_err(&info->bridge->dev, "can't allocate %pRt\n", res);
        } else {
                info->bus->resource[info->res_num] = res;
                info->res_num++;
+               if (addr.translation_offset)
+                       dev_info(&info->bridge->dev, "host bridge window: %pRt "
+                                "(PCI address [%#llx-%#llx])\n",
+                                res, res->start - addr.translation_offset,
+                                res->end - addr.translation_offset);
+               else
+                       dev_info(&info->bridge->dev,
+                                "host bridge window: %pRt\n", res);
        }
        return AE_OK;
 }
@@ -124,6 +131,7 @@ get_current_resources(struct acpi_device *device, int busnum,
        struct pci_root_info info;
        size_t size;
 
+       info.bridge = device;
        info.bus = bus;
        info.res_num = 0;
        acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource,
index b22d13b0c71d0f538cd25f2643490d0bf2fa86a3..a70a85de5e84e91a7124484625d16e0208048fc3 100644 (file)
@@ -129,7 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
                                        continue;
                                if (!r->start ||
                                    pci_claim_resource(dev, idx) < 0) {
-                                       dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
+                                       dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
                                        /*
                                         * Something is wrong with the region.
                                         * Invalidate the resource to prevent
@@ -164,12 +164,10 @@ static void __init pcibios_allocate_resources(int pass)
                        else
                                disabled = !(command & PCI_COMMAND_MEMORY);
                        if (pass == disabled) {
-                               dev_dbg(&dev->dev, "resource %#08llx-%#08llx (f=%lx, d=%d, p=%d)\n",
-                                       (unsigned long long) r->start,
-                                       (unsigned long long) r->end,
-                                       r->flags, disabled, pass);
+                               dev_dbg(&dev->dev, "%pRf (d=%d, p=%d)\n", r,
+                                       disabled, pass);
                                if (pci_claim_resource(dev, idx) < 0) {
-                                       dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
+                                       dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
                                        /* We'll assign a new address later */
                                        r->end -= r->start;
                                        r->start = 0;
@@ -182,7 +180,7 @@ static void __init pcibios_allocate_resources(int pass)
                                /* Turn the ROM off, leave the resource region,
                                 * but keep it unregistered. */
                                u32 reg;
-                               dev_dbg(&dev->dev, "disabling ROM\n");
+                               dev_dbg(&dev->dev, "disabling ROM %pRt\n", r);
                                r->flags &= ~IORESOURCE_ROM_ENABLE;
                                pci_read_config_dword(dev,
                                                dev->rom_base_reg, &reg);