]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/mips/pci/pci.c
MIPS: PCI: Make pcibios_set_cache_line_size an initcall
[karo-tx-linux.git] / arch / mips / pci / pci.c
index f1b11f0dea2d8e71e8f5b6cbf65ad4d9e54d0501..30320a4c890914eb8f03b18794984f0576c0fea7 100644 (file)
@@ -28,8 +28,7 @@
 /*
  * The PCI controller list.
  */
-
-static struct pci_controller *hose_head, **hose_tail = &hose_head;
+static LIST_HEAD(controllers);
 
 unsigned long PCIBIOS_MIN_IO;
 unsigned long PCIBIOS_MIN_MEM;
@@ -96,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
                                &resources);
        hose->bus = bus;
 
-       need_domain_info = need_domain_info || hose->index;
-       hose->need_domain_info = need_domain_info;
+       need_domain_info = need_domain_info || pci_domain_nr(bus);
+       set_pci_need_domain_info(hose, need_domain_info);
 
        if (!bus) {
                pci_free_resource_list(&resources);
@@ -112,7 +111,14 @@ static void pcibios_scanbus(struct pci_controller *hose)
                need_domain_info = 1;
        }
 
-       if (!pci_has_flag(PCI_PROBE_ONLY)) {
+       /*
+        * We insert PCI resources into the iomem_resource and
+        * ioport_resource trees in either pci_bus_claim_resources()
+        * or pci_bus_assign_resources().
+        */
+       if (pci_has_flag(PCI_PROBE_ONLY)) {
+               pci_bus_claim_resources(bus);
+       } else {
                pci_bus_size_bridges(bus);
                pci_bus_assign_resources(bus);
        }
@@ -186,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose)
                goto out;
        }
 
-       *hose_tail = hose;
-       hose_tail = &hose->next;
+       INIT_LIST_HEAD(&hose->list);
+       list_add(&hose->list, &controllers);
 
        /*
         * Do not panic here but later - this might happen before console init.
@@ -214,7 +220,7 @@ out:
               "Skipping PCI bus scan due to resource conflict\n");
 }
 
-static void __init pcibios_set_cache_line_size(void)
+static int __init pcibios_set_cache_line_size(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
        unsigned int lsize;
@@ -232,16 +238,16 @@ static void __init pcibios_set_cache_line_size(void)
        pci_dfl_cache_line_size = lsize >> 2;
 
        pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
+       return 0;
 }
+arch_initcall(pcibios_set_cache_line_size);
 
 static int __init pcibios_init(void)
 {
        struct pci_controller *hose;
 
-       pcibios_set_cache_line_size();
-
        /* Scan all of the recorded PCI controllers.  */
-       for (hose = hose_head; hose; hose = hose->next)
+       list_for_each_entry(hose, &controllers, list)
                pcibios_scanbus(hose);
 
        pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
@@ -319,6 +325,16 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 EXPORT_SYMBOL(PCIBIOS_MIN_IO);
 EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
 
+void pci_resource_to_user(const struct pci_dev *dev, int bar,
+                         const struct resource *rsrc, resource_size_t *start,
+                         resource_size_t *end)
+{
+       phys_addr_t size = resource_size(rsrc);
+
+       *start = fixup_bigphys_addr(rsrc->start, size);
+       *end = rsrc->start + size;
+}
+
 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {