aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/prom_parse.c')
-rw-r--r--arch/powerpc/kernel/prom_parse.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index b5c96af955c6..90eb3a3e383e 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -273,7 +273,7 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
273#else 273#else
274 struct pci_controller *host; 274 struct pci_controller *host;
275 host = pci_bus_to_host(pdev->bus); 275 host = pci_bus_to_host(pdev->bus);
276 ppnode = host ? host->arch_data : NULL; 276 ppnode = host ? host->dn : NULL;
277#endif 277#endif
278 /* No node for host bridge ? give up */ 278 /* No node for host bridge ? give up */
279 if (ppnode == NULL) 279 if (ppnode == NULL)
@@ -419,7 +419,7 @@ static struct of_bus *of_match_bus(struct device_node *np)
419 419
420static int of_translate_one(struct device_node *parent, struct of_bus *bus, 420static int of_translate_one(struct device_node *parent, struct of_bus *bus,
421 struct of_bus *pbus, u32 *addr, 421 struct of_bus *pbus, u32 *addr,
422 int na, int ns, int pna) 422 int na, int ns, int pna, const char *rprop)
423{ 423{
424 const u32 *ranges; 424 const u32 *ranges;
425 unsigned int rlen; 425 unsigned int rlen;
@@ -438,7 +438,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
438 * to translate addresses that aren't supposed to be translated in 438 * to translate addresses that aren't supposed to be translated in
439 * the first place. --BenH. 439 * the first place. --BenH.
440 */ 440 */
441 ranges = of_get_property(parent, "ranges", &rlen); 441 ranges = of_get_property(parent, rprop, &rlen);
442 if (ranges == NULL || rlen == 0) { 442 if (ranges == NULL || rlen == 0) {
443 offset = of_read_number(addr, na); 443 offset = of_read_number(addr, na);
444 memset(addr, 0, pna * 4); 444 memset(addr, 0, pna * 4);
@@ -481,7 +481,8 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
481 * that can be mapped to a cpu physical address). This is not really specified 481 * that can be mapped to a cpu physical address). This is not really specified
482 * that way, but this is traditionally the way IBM at least do things 482 * that way, but this is traditionally the way IBM at least do things
483 */ 483 */
484u64 of_translate_address(struct device_node *dev, const u32 *in_addr) 484u64 __of_translate_address(struct device_node *dev, const u32 *in_addr,
485 const char *rprop)
485{ 486{
486 struct device_node *parent = NULL; 487 struct device_node *parent = NULL;
487 struct of_bus *bus, *pbus; 488 struct of_bus *bus, *pbus;
@@ -540,7 +541,7 @@ u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
540 pbus->name, pna, pns, parent->full_name); 541 pbus->name, pna, pns, parent->full_name);
541 542
542 /* Apply bus translation */ 543 /* Apply bus translation */
543 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna)) 544 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
544 break; 545 break;
545 546
546 /* Complete the move up one level */ 547 /* Complete the move up one level */
@@ -556,8 +557,19 @@ u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
556 557
557 return result; 558 return result;
558} 559}
560
561u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
562{
563 return __of_translate_address(dev, in_addr, "ranges");
564}
559EXPORT_SYMBOL(of_translate_address); 565EXPORT_SYMBOL(of_translate_address);
560 566
567u64 of_translate_dma_address(struct device_node *dev, const u32 *in_addr)
568{
569 return __of_translate_address(dev, in_addr, "dma-ranges");
570}
571EXPORT_SYMBOL(of_translate_dma_address);
572
561const u32 *of_get_address(struct device_node *dev, int index, u64 *size, 573const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
562 unsigned int *flags) 574 unsigned int *flags)
563{ 575{