aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpaphp_core.c
diff options
context:
space:
mode:
authorJohn Rose <johnrose@austin.ibm.com>2005-07-25 11:17:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 17:57:23 -0400
commit56d8456b06ad1316bff3c75caed5e06e786f20d8 (patch)
treef7a17c2e66c548b5172bebd07a01437ff78a9447 /drivers/pci/hotplug/rpaphp_core.c
parent940903c5a5a906c622a79b3101586deb1a1b3480 (diff)
[PATCH] PCI Hotplug: rpaphp: Purify hotplug
Currently rpaphp registers the following bus types as hotplug slots: 1) Actual PCI Hotplug slots 2) Embedded/Internal PCI slots 3) PCI Host Bridges The second and third bus types are not actually direct parents of removable adapters. As such, the rpaphp has special case code to fake results for attributes like power, adapter status, etc. This patch removes types 2 and 3 from the rpaphp module. This patch also changes the DLPAR module so that slots can be DLPAR-added/removed without having been designated as hotplug-capable. Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_core.c')
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c69
1 files changed, 13 insertions, 56 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 22ec0993cf89..c830ff0acdc3 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -307,34 +307,6 @@ static int is_php_dn(struct device_node *dn, int **indexes, int **names,
307 return 0; 307 return 0;
308} 308}
309 309
310static int is_dr_dn(struct device_node *dn, int **indexes, int **names,
311 int **types, int **power_domains, int **my_drc_index)
312{
313 int rc;
314
315 *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL);
316 if(!*my_drc_index)
317 return (0);
318
319 if (!dn->parent)
320 return (0);
321
322 rc = get_children_props(dn->parent, indexes, names, types,
323 power_domains);
324 return (rc >= 0);
325}
326
327static inline int is_vdevice_root(struct device_node *dn)
328{
329 return !strcmp(dn->name, "vdevice");
330}
331
332int is_dlpar_type(const char *type_str)
333{
334 /* Only register DLPAR-capable nodes of drc-type PHB or SLOT */
335 return (!strcmp(type_str, "PHB") || !strcmp(type_str, "SLOT"));
336}
337
338/**************************************************************** 310/****************************************************************
339 * rpaphp not only registers PCI hotplug slots(HOTPLUG), 311 * rpaphp not only registers PCI hotplug slots(HOTPLUG),
340 * but also logical DR slots(EMBEDDED). 312 * but also logical DR slots(EMBEDDED).
@@ -346,7 +318,7 @@ int rpaphp_add_slot(struct device_node *dn)
346{ 318{
347 struct slot *slot; 319 struct slot *slot;
348 int retval = 0; 320 int retval = 0;
349 int i, *my_drc_index, slot_type; 321 int i;
350 int *indexes, *names, *types, *power_domains; 322 int *indexes, *names, *types, *power_domains;
351 char *name, *type; 323 char *name, *type;
352 324
@@ -354,40 +326,25 @@ int rpaphp_add_slot(struct device_node *dn)
354 326
355 /* register PCI devices */ 327 /* register PCI devices */
356 if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { 328 if (dn->name != 0 && strcmp(dn->name, "pci") == 0) {
357 if (is_php_dn(dn, &indexes, &names, &types, &power_domains)) 329 if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
358 slot_type = HOTPLUG; 330 goto exit;
359 else if (is_dr_dn(dn, &indexes, &names, &types, &power_domains, &my_drc_index))
360 slot_type = EMBEDDED;
361 else goto exit;
362 331
363 name = (char *) &names[1]; 332 name = (char *) &names[1];
364 type = (char *) &types[1]; 333 type = (char *) &types[1];
365 for (i = 0; i < indexes[0]; i++, 334 for (i = 0; i < indexes[0]; i++,
366 name += (strlen(name) + 1), type += (strlen(type) + 1)) { 335 name += (strlen(name) + 1), type += (strlen(type) + 1)) {
367 336
368 if (slot_type == HOTPLUG || 337 if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name,
369 (slot_type == EMBEDDED && 338 power_domains[i + 1]))) {
370 indexes[i + 1] == my_drc_index[0] && 339 retval = -ENOMEM;
371 is_dlpar_type(type))) { 340 goto exit;
372 if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, 341 }
373 power_domains[i + 1]))) { 342 slot->type = simple_strtoul(type, NULL, 10);
374 retval = -ENOMEM;
375 goto exit;
376 }
377 if (!strcmp(type, "PHB"))
378 slot->type = PHB;
379 else if (slot_type == EMBEDDED)
380 slot->type = EMBEDDED;
381 else
382 slot->type = simple_strtoul(type, NULL, 10);
383 343
384 dbg(" Found drc-index:0x%x drc-name:%s drc-type:%s\n", 344 dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
385 indexes[i + 1], name, type); 345 indexes[i + 1], name, type);
386 346
387 retval = register_pci_slot(slot); 347 retval = register_pci_slot(slot);
388 if (slot_type == EMBEDDED)
389 goto exit;
390 }
391 } 348 }
392 } 349 }
393exit: 350exit: