xhci: Solve full event ring by increasing TRBS_PER_SEGMENT to 256
[linux-2.6/btrfs-unstable.git] / arch / powerpc / kernel / pci-hotplug.c
blob7ed85a69a9c29b956d232596ba089cf610e9e1d2
1 /*
2 * Derived from "arch/powerpc/platforms/pseries/pci_dlpar.c"
4 * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
5 * Copyright (C) 2005 International Business Machines
7 * Updates, 2005, John Rose <johnrose@austin.ibm.com>
8 * Updates, 2005, Linas Vepstas <linas@austin.ibm.com>
9 * Updates, 2013, Gavin Shan <shangw@linux.vnet.ibm.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
17 #include <linux/pci.h>
18 #include <linux/export.h>
19 #include <asm/pci-bridge.h>
20 #include <asm/ppc-pci.h>
21 #include <asm/firmware.h>
22 #include <asm/eeh.h>
24 /**
25 * pcibios_release_device - release PCI device
26 * @dev: PCI device
28 * The function is called before releasing the indicated PCI device.
30 void pcibios_release_device(struct pci_dev *dev)
32 eeh_remove_device(dev);
35 /**
36 * pcibios_remove_pci_devices - remove all devices under this bus
37 * @bus: the indicated PCI bus
39 * Remove all of the PCI devices under this bus both from the
40 * linux pci device tree, and from the powerpc EEH address cache.
42 void pcibios_remove_pci_devices(struct pci_bus *bus)
44 struct pci_dev *dev, *tmp;
45 struct pci_bus *child_bus;
47 /* First go down child busses */
48 list_for_each_entry(child_bus, &bus->children, node)
49 pcibios_remove_pci_devices(child_bus);
51 pr_debug("PCI: Removing devices on bus %04x:%02x\n",
52 pci_domain_nr(bus), bus->number);
53 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
54 pr_debug(" Removing %s...\n", pci_name(dev));
55 pci_stop_and_remove_bus_device(dev);
59 EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
61 /**
62 * pcibios_add_pci_devices - adds new pci devices to bus
63 * @bus: the indicated PCI bus
65 * This routine will find and fixup new pci devices under
66 * the indicated bus. This routine presumes that there
67 * might already be some devices under this bridge, so
68 * it carefully tries to add only new devices. (And that
69 * is how this routine differs from other, similar pcibios
70 * routines.)
72 void pcibios_add_pci_devices(struct pci_bus * bus)
74 int slotno, mode, pass, max;
75 struct pci_dev *dev;
76 struct pci_controller *phb;
77 struct device_node *dn = pci_bus_to_OF_node(bus);
79 eeh_add_device_tree_early(PCI_DN(dn));
81 phb = pci_bus_to_host(bus);
83 mode = PCI_PROBE_NORMAL;
84 if (phb->controller_ops.probe_mode)
85 mode = phb->controller_ops.probe_mode(bus);
87 if (mode == PCI_PROBE_DEVTREE) {
88 /* use ofdt-based probe */
89 of_rescan_bus(dn, bus);
90 } else if (mode == PCI_PROBE_NORMAL) {
92 * Use legacy probe. In the partial hotplug case, we
93 * probably have grandchildren devices unplugged. So
94 * we don't check the return value from pci_scan_slot() in
95 * order for fully rescan all the way down to pick them up.
96 * They can have been removed during partial hotplug.
98 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
99 pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
100 pcibios_setup_bus_devices(bus);
101 max = bus->busn_res.start;
102 for (pass = 0; pass < 2; pass++) {
103 list_for_each_entry(dev, &bus->devices, bus_list) {
104 if (pci_is_bridge(dev))
105 max = pci_scan_bridge(bus, dev,
106 max, pass);
110 pcibios_finish_adding_to_bus(bus);
112 EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);