aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-05-18 04:05:15 -0400
committerPaul Mackerras <paulus@samba.org>2006-05-19 01:02:21 -0400
commitd4ad66faecc4dd9f3db14e0b013741a6f867b089 (patch)
tree002f68be37820100103202270f07e5d6a6fb840f /arch/powerpc/kernel
parent8ae5b2801a0beb10a55a7ebd5140482e2f84c3fa (diff)
[PATCH] powerpc: Add of_parse_dma_window()
Add a function for generic parsing of dma-window properties (ie, ibm,dma-window and ibm,my-dma-window) of pci and virtual device nodes. This function will also be used by cell. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/prom_parse.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 3934c227549b..23bb060330ef 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -548,3 +548,25 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
548 return __of_address_to_resource(dev, addrp, size, flags, r); 548 return __of_address_to_resource(dev, addrp, size, flags, r);
549} 549}
550EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 550EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
551
552void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
553 unsigned long *busno, unsigned long *phys, unsigned long *size)
554{
555 u32 *dma_window, cells;
556 unsigned char *prop;
557
558 dma_window = (u32 *)dma_window_prop;
559
560 /* busno is always one cell */
561 *busno = *(dma_window++);
562
563 prop = get_property(dn, "ibm,#dma-address-cells", NULL);
564 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn);
565 *phys = of_read_addr(dma_window, cells);
566
567 dma_window += cells;
568
569 prop = get_property(dn, "ibm,#dma-size-cells", NULL);
570 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn);
571 *size = of_read_addr(dma_window, cells);
572}