]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
powerpc/eeh: Move common part to kernel directory
authorGavin Shan <shangw@linux.vnet.ibm.com>
Thu, 20 Jun 2013 05:20:52 +0000 (13:20 +0800)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 20 Jun 2013 07:05:35 +0000 (17:05 +1000)
The patch moves the common part of EEH core into arch/powerpc/kernel
directory so that we needn't PPC_PSERIES while compiling POWERNV
platform:

        * Move the EEH common part into arch/powerpc/kernel
        * Move the functions for PCI hotplug from pSeries platform to
          arch/powerpc/kernel/pci-hotplug.c
        * Move CONFIG_EEH from arch/powerpc/platforms/pseries/Kconfig to
          arch/powerpc/platforms/Kconfig
        * Adjust makefile accordingly

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 files changed:
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/eeh.c [moved from arch/powerpc/platforms/pseries/eeh.c with 100% similarity]
arch/powerpc/kernel/eeh_cache.c [moved from arch/powerpc/platforms/pseries/eeh_cache.c with 99% similarity]
arch/powerpc/kernel/eeh_dev.c [moved from arch/powerpc/platforms/pseries/eeh_dev.c with 100% similarity]
arch/powerpc/kernel/eeh_driver.c [moved from arch/powerpc/platforms/pseries/eeh_driver.c with 99% similarity]
arch/powerpc/kernel/eeh_event.c [moved from arch/powerpc/platforms/pseries/eeh_event.c with 100% similarity]
arch/powerpc/kernel/eeh_pe.c [moved from arch/powerpc/platforms/pseries/eeh_pe.c with 100% similarity]
arch/powerpc/kernel/eeh_sysfs.c [moved from arch/powerpc/platforms/pseries/eeh_sysfs.c with 99% similarity]
arch/powerpc/kernel/pci-hotplug.c [new file with mode: 0644]
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/pseries/Kconfig
arch/powerpc/platforms/pseries/Makefile
arch/powerpc/platforms/pseries/pci_dlpar.c

index f960a7944553a2ca702eb7713cf13639564ffcfe..a8619bfe879e0168e5dbaca852ccfae3c176b907 100644 (file)
@@ -58,6 +58,8 @@ obj-$(CONFIG_RTAS_PROC)               += rtas-proc.o
 obj-$(CONFIG_LPARCFG)          += lparcfg.o
 obj-$(CONFIG_IBMVIO)           += vio.o
 obj-$(CONFIG_IBMEBUS)           += ibmebus.o
+obj-$(CONFIG_EEH)              += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \
+                                 eeh_driver.o eeh_event.o eeh_sysfs.o
 obj-$(CONFIG_GENERIC_TBSYNC)   += smp-tbsync.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump.o
 obj-$(CONFIG_FA_DUMP)          += fadump.o
@@ -100,7 +102,7 @@ obj-$(CONFIG_PPC_UDBG_16550)        += legacy_serial.o udbg_16550.o
 obj-$(CONFIG_STACKTRACE)       += stacktrace.o
 obj-$(CONFIG_SWIOTLB)          += dma-swiotlb.o
 
-pci64-$(CONFIG_PPC64)          += pci_dn.o isa-bridge.o
+pci64-$(CONFIG_PPC64)          += pci_dn.o pci-hotplug.o isa-bridge.o
 obj-$(CONFIG_PCI)              += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
                                   pci-common.o pci_of_scan.o
 obj-$(CONFIG_PCI_MSI)          += msi.o
similarity index 99%
rename from arch/powerpc/platforms/pseries/eeh_cache.c
rename to arch/powerpc/kernel/eeh_cache.c
index 5a4c87903057f46c6bfb7466ca87fdbc653cb1c0..1d5d9a6ba740b293945e65af8a77c15b9988a9e4 100644 (file)
@@ -316,4 +316,3 @@ void __init eeh_addr_cache_build(void)
        eeh_addr_cache_print(&pci_io_addr_cache_root);
 #endif
 }
-
similarity index 99%
rename from arch/powerpc/platforms/pseries/eeh_driver.c
rename to arch/powerpc/kernel/eeh_driver.c
index 0acc5a2bdfc717d2744d201ccdb3c4811b01b4d2..fb927af9a9ef3aa4f0831cebd58b863308c1fd1c 100644 (file)
@@ -549,4 +549,3 @@ perm_error:
        if (frozen_bus)
                pcibios_remove_pci_devices(frozen_bus);
 }
