powerpc/eeh: Replace pci_dn with eeh_dev for EEH address cache
authorGavin Shan <shangw@linux.vnet.ibm.com>
Mon, 27 Feb 2012 20:04:06 +0000 (20:04 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Mar 2012 00:39:42 +0000 (11:39 +1100)
With original EEH implementation, struct pci_dn is used while building
PCI I/O address cache, which helps on searching the corresponding
PCI device according to the given physical I/O address. Besides, pci_dn
is associated with the corresponding PCI device while building its
I/O cache.

The patch replaces struct pci_dn with struct eeh_dev so that EEH address
cache won't depend on struct pci_dn. That will help EEH to become an
independent module in future. Besides, the binding of eeh_dev and PCI
device is done while building PCI device I/O cache.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/eeh_cache.c

index 7c36a9cc78c649431156e1c54725af2b712e6dee..e5ae1c687c669e27e1f03c6007295e53e750eff6 100644 (file)
@@ -175,7 +175,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
 static void __pci_addr_cache_insert_device(struct pci_dev *dev)
 {
        struct device_node *dn;
-       struct pci_dn *pdn;
+       struct eeh_dev *edev;
        int i;
 
        dn = pci_device_to_OF_node(dev);
@@ -184,13 +184,19 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
                return;
        }
 
+       edev = of_node_to_eeh_dev(dn);
+       if (!edev) {
+               pr_warning("PCI: no EEH dev found for dn=%s\n",
+                       dn->full_name);
+               return;
+       }
+
        /* Skip any devices for which EEH is not enabled. */
-       pdn = PCI_DN(dn);
-       if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
-           pdn->eeh_mode & EEH_MODE_NOCHECK) {
+       if (!(edev->mode & EEH_MODE_SUPPORTED) ||
+           edev->mode & EEH_MODE_NOCHECK) {
 #ifdef DEBUG
-               printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n",
-                      pci_name(dev), pdn->node->full_name);
+               pr_info("PCI: skip building address cache for=%s - %s\n",
+                       pci_name(dev), dn->full_name);
 #endif
                return;
        }
@@ -281,6 +287,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev)
 void __init pci_addr_cache_build(void)
 {
        struct device_node *dn;
+       struct eeh_dev *edev;
        struct pci_dev *dev = NULL;
 
        spin_lock_init(&pci_io_addr_cache_root.piar_lock);
@@ -291,8 +298,14 @@ void __init pci_addr_cache_build(void)
                dn = pci_device_to_OF_node(dev);
                if (!dn)
                        continue;
+
+               edev = of_node_to_eeh_dev(dn);
+               if (!edev)
+                       continue;
+
                pci_dev_get(dev);  /* matching put is in eeh_remove_device() */
-               PCI_DN(dn)->pcidev = dev;
+               dev->dev.archdata.edev = edev;
+               edev->pdev = dev;
 
                eeh_sysfs_add_device(dev);
        }
This page took 0.026512 seconds and 5 git commands to generate.