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.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 1d5d4f6dfef..1dac535de78 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -6,6 +6,7 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/ioport.h> 7#include <linux/ioport.h>
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/of_address.h>
9#include <asm/prom.h> 10#include <asm/prom.h>
10#include <asm/pci-bridge.h> 11#include <asm/pci-bridge.h>
11 12
@@ -27,10 +28,6 @@
27 (ns) > 0) 28 (ns) > 0)
28 29
29static struct of_bus *of_match_bus(struct device_node *np); 30static struct of_bus *of_match_bus(struct device_node *np);
30static int __of_address_to_resource(struct device_node *dev,
31 const u32 *addrp, u64 size, unsigned int flags,
32 struct resource *r);
33
34 31
35/* Debug utility */ 32/* Debug utility */
36#ifdef DEBUG 33#ifdef DEBUG
@@ -610,48 +607,6 @@ const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
610} 607}
611EXPORT_SYMBOL(of_get_address); 608EXPORT_SYMBOL(of_get_address);
612 609
613static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
614 u64 size, unsigned int flags,
615 struct resource *r)
616{
617 u64 taddr;
618
619 if ((flags & (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
620 return -EINVAL;
621 taddr = of_translate_address(dev, addrp);
622 if (taddr == OF_BAD_ADDR)
623 return -EINVAL;
624 memset(r, 0, sizeof(struct resource));
625 if (flags & IORESOURCE_IO) {
626 unsigned long port;
627 port = pci_address_to_pio(taddr);
628 if (port == (unsigned long)-1)
629 return -EINVAL;
630 r->start = port;
631 r->end = port + size - 1;
632 } else {
633 r->start = taddr;
634 r->end = taddr + size - 1;
635 }
636 r->flags = flags;
637 r->name = dev->name;
638 return 0;
639}
640
641int of_address_to_resource(struct device_node *dev, int index,
642 struct resource *r)
643{
644 const u32 *addrp;
645 u64 size;
646 unsigned int flags;
647
648 addrp = of_get_address(dev, index, &size, &flags);
649 if (addrp == NULL)
650 return -EINVAL;
651 return __of_address_to_resource(dev, addrp, size, flags, r);
652}
653EXPORT_SYMBOL_GPL(of_address_to_resource);
654
655void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 610void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
656 unsigned long *busno, unsigned long *phys, unsigned long *size) 611 unsigned long *busno, unsigned long *phys, unsigned long *size)
657{ 612{