summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorJohn Rose <johnrose@austin.ibm.com>2005-07-25 10:16:58 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 14:57:23 -0700
commit940903c5a5a906c622a79b3101586deb1a1b3480 (patch)
tree9bdeaf31e715e6f59f4202e7e8552df6bc794d94 /drivers/pci
parent0945cd5f908a09ad99bf42d7ded16f26f24f317d (diff)
[PATCH] PCI Hotplug: rpaphp: Export slot enable
This patch exports rpaphp_config_pci_adapter() for use by the rpadlpar module. It also changes this function by removing any dependencies on struct slot. The patch also changes the RPA DLPAR-add path to enable newly-added slots in a separate step from that which registers them as hotplug slots. Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c12
-rw-r--r--drivers/pci/hotplug/rpaphp.h1
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c36
3 files changed, 35 insertions, 14 deletions
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 2ee7eb513e6..f2a73f70e58 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -209,9 +209,10 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
return dev;
}
-static inline int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
+static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
{
struct pci_dev *dev;
+ int rc;
/* Add pci bus */
dev = dlpar_pci_add_bus(dn);
@@ -221,6 +222,15 @@ static inline int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
return -EIO;
}
+ if (dn->child) {
+ rc = rpaphp_config_pci_adapter(dev->subordinate);
+ if (rc < 0) {
+ printk(KERN_ERR "%s: unable to enable slot %s\n",
+ __FUNCTION__, drc_name);
+ return -EIO;
+ }
+ }
+
/* Add hotplug slot */
if (rpaphp_add_slot(dn)) {
printk(KERN_ERR "%s: unable to add hotplug slot %s\n",
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
index 8ecff0b950e..064a0d66e3c 100644
--- a/drivers/pci/hotplug/rpaphp.h
+++ b/drivers/pci/hotplug/rpaphp.h
@@ -98,6 +98,7 @@ extern int rpaphp_enable_pci_slot(struct slot *slot);
extern int register_pci_slot(struct slot *slot);
extern int rpaphp_unconfig_pci_adapter(struct slot *slot);
extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+extern int rpaphp_config_pci_adapter(struct pci_bus *bus);
/* rpaphp_core.c */
extern int rpaphp_add_slot(struct device_node *dn);
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 30a892ca4b3..f2f1cd0f941 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -219,14 +219,15 @@ static int rpaphp_pci_config_bridge(struct pci_dev *dev)
given slot->dn and return the the first pci_dev.
*****************************************************************************/
static struct pci_dev *
-rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus)
+rpaphp_pci_config_slot(struct pci_bus *bus)
{
+ struct device_node *dn = pci_bus_to_OF_node(bus);
struct pci_dev *dev = NULL;
int slotno;
int num;
dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name);
- if (!dn->child)
+ if (!dn || !dn->child)
return NULL;
slotno = PCI_SLOT(dn->child->devfn);
@@ -260,35 +261,44 @@ static void enable_eeh(struct device_node *dn)
}
-static void print_slot_pci_funcs(struct slot *slot)
+static void print_slot_pci_funcs(struct pci_bus *bus)
{
+ struct device_node *dn;
struct pci_dev *dev;
- dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, slot->name);
- list_for_each_entry (dev, slot->pci_devs, bus_list)
+ dn = pci_bus_to_OF_node(bus);
+ if (!dn)
+ return;
+
+ dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, dn->full_name);
+ list_for_each_entry (dev, &bus->devices, bus_list)
dbg("\t%s\n", pci_name(dev));
return;
}
-static int rpaphp_config_pci_adapter(struct slot *slot)
+int rpaphp_config_pci_adapter(struct pci_bus *bus)
{
+ struct device_node *dn = pci_bus_to_OF_node(bus);
struct pci_dev *dev;
int rc = -ENODEV;
- dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name);
+ dbg("Entry %s: slot[%s]\n", __FUNCTION__, dn->full_name);
+ if (!dn)
+ goto exit;
- enable_eeh(slot->dn);
- dev = rpaphp_pci_config_slot(slot->dn, slot->bus);
+ enable_eeh(dn);
+ dev = rpaphp_pci_config_slot(bus);
if (!dev) {
err("%s: can't find any devices.\n", __FUNCTION__);
goto exit;
}
- print_slot_pci_funcs(slot);
+ print_slot_pci_funcs(bus);
rc = 0;
exit:
dbg("Exit %s: rc=%d\n", __FUNCTION__, rc);
return rc;
}
+EXPORT_SYMBOL_GPL(rpaphp_config_pci_adapter);
static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev)
{
@@ -384,7 +394,7 @@ static int setup_pci_slot(struct slot *slot)
if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) {
dbg("%s CONFIGURING pci adapter in slot[%s]\n",
__FUNCTION__, slot->name);
- if (rpaphp_config_pci_adapter(slot)) {
+ if (rpaphp_config_pci_adapter(slot->bus)) {
err("%s: CONFIG pci adapter failed\n", __FUNCTION__);
goto exit_rc;
}
@@ -394,7 +404,7 @@ static int setup_pci_slot(struct slot *slot)
__FUNCTION__, slot->name);
goto exit_rc;
}
- print_slot_pci_funcs(slot);
+ print_slot_pci_funcs(slot->bus);
if (!list_empty(slot->pci_devs)) {
slot->state = CONFIGURED;
} else {
@@ -437,7 +447,7 @@ int rpaphp_enable_pci_slot(struct slot *slot)
/* if slot is not empty, enable the adapter */
if (state == PRESENT) {
dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name);
- retval = rpaphp_config_pci_adapter(slot);
+ retval = rpaphp_config_pci_adapter(slot->bus);
if (!retval) {
slot->state = CONFIGURED;
dbg("%s: PCI devices in slot[%s] has been configured\n",