-
similarity index 99%
rename from arch/powerpc/platforms/pseries/eeh_sysfs.c
rename to arch/powerpc/kernel/eeh_sysfs.c
index d37708360f2e472b68d226df3da5a372ecfd406e..e7ae3484918c29639ff1a1baa597579a973fe6cd 100644 (file)
@@ -72,4 +72,3 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
        device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr);
        device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
 }
-
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
new file mode 100644 (file)
index 0000000..3f60880
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Derived from "arch/powerpc/platforms/pseries/pci_dlpar.c"
+ *
+ * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
+ * Copyright (C) 2005 International Business Machines
+ *
+ * Updates, 2005, John Rose <johnrose@austin.ibm.com>
+ * Updates, 2005, Linas Vepstas <linas@austin.ibm.com>
+ * Updates, 2013, Gavin Shan <shangw@linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/pci.h>
+#include <linux/export.h>
+#include <asm/pci-bridge.h>
+#include <asm/ppc-pci.h>
+#include <asm/firmware.h>
+#include <asm/eeh.h>
+
+/**
+ * __pcibios_remove_pci_devices - remove all devices under this bus
+ * @bus: the indicated PCI bus
+ * @purge_pe: destroy the PE on removal of PCI devices
+ *
+ * Remove all of the PCI devices under this bus both from the
+ * linux pci device tree, and from the powerpc EEH address cache.
+ * By default, the corresponding PE will be destroied during the
+ * normal PCI hotplug path. For PCI hotplug during EEH recovery,
+ * the corresponding PE won't be destroied and deallocated.
+ */
+void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe)
+{
+       struct pci_dev *dev, *tmp;
+       struct pci_bus *child_bus;
+
+       /* First go down child busses */
+       list_for_each_entry(child_bus, &bus->children, node)
+               __pcibios_remove_pci_devices(child_bus, purge_pe);
+
+       pr_debug("PCI: Removing devices on bus %04x:%02x\n",
+                pci_domain_nr(bus),  bus->number);
+       list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
+               pr_debug("     * Removing %s...\n", pci_name(dev));
+               eeh_remove_bus_device(dev, purge_pe);
+               pci_stop_and_remove_bus_device(dev);
+       }
+}
+
+/**
+ * pcibios_remove_pci_devices - remove all devices under this bus
+ * @bus: the indicated PCI bus
+ *
+ * Remove all of the PCI devices under this bus both from the
+ * linux pci device tree, and from the powerpc EEH address cache.
+ */
+void pcibios_remove_pci_devices(struct pci_bus *bus)
+{
+       __pcibios_remove_pci_devices(bus, 1);
+}
+EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
+
+/**
+ * pcibios_add_pci_devices - adds new pci devices to bus
+ * @bus: the indicated PCI bus
+ *
+ * This routine will find and fixup new pci devices under
+ * the indicated bus. This routine presumes that there
+ * might already be some devices under this bridge, so
+ * it carefully tries to add only new devices.  (And that
+ * is how this routine differs from other, similar pcibios
+ * routines.)
+ */
+void pcibios_add_pci_devices(struct pci_bus * bus)
+{
+       int slotno, num, mode, pass, max;
+       struct pci_dev *dev;
+       struct device_node *dn = pci_bus_to_OF_node(bus);
+
+       eeh_add_device_tree_early(dn);
+
+       mode = PCI_PROBE_NORMAL;
+       if (ppc_md.pci_probe_mode)
+               mode = ppc_md.pci_probe_mode(bus);
+
+       if (mode == PCI_PROBE_DEVTREE) {
+               /* use ofdt-based probe */
+               of_rescan_bus(dn, bus);
+       } else if (mode == PCI_PROBE_NORMAL) {
+               /* use legacy probe */
+               slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
+               num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
+               if (!num)
+                       return;
+               pcibios_setup_bus_devices(bus);
+               max = bus->busn_res.start;
+               for (pass = 0; pass < 2; pass++) {
+                       list_for_each_entry(dev, &bus->devices, bus_list) {
+                               if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
+                                   dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+                                       max = pci_scan_bridge(bus, dev,
+                                                             max, pass);
+                       }
+               }
+       }
+       pcibios_finish_adding_to_bus(bus);
+}
+EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
index b62aab3e22ecd0447caf0db7ff97c2c16bc12644..bed8c607588c04685bc21c812503b333a5b0d8f6 100644 (file)
@@ -164,6 +164,11 @@ config IBMEBUS
        help
          Bus device driver for GX bus based adapters.
 
+config EEH
+       bool
+       depends on (PPC_POWERNV || PPC_PSERIES) && PCI
+       default y
+
 config PPC_MPC106
        bool
        default n
