powerpc/pci: Cleanup debug printk's
[deliverable/linux.git] / arch / powerpc / kernel / pci_64.c
index 8247cff1cb3e0dc313861d041bcf7afae3c559e4..ffada88a4484c9edb6e9acd80a49753141b9fc81 100644 (file)
 #include <asm/machdep.h>
 #include <asm/ppc-pci.h>
 
-#ifdef DEBUG
-#include <asm/udbg.h>
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
 unsigned long pci_probe_only = 1;
 
 /* pci_io_base -- the base address from which io bars are offsets.
@@ -102,7 +95,7 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
        addrs = of_get_property(node, "assigned-addresses", &proplen);
        if (!addrs)
                return;
-       DBG("    parse addresses (%d bytes) @ %p\n", proplen, addrs);
+       pr_debug("    parse addresses (%d bytes) @ %p\n", proplen, addrs);
        for (; proplen >= 20; proplen -= 20, addrs += 5) {
                flags = pci_parse_of_flags(addrs[0]);
                if (!flags)
@@ -112,8 +105,9 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
                if (!size)
                        continue;
                i = addrs[0] & 0xff;
-               DBG("  base: %llx, size: %llx, i: %x\n",
-                   (unsigned long long)base, (unsigned long long)size, i);
+               pr_debug("  base: %llx, size: %llx, i: %x\n",
+                        (unsigned long long)base,
+                        (unsigned long long)size, i);
 
                if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {
                        res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
@@ -144,7 +138,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
        if (type == NULL)
                type = "";
 
-       DBG("    create device, devfn: %x, type: %s\n", devfn, type);
+       pr_debug("    create device, devfn: %x, type: %s\n", devfn, type);
 
        dev->bus = bus;
        dev->sysdata = node;
@@ -165,8 +159,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
        dev->class = get_int_prop(node, "class-code", 0);
        dev->revision = get_int_prop(node, "revision-id", 0);
 
-       DBG("    class: 0x%x\n", dev->class);
-       DBG("    revision: 0x%x\n", dev->revision);
+       pr_debug("    class: 0x%x\n", dev->class);
+       pr_debug("    revision: 0x%x\n", dev->revision);
 
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
@@ -187,7 +181,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 
        pci_parse_of_addrs(node, dev);
 
-       DBG("    adding to system ...\n");
+       pr_debug("    adding to system ...\n");
 
        pci_device_add(dev, bus);
 
@@ -203,11 +197,12 @@ void __devinit of_scan_bus(struct device_node *node,
        int reglen, devfn;
        struct pci_dev *dev;
 
-       DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number);
+       pr_debug("of_scan_bus(%s) bus no %d... \n",
+                node->full_name, bus->number);
 
        /* Scan direct children */
        for_each_child_of_node(node, child) {
-               DBG("  * %s\n", child->full_name);
+               pr_debug("  * %s\n", child->full_name);
                reg = of_get_property(child, "reg", &reglen);
                if (reg == NULL || reglen < 20)
                        continue;
@@ -217,7 +212,7 @@ void __devinit of_scan_bus(struct device_node *node,
                dev = of_create_pci_dev(child, bus, devfn);
                if (!dev)
                        continue;
-               DBG("    dev header type: %x\n", dev->hdr_type);
+               pr_debug("    dev header type: %x\n", dev->hdr_type);
        }
 
        /* Ally all fixups */
@@ -245,7 +240,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
        unsigned int flags;
        u64 size;
 
-       DBG("of_scan_pci_bridge(%s)\n", node->full_name);
+       pr_debug("of_scan_pci_bridge(%s)\n", node->full_name);
 
        /* parse bus-range property */
        busrange = of_get_property(node, "bus-range", &len);
@@ -309,12 +304,12 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
        }
        sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
                bus->number);
-       DBG("    bus name: %s\n", bus->name);
+       pr_debug("    bus name: %s\n", bus->name);
 
        mode = PCI_PROBE_NORMAL;
        if (ppc_md.pci_probe_mode)
                mode = ppc_md.pci_probe_mode(bus);
-       DBG("    probe mode: %d\n", mode);
+       pr_debug("    probe mode: %d\n", mode);
 
        if (mode == PCI_PROBE_DEVTREE)
                of_scan_bus(node, bus);
@@ -329,7 +324,8 @@ void __devinit scan_phb(struct pci_controller *hose)
        struct device_node *node = hose->dn;
        int i, mode;
 
-       DBG("PCI: Scanning PHB %s\n", node ? node->full_name : "<NO NAME>");
+       pr_debug("PCI: Scanning PHB %s\n",
+                node ? node->full_name : "<NO NAME>");
 
        /* Create an empty bus for the toplevel */
        bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node);
@@ -345,26 +341,26 @@ void __devinit scan_phb(struct pci_controller *hose)
        pcibios_map_io_space(bus);
 
        /* Wire up PHB bus resources */
