diff options
-rw-r--r-- | drivers/pci/hotplug/rpaphp.h | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_pci.c | 98 |
2 files changed, 31 insertions, 73 deletions
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index 81746e6e0e0f..25bea00b4f14 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -72,11 +72,6 @@ extern int debug; | |||
72 | #define CONFIGURED 1 | 72 | #define CONFIGURED 1 |
73 | #define EMPTY 0 | 73 | #define EMPTY 0 |
74 | 74 | ||
75 | struct rpaphp_pci_func { | ||
76 | struct pci_dev *pci_dev; | ||
77 | struct list_head sibling; | ||
78 | }; | ||
79 | |||
80 | /* | 75 | /* |
81 | * struct slot - slot information for each *physical* slot | 76 | * struct slot - slot information for each *physical* slot |
82 | */ | 77 | */ |
@@ -113,7 +108,6 @@ extern int rpaphp_enable_pci_slot(struct slot *slot); | |||
113 | extern int register_pci_slot(struct slot *slot); | 108 | extern int register_pci_slot(struct slot *slot); |
114 | extern int rpaphp_unconfig_pci_adapter(struct slot *slot); | 109 | extern int rpaphp_unconfig_pci_adapter(struct slot *slot); |
115 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); | 110 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); |
116 | extern struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev); | ||
117 | 111 | ||
118 | /* rpaphp_core.c */ | 112 | /* rpaphp_core.c */ |
119 | extern int rpaphp_add_slot(struct device_node *dn); | 113 | 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 d8305a935aab..ab67d3d1a59c 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -186,39 +186,6 @@ rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | |||
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | static int rpaphp_pci_config_bridge(struct pci_dev *dev); | ||
190 | |||
191 | /***************************************************************************** | ||
192 | rpaphp_pci_config_slot() will configure all devices under the | ||
193 | given slot->dn and return the the first pci_dev. | ||
194 | *****************************************************************************/ | ||
195 | static struct pci_dev * | ||
196 | rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) | ||
197 | { | ||
198 | struct device_node *eads_first_child = dn->child; | ||
199 | struct pci_dev *dev = NULL; | ||
200 | int num; | ||
201 | |||
202 | dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); | ||
203 | |||
204 | if (eads_first_child) { | ||
205 | /* pci_scan_slot should find all children of EADs */ | ||
206 | num = pci_scan_slot(bus, PCI_DEVFN(PCI_SLOT(eads_first_child->devfn), 0)); | ||
207 | if (num) { | ||
208 | rpaphp_fixup_new_pci_devices(bus, 1); | ||
209 | pci_bus_add_devices(bus); | ||
210 | } | ||
211 | dev = rpaphp_find_pci_dev(eads_first_child); | ||
212 | if (!dev) { | ||
213 | err("No new device found\n"); | ||
214 | return NULL; | ||
215 | } | ||
216 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | ||
217 | rpaphp_pci_config_bridge(dev); | ||
218 | } | ||
219 | return dev; | ||
220 | } | ||
221 | |||
222 | static int rpaphp_pci_config_bridge(struct pci_dev *dev) | 189 | static int rpaphp_pci_config_bridge(struct pci_dev *dev) |
223 | { | 190 | { |
224 | u8 sec_busno; | 191 | u8 sec_busno; |
@@ -252,6 +219,37 @@ static int rpaphp_pci_config_bridge(struct pci_dev *dev) | |||
252 | return 0; | 219 | return 0; |
253 | } | 220 | } |
254 | 221 | ||
222 | /***************************************************************************** | ||
223 | rpaphp_pci_config_slot() will configure all devices under the | ||
224 | given slot->dn and return the the first pci_dev. | ||
225 | *****************************************************************************/ | ||
226 | static struct pci_dev * | ||
227 | rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) | ||
228 | { | ||
229 | struct device_node *eads_first_child = dn->child; | ||
230 | struct pci_dev *dev = NULL; | ||
231 | int num; | ||
232 | |||
233 | dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); | ||
234 | |||
235 | if (eads_first_child) { | ||
236 | /* pci_scan_slot should find all children of EADs */ | ||
237 | num = pci_scan_slot(bus, PCI_DEVFN(PCI_SLOT(eads_first_child->devfn), 0)); | ||
238 | if (num) { | ||
239 | rpaphp_fixup_new_pci_devices(bus, 1); | ||
240 | pci_bus_add_devices(bus); | ||
241 | } | ||
242 | dev = rpaphp_find_pci_dev(eads_first_child); | ||
243 | if (!dev) { | ||
244 | err("No new device found\n"); | ||
245 | return NULL; | ||
246 | } | ||
247 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | ||
248 | rpaphp_pci_config_bridge(dev); | ||
249 | } | ||
250 | return dev; | ||
251 | } | ||
252 | |||
255 | static void enable_eeh(struct device_node *dn) | 253 | static void enable_eeh(struct device_node *dn) |
256 | { | 254 | { |
257 | struct device_node *sib; | 255 | struct device_node *sib; |
@@ -502,37 +500,3 @@ exit: | |||
502 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | 500 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); |
503 | return retval; | 501 | return retval; |
504 | } | 502 | } |
505 | |||
506 | struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev) | ||
507 | { | ||
508 | struct list_head *tmp, *n; | ||
509 | struct slot *slot; | ||
510 | |||
511 | list_for_each_safe(tmp, n, &rpaphp_slot_head) { | ||
512 | struct pci_bus *bus; | ||
513 | struct list_head *ln; | ||
514 | |||
515 | slot = list_entry(tmp, struct slot, rpaphp_slot_list); | ||
516 | if (slot->bridge == NULL) { | ||
517 | if (slot->dev_type == PCI_DEV) { | ||
518 | printk(KERN_WARNING "PCI slot missing bridge %s %s \n", | ||
519 | slot->name, slot->location); | ||
520 | } | ||
521 | continue; | ||
522 | } | ||
523 | |||
524 | bus = slot->bridge->subordinate; | ||
525 | if (!bus) { | ||
526 | continue; /* should never happen? */ | ||
527 | } | ||
528 | for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { | ||
529 | struct pci_dev *pdev = pci_dev_b(ln); | ||
530 | if (pdev == dev) | ||
531 | return slot->hotplug_slot; | ||
532 | } | ||
533 | } | ||
534 | |||
535 | return NULL; | ||
536 | } | ||
537 | |||
538 | EXPORT_SYMBOL_GPL(rpaphp_find_hotplug_slot); | ||