index 4459eff7a75ad6b3f4135f015591e2b9575dcec4..1bd3399146ed6f945f24308ea95883bffdce8d28 100644 (file)
@@ -33,11 +33,6 @@ config PPC_SPLPAR
          processors, that is, which share physical processors between
          two or more partitions.
 
-config EEH
-       bool
-       depends on PPC_PSERIES && PCI
-       default y
-
 config PSERIES_MSI
        bool
        depends on PCI_MSI && EEH
index 53866e537a92d360994c382fa59f32ea18fd87a4..8ae010381316d961ba8bb836b54cfb650c9367f3 100644 (file)
@@ -6,9 +6,7 @@ obj-y                   := lpar.o hvCall.o nvram.o reconfig.o \
                           firmware.o power.o dlpar.o mobility.o
 obj-$(CONFIG_SMP)      += smp.o
 obj-$(CONFIG_SCANLOG)  += scanlog.o
-obj-$(CONFIG_EEH)      += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \
-                          eeh_driver.o eeh_event.o eeh_sysfs.o \
-                          eeh_pseries.o
+obj-$(CONFIG_EEH)      += eeh_pseries.o
 obj-$(CONFIG_KEXEC)    += kexec.o
 obj-$(CONFIG_PCI)      += pci.o pci_dlpar.o
 obj-$(CONFIG_PSERIES_MSI)      += msi.o
index c91b22be92889bb742569d500db73373eb5331a3..efe61374f6eae3eda2447a351787958a2f562cf8 100644 (file)
@@ -64,91 +64,6 @@ pcibios_find_pci_bus(struct device_node *dn)
 }
 EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);
 
-/**
- * __pcibios_remove_pci_devices - remove all devices under this bus
- * @bus: the indicated PCI bus
- * @purge_pe: destroy the PE on removal of PCI devices
- *
- * Remove all of the PCI devices under this bus both from the
- * linux pci device tree, and from the powerpc EEH address cache.
- * By default, the corresponding PE will be destroied during the
- * normal PCI hotplug path. For PCI hotplug during EEH recovery,
- * the corresponding PE won't be destroied and deallocated.
- */
-void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe)
-{
-       struct pci_dev *dev, *tmp;
-       struct pci_bus *child_bus;
-
-       /* First go down child busses */
-       list_for_each_entry(child_bus, &bus->children, node)
-               __pcibios_remove_pci_devices(child_bus, purge_pe);
-
-       pr_debug("PCI: Removing devices on bus %04x:%02x\n",
-               pci_domain_nr(bus),  bus->number);
-       list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
-               pr_debug("     * Removing %s...\n", pci_name(dev));
-               eeh_remove_bus_device(dev, purge_pe);
-               pci_stop_and_remove_bus_device(dev);
-       }
-}
-
-/**
- * pcibios_remove_pci_devices - remove all devices under this bus
- *
- * Remove all of the PCI devices under this bus both from the
- * linux pci device tree, and from the powerpc EEH address cache.
- */
-void pcibios_remove_pci_devices(struct pci_bus *bus)
-{
-       __pcibios_remove_pci_devices(bus, 1);
-}
-EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
-
-/**
- * pcibios_add_pci_devices - adds new pci devices to bus
- *
- * This routine will find and fixup new pci devices under
- * the indicated bus. This routine presumes that there
- * might already be some devices under this bridge, so
- * it carefully tries to add only new devices.  (And that
- * is how this routine differs from other, similar pcibios
- * routines.)
- */
-void pcibios_add_pci_devices(struct pci_bus * bus)
-{
-       int slotno, num, mode, pass, max;
-       struct pci_dev *dev;
-       struct device_node *dn = pci_bus_to_OF_node(bus);
-
-       eeh_add_device_tree_early(dn);
-
-       mode = PCI_PROBE_NORMAL;
-       if (ppc_md.pci_probe_mode)
-               mode = ppc_md.pci_probe_mode(bus);
-
-       if (mode == PCI_PROBE_DEVTREE) {
-               /* use ofdt-based probe */
-               of_rescan_bus(dn, bus);
-       } else if (mode == PCI_PROBE_NORMAL) {
-               /* use legacy probe */
-               slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
-               num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
-               if (!num)
-                       return;
-               pcibios_setup_bus_devices(bus);
-               max = bus->busn_res.start;
-               for (pass=0; pass < 2; pass++)
-                       list_for_each_entry(dev, &bus->devices, bus_list) {
-                       if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-                           dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
-                               max = pci_scan_bridge(bus, dev, max, pass);
-               }
-       }
-       pcibios_finish_adding_to_bus(bus);
-}
-EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
-
 struct pci_controller *init_phb_dynamic(struct device_node *dn)
 {
        struct pci_controller *phb;