diff options
author | John Rose <johnrose@austin.ibm.com> | 2005-07-25 11:17:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 17:57:23 -0400 |
commit | 56d8456b06ad1316bff3c75caed5e06e786f20d8 (patch) | |
tree | f7a17c2e66c548b5172bebd07a01437ff78a9447 /drivers/pci/hotplug/rpaphp_slot.c | |
parent | 940903c5a5a906c622a79b3101586deb1a1b3480 (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_slot.c')
-rw-r--r-- | drivers/pci/hotplug/rpaphp_slot.c | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 80402027c015..0e8815495083 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -30,35 +30,6 @@ | |||
30 | #include <asm/rtas.h> | 30 | #include <asm/rtas.h> |
31 | #include "rpaphp.h" | 31 | #include "rpaphp.h" |
32 | 32 | ||
33 | static ssize_t removable_read_file (struct hotplug_slot *php_slot, char *buf) | ||
34 | { | ||
35 | u8 value; | ||
36 | int retval = -ENOENT; | ||
37 | struct slot *slot = (struct slot *)php_slot->private; | ||
38 | |||
39 | if (!slot) | ||
40 | return retval; | ||
41 | |||
42 | value = slot->removable; | ||
43 | retval = sprintf (buf, "%d\n", value); | ||
44 | return retval; | ||
45 | } | ||
46 | |||
47 | static struct hotplug_slot_attribute hotplug_slot_attr_removable = { | ||
48 | .attr = {.name = "phy_removable", .mode = S_IFREG | S_IRUGO}, | ||
49 | .show = removable_read_file, | ||
50 | }; | ||
51 | |||
52 | static void rpaphp_sysfs_add_attr_removable (struct hotplug_slot *slot) | ||
53 | { | ||
54 | sysfs_create_file(&slot->kobj, &hotplug_slot_attr_removable.attr); | ||
55 | } | ||
56 | |||
57 | static void rpaphp_sysfs_remove_attr_removable (struct hotplug_slot *slot) | ||
58 | { | ||
59 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_removable.attr); | ||
60 | } | ||
61 | |||
62 | static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) | 33 | static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) |
63 | { | 34 | { |
64 | char *value; | 35 | char *value; |
@@ -176,9 +147,6 @@ int deregister_slot(struct slot *slot) | |||
176 | /* remove "phy_location" file */ | 147 | /* remove "phy_location" file */ |
177 | rpaphp_sysfs_remove_attr_location(php_slot); | 148 | rpaphp_sysfs_remove_attr_location(php_slot); |
178 | 149 | ||
179 | /* remove "phy_removable" file */ | ||
180 | rpaphp_sysfs_remove_attr_removable(php_slot); | ||
181 | |||
182 | retval = pci_hp_deregister(php_slot); | 150 | retval = pci_hp_deregister(php_slot); |
183 | if (retval) | 151 | if (retval) |
184 | err("Problem unregistering a slot %s\n", slot->name); | 152 | err("Problem unregistering a slot %s\n", slot->name); |
@@ -212,9 +180,6 @@ int register_slot(struct slot *slot) | |||
212 | /* create "phy_locatoin" file */ | 180 | /* create "phy_locatoin" file */ |
213 | rpaphp_sysfs_add_attr_location(slot->hotplug_slot); | 181 | rpaphp_sysfs_add_attr_location(slot->hotplug_slot); |
214 | 182 | ||
215 | /* create "phy_removable" file */ | ||
216 | rpaphp_sysfs_add_attr_removable(slot->hotplug_slot); | ||
217 | |||
218 | /* add slot to our internal list */ | 183 | /* add slot to our internal list */ |
219 | dbg("%s adding slot[%s] to rpaphp_slot_list\n", | 184 | dbg("%s adding slot[%s] to rpaphp_slot_list\n", |
220 | __FUNCTION__, slot->name); | 185 | __FUNCTION__, slot->name); |
@@ -230,21 +195,17 @@ int rpaphp_get_power_status(struct slot *slot, u8 * value) | |||
230 | { | 195 | { |
231 | int rc = 0, level; | 196 | int rc = 0, level; |
232 | 197 | ||
233 | if (slot->type == HOTPLUG) { | 198 | rc = rtas_get_power_level(slot->power_domain, &level); |
234 | rc = rtas_get_power_level(slot->power_domain, &level); | 199 | if (rc < 0) { |
235 | if (!rc) { | 200 | err("failed to get power-level for slot(%s), rc=0x%x\n", |
236 | dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n", | 201 | slot->location, rc); |
237 | __FUNCTION__, slot->name, slot->power_domain, level); | 202 | return rc; |
238 | *value = level; | ||
239 | } else | ||
240 | err("failed to get power-level for slot(%s), rc=0x%x\n", | ||
241 | slot->location, rc); | ||
242 | } else { | ||
243 | dbg("%s report POWER_ON for EMBEDDED or PHB slot %s\n", | ||
244 | __FUNCTION__, slot->location); | ||
245 | *value = (u8) POWER_ON; | ||
246 | } | 203 | } |
247 | 204 | ||
205 | dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n", | ||
206 | __FUNCTION__, slot->name, slot->power_domain, level); | ||
207 | *value = level; | ||
208 | |||
248 | return rc; | 209 | return rc; |
249 | } | 210 | } |
250 | 211 | ||