These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / arm / kernel / bios32.c
index fcbbbb1..066f7f9 100644 (file)
 
 static int debug_pci;
 
-#ifdef CONFIG_PCI_MSI
-struct msi_controller *pcibios_msi_controller(struct pci_dev *dev)
-{
-       struct pci_sys_data *sysdata = dev->bus->sysdata;
-
-       return sysdata->msi_ctrl;
-}
-#endif
-
 /*
  * We can't use pci_get_device() here since we are
  * called from interrupt context.
@@ -459,16 +450,12 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
 
        for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
                sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
-               if (!sys)
-                       panic("PCI: unable to allocate sys data!");
+               if (WARN(!sys, "PCI: unable to allocate sys data!"))
+                       break;
 
-#ifdef CONFIG_PCI_MSI
-               sys->msi_ctrl = hw->msi_ctrl;
-#endif
                sys->busnr   = busnr;
                sys->swizzle = hw->swizzle;
                sys->map_irq = hw->map_irq;
-               sys->align_resource = hw->align_resource;
                INIT_LIST_HEAD(&sys->resources);
 
                if (hw->private_data)
@@ -477,6 +464,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
                ret = hw->setup(nr, sys);
 
                if (ret > 0) {
+                       struct pci_host_bridge *host_bridge;
+
                        ret = pcibios_init_resources(nr, sys);
                        if (ret)  {
                                kfree(sys);
@@ -486,15 +475,21 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
                        if (hw->scan)
                                sys->bus = hw->scan(nr, sys);
                        else
-                               sys->bus = pci_scan_root_bus(parent, sys->busnr,
-                                               hw->ops, sys, &sys->resources);
+                               sys->bus = pci_scan_root_bus_msi(parent,
+                                       sys->busnr, hw->ops, sys,
+                                       &sys->resources, hw->msi_ctrl);
 
-                       if (!sys->bus)
-                               panic("PCI: unable to scan bus!");
+                       if (WARN(!sys->bus, "PCI: unable to scan bus!")) {
+                               kfree(sys);
+                               break;
+                       }
 
                        busnr = sys->bus->busn_res.end + 1;
 
                        list_add(&sys->node, head);
+
+                       host_bridge = pci_find_host_bridge(sys->bus);
+                       host_bridge->align_resource = hw->align_resource;
                } else {
                        kfree(sys);
                        if (ret < 0)
@@ -521,6 +516,8 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
                struct pci_bus *bus = sys->bus;
 
                if (!pci_has_flag(PCI_PROBE_ONLY)) {
+                       struct pci_bus *child;
+
                        /*
                         * Size the bridge windows.
                         */
@@ -530,25 +527,15 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
                         * Assign resources.
                         */
                        pci_bus_assign_resources(bus);
-               }
 
+                       list_for_each_entry(child, &bus->children, node)
+                               pcie_bus_configure_settings(child);
+               }
                /*
                 * Tell drivers about devices found.
                 */
                pci_bus_add_devices(bus);
        }
-
-       list_for_each_entry(sys, &head, node) {
-               struct pci_bus *bus = sys->bus;
-
-               /* Configure PCI Express settings */
-               if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
-                       struct pci_bus *child;
-
-                       list_for_each_entry(child, &bus->children, node)
-                               pcie_bus_configure_settings(child);
-               }
-       }
 }
 
 #ifndef CONFIG_PCI_HOST_ITE8152
@@ -589,16 +576,19 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
                                resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
-       struct pci_sys_data *sys = dev->sysdata;
        resource_size_t start = res->start;
+       struct pci_host_bridge *host_bridge;
 
        if (res->flags & IORESOURCE_IO && start & 0x300)
                start = (start + 0x3ff) & ~0x3ff;
 
        start = (start + align - 1) & ~(align - 1);
 
-       if (sys->align_resource)
-               return sys->align_resource(dev, res, start, size, align);
+       host_bridge = pci_find_host_bridge(dev->bus);
+
+       if (host_bridge->align_resource)
+               return host_bridge->align_resource(dev, res,
+                               start, size, align);
 
        return start;
 }