-       DBG("PCI: PHB IO resource    = %016lx-%016lx [%lx]\n",
-           hose->io_resource.start, hose->io_resource.end,
-           hose->io_resource.flags);
+       pr_debug("PCI: PHB IO resource    = %016lx-%016lx [%lx]\n",
+                hose->io_resource.start, hose->io_resource.end,
+                hose->io_resource.flags);
        bus->resource[0] = &hose->io_resource;
        for (i = 0; i < 3; ++i) {
-               DBG("PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n", i,
-                   hose->mem_resources[i].start,
-                   hose->mem_resources[i].end,
-                   hose->mem_resources[i].flags);
+               pr_debug("PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n", i,
+                        hose->mem_resources[i].start,
+                        hose->mem_resources[i].end,
+                        hose->mem_resources[i].flags);
                bus->resource[i+1] = &hose->mem_resources[i];
        }
-       DBG("PCI: PHB MEM offset     = %016lx\n", hose->pci_mem_offset);
-       DBG("PCI: PHB IO  offset     = %08lx\n",
+       pr_debug("PCI: PHB MEM offset     = %016lx\n", hose->pci_mem_offset);
+       pr_debug("PCI: PHB IO  offset     = %08lx\n",
            (unsigned long)hose->io_base_virt - _IO_BASE);
 
        /* Get probe mode and perform scan */
        mode = PCI_PROBE_NORMAL;
        if (node && ppc_md.pci_probe_mode)
                mode = ppc_md.pci_probe_mode(bus);
-       DBG("    probe mode: %d\n", mode);
+       pr_debug("    probe mode: %d\n", mode);
        if (mode == PCI_PROBE_DEVTREE) {
                bus->subordinate = hose->last_busno;
                of_scan_bus(node, bus);
@@ -388,6 +384,11 @@ static int __init pcibios_init(void)
        if (pci_probe_only)
                ppc_pci_flags |= PPC_PCI_PROBE_ONLY;
 
+       /* On ppc64, we always enable PCI domains and we keep domain 0
+        * backward compatible in /proc for video cards
+        */
+       ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0;
+
        /* Scan all of the recorded PCI controllers.  */
        list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
                scan_phb(hose);
@@ -422,11 +423,11 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
        if (bus->self) {
                struct resource *res = bus->resource[0];
 
-               DBG("IO unmapping for PCI-PCI bridge %s\n",
-                   pci_name(bus->self));
+               pr_debug("IO unmapping for PCI-PCI bridge %s\n",
+                        pci_name(bus->self));
 
                __flush_hash_table_range(&init_mm, res->start + _IO_BASE,
-                                        res->end - res->start + 1);
+                                        res->end + _IO_BASE + 1);
                return 0;
        }
 
@@ -437,8 +438,8 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
        if (hose->io_base_alloc == 0)
                return 0;
 
-       DBG("IO unmapping for PHB %s\n", hose->dn->full_name);
-       DBG("  alloc=0x%p\n", hose->io_base_alloc);
+       pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name);
+       pr_debug("  alloc=0x%p\n", hose->io_base_alloc);
 
        /* This is a PHB, we fully unmap the IO area */
        vunmap(hose->io_base_alloc);
@@ -463,11 +464,11 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
         * thus HPTEs will be faulted in when needed
         */
        if (bus->self) {
-               DBG("IO mapping for PCI-PCI bridge %s\n",
-                   pci_name(bus->self));
-               DBG("  virt=0x%016lx...0x%016lx\n",
-                   bus->resource[0]->start + _IO_BASE,
-                   bus->resource[0]->end + _IO_BASE);
+               pr_debug("IO mapping for PCI-PCI bridge %s\n",
+                        pci_name(bus->self));
+               pr_debug("  virt=0x%016lx...0x%016lx\n",
+                        bus->resource[0]->start + _IO_BASE,
+                        bus->resource[0]->end + _IO_BASE);
                return 0;
        }
 
@@ -496,11 +497,11 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
        hose->io_base_virt = (void __iomem *)(area->addr +
                                              hose->io_base_phys - phys_page);
 
-       DBG("IO mapping for PHB %s\n", hose->dn->full_name);
-       DBG("  phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
-           hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
-       DBG("  size=0x%016lx (alloc=0x%016lx)\n",
-           hose->pci_io_size, size_page);
+       pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
+       pr_debug("  phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
+                hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
+       pr_debug("  size=0x%016lx (alloc=0x%016lx)\n",
+                hose->pci_io_size, size_page);
 
        /* Establish the mapping */
        if (__ioremap_at(phys_page, area->addr, size_page,
@@ -512,8 +513,8 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
        hose->io_resource.start += io_virt_offset;
        hose->io_resource.end += io_virt_offset;
 
-       DBG("  hose->io_resource=0x%016lx...0x%016lx\n",
-           hose->io_resource.start, hose->io_resource.end);
+       pr_debug("  hose->io_resource=0x%016lx...0x%016lx\n",
+                hose->io_resource.start, hose->io_resource.end);
 
        return 0;
 }
This page took 0.039292 seconds and 5 git commands to generate.