[PATCH] powerpc: PCI hotplug common code elimination
authorLinas Vepstas <linas@linas.org>
Fri, 4 Nov 2005 00:51:31 +0000 (18:51 -0600)
committerPaul Mackerras <paulus@samba.org>
Mon, 9 Jan 2006 03:51:05 +0000 (14:51 +1100)
20-rpaphp-eeh-cleanup.patch

This patch move some code from the rpaphp directory, to the powerpc
directory, where it should have been all along (Among other things, I
need it in the powerpc directory for the PCI error recovery.)

Please note that patch affects TWO maintainers: Paul, after applying
the powerpc part, please ask that GregKH appli the PCI part. It is safe
to have the powerpc part go in first. It would be bad to have the
PCI part go in first.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/pseries/eeh.c
include/asm-powerpc/eeh.h

index c8d2a40..7fbfd16 100644 (file)
@@ -1093,6 +1093,15 @@ void eeh_add_device_early(struct device_node *dn)
 }
 EXPORT_SYMBOL_GPL(eeh_add_device_early);
 
+void eeh_add_device_tree_early(struct device_node *dn)
+{
+       struct device_node *sib;
+       for (sib = dn->child; sib; sib = sib->sibling)
+               eeh_add_device_tree_early(sib);
+       eeh_add_device_early(dn);
+}
+EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
+
 /**
  * eeh_add_device_late - perform EEH initialization for the indicated pci device
  * @dev: pci device for which to set up EEH
@@ -1147,6 +1156,23 @@ void eeh_remove_device(struct pci_dev *dev)
 }
 EXPORT_SYMBOL_GPL(eeh_remove_device);
 
+void eeh_remove_bus_device(struct pci_dev *dev)
+{
+       eeh_remove_device(dev);
+       if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+               struct pci_bus *bus = dev->subordinate;
+               struct list_head *ln;
+               if (!bus)
+                       return; 
+               for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
+                       struct pci_dev *pdev = pci_dev_b(ln);
+                       if (pdev)
+                               eeh_remove_bus_device(pdev);
+               }
+       }
+}
+EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
+
 static int proc_eeh_show(struct seq_file *m, void *v)
 {
        unsigned int cpu;
index f8633aa..e4ca35a 100644 (file)
@@ -57,6 +57,7 @@ void __init pci_addr_cache_build(void);
  * to finish the eeh setup for this device.
  */
 void eeh_add_device_early(struct device_node *);
+void eeh_add_device_tree_early(struct device_node *);
 void eeh_add_device_late(struct pci_dev *);
 
 /**
@@ -71,6 +72,15 @@ void eeh_add_device_late(struct pci_dev *);
  */
 void eeh_remove_device(struct pci_dev *);
 
+/**
+ * eeh_remove_device_recursive - undo EEH for device & children.
+ * @dev: pci device to be removed
+ *
+ * As above, this removes the device; it also removes child
+ * pci devices as well.
+ */
+void eeh_remove_bus_device(struct pci_dev *);
+
 /**
  * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
  *