diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 17:54:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 17:54:02 -0400 |
commit | acb41c0f928fdb84a1c3753ac92c534a2a0f08d2 (patch) | |
tree | 4bf92f1c2b1f36fa68d3e77d646b04b863e1a7e4 /arch/x86/kernel/devicetree.c | |
parent | 8181780c163e7111f15619067cfa044172d532e1 (diff) | |
parent | ef3b4f8cc20e80c767e47b848fb7512770ab80d7 (diff) |
Merge branch 'of-pci' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'of-pci' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
pci/of: Consolidate pci_bus_to_OF_node()
pci/of: Consolidate pci_device_to_OF_node()
x86/devicetree: Use generic PCI <-> OF matching
microblaze/pci: Move the remains of pci_32.c to pci-common.c
microblaze/pci: Remove powermac originated cruft
pci/of: Match PCI devices to OF nodes dynamically
Diffstat (limited to 'arch/x86/kernel/devicetree.c')
-rw-r--r-- | arch/x86/kernel/devicetree.c | 60 |
1 files changed, 18 insertions, 42 deletions
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 9aeb78a23de4..a621f3427685 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c | |||
@@ -134,6 +134,24 @@ static int __init add_bus_probe(void) | |||
134 | module_init(add_bus_probe); | 134 | module_init(add_bus_probe); |
135 | 135 | ||
136 | #ifdef CONFIG_PCI | 136 | #ifdef CONFIG_PCI |
137 | struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) | ||
138 | { | ||
139 | struct device_node *np; | ||
140 | |||
141 | for_each_node_by_type(np, "pci") { | ||
142 | const void *prop; | ||
143 | unsigned int bus_min; | ||
144 | |||
145 | prop = of_get_property(np, "bus-range", NULL); | ||
146 | if (!prop) | ||
147 | continue; | ||
148 | bus_min = be32_to_cpup(prop); | ||
149 | if (bus->number == bus_min) | ||
150 | return np; | ||
151 | } | ||
152 | return NULL; | ||
153 | } | ||
154 | |||
137 | static int x86_of_pci_irq_enable(struct pci_dev *dev) | 155 | static int x86_of_pci_irq_enable(struct pci_dev *dev) |
138 | { | 156 | { |
139 | struct of_irq oirq; | 157 | struct of_irq oirq; |
@@ -165,50 +183,8 @@ static void x86_of_pci_irq_disable(struct pci_dev *dev) | |||
165 | 183 | ||
166 | void __cpuinit x86_of_pci_init(void) | 184 | void __cpuinit x86_of_pci_init(void) |
167 | { | 185 | { |
168 | struct device_node *np; | ||
169 | |||
170 | pcibios_enable_irq = x86_of_pci_irq_enable; | 186 | pcibios_enable_irq = x86_of_pci_irq_enable; |
171 | pcibios_disable_irq = x86_of_pci_irq_disable; | 187 | pcibios_disable_irq = x86_of_pci_irq_disable; |
172 | |||
173 | for_each_node_by_type(np, "pci") { | ||
174 | const void *prop; | ||
175 | struct pci_bus *bus; | ||
176 | unsigned int bus_min; | ||
177 | struct device_node *child; | ||
178 | |||
179 | prop = of_get_property(np, "bus-range", NULL); | ||
180 | if (!prop) | ||
181 | continue; | ||
182 | bus_min = be32_to_cpup(prop); | ||
183 | |||
184 | bus = pci_find_bus(0, bus_min); | ||
185 | if (!bus) { | ||
186 | printk(KERN_ERR "Can't find a node for bus %s.\n", | ||
187 | np->full_name); | ||
188 | continue; | ||
189 | } | ||
190 | |||
191 | if (bus->self) | ||
192 | bus->self->dev.of_node = np; | ||
193 | else | ||
194 | bus->dev.of_node = np; | ||
195 | |||
196 | for_each_child_of_node(np, child) { | ||
197 | struct pci_dev *dev; | ||
198 | u32 devfn; | ||
199 | |||
200 | prop = of_get_property(child, "reg", NULL); | ||
201 | if (!prop) | ||
202 | continue; | ||
203 | |||
204 | devfn = (be32_to_cpup(prop) >> 8) & 0xff; | ||
205 | dev = pci_get_slot(bus, devfn); | ||
206 | if (!dev) | ||
207 | continue; | ||
208 | dev->dev.of_node = child; | ||
209 | pci_dev_put(dev); | ||
210 | } | ||
211 | } | ||
212 | } | 188 | } |
213 | #endif | 189 | #endif |
214 | 190 | ||