]> Pileus Git - ~andy/linux/commitdiff
[PATCH] powerpc: handle multifunction PCI devices properly
authorLinas Vepstas <linas@linas.org>
Fri, 4 Nov 2005 00:55:01 +0000 (18:55 -0600)
committerPaul Mackerras <paulus@samba.org>
Tue, 10 Jan 2006 04:30:23 +0000 (15:30 +1100)
239-eeh-multifunction-consolidate.patch

New-style firmware will often place multiple different functions
under a non-EEH-aware parent.  However, these devices might share
a common PE "partition endpoint" and config address, ad thus any
EEH events will affect all of the devices in common.  This patch
makes the effort to find all of these common devices and handle
them together.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
(cherry picked from 216810296bb97d39da8e176822e9de78d2f00187 commit)

arch/powerpc/platforms/pseries/eeh.c
arch/powerpc/platforms/pseries/eeh_driver.c

index b0fa76d0c78ace1708a2bf6f2de15bc63b698f83..02bc1f9d20b97ee6e3e7c071a1c741d658a5650d 100644 (file)
@@ -223,6 +223,11 @@ static void __eeh_mark_slot (struct device_node *dn, int mode_flag)
 void eeh_mark_slot (struct device_node *dn, int mode_flag)
 {
        dn = find_device_pe (dn);
+
+       /* Back up one, since config addrs might be shared */
+       if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
+               dn = dn->parent;
+
        PCI_DN(dn)->eeh_mode |= mode_flag;
        __eeh_mark_slot (dn->child, mode_flag);
 }
@@ -244,7 +249,13 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag)
 {
        unsigned long flags;
        spin_lock_irqsave(&confirm_error_lock, flags);
+       
        dn = find_device_pe (dn);
+       
+       /* Back up one, since config addrs might be shared */
+       if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
+               dn = dn->parent;
+
        PCI_DN(dn)->eeh_mode &= ~mode_flag;
        PCI_DN(dn)->eeh_check_count = 0;
        __eeh_clear_slot (dn->child, mode_flag);
@@ -609,7 +620,7 @@ void eeh_restore_bars(struct pci_dn *pdn)
        if (!pdn) 
                return;
        
-       if (! pdn->eeh_is_bridge)
+       if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && (!pdn->eeh_is_bridge))
                __restore_bars (pdn);
 
        dn = pdn->node->child;
index 242b2923360d08922fb82b3c073e122b3dd3759e..1c97c89597fb6cc6054da87f0f6b363123848fa1 100644 (file)
@@ -213,9 +213,23 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
        if (rc)
                return rc;
 
-       /* Walk over all functions on this device */
-       rtas_configure_bridge(pe_dn);
-       eeh_restore_bars(pe_dn);
+       /* New-style config addrs might be shared across multiple devices,
+        * Walk over all functions on this device */
+       if (pe_dn->eeh_pe_config_addr) {
+               struct device_node *pe = pe_dn->node;
+               pe = pe->parent->child;
+               while (pe) {
+                       struct pci_dn *ppe = PCI_DN(pe);
+                       if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) {
+                               rtas_configure_bridge(ppe);
+                               eeh_restore_bars(ppe);
+                       }
+                       pe = pe->sibling;
+               }
+       } else {
+               rtas_configure_bridge(pe_dn);
+               eeh_restore_bars(pe_dn);
+       }
 
        /* Give the system 5 seconds to finish running the user-space
         * hotplug shutdown scripts, e.g. ifdown for ethernet.  Yes,