aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/prom_parse.c22
-rw-r--r--include/asm-powerpc/prom.h6
2 files changed, 28 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}
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 97ef1cd71a4d..c79d58ab7441 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -230,6 +230,12 @@ extern int of_address_to_resource(struct device_node *dev, int index,
230extern int of_pci_address_to_resource(struct device_node *dev, int bar, 230extern int of_pci_address_to_resource(struct device_node *dev, int bar,
231 struct resource *r); 231 struct resource *r);
232 232
233/* Parse the ibm,dma-window property of an OF node into the busno, phys and
234 * size parameters.
235 */
236void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
237 unsigned long *busno, unsigned long *phys, unsigned long *size);
238
233extern void kdump_move_device_tree(void); 239extern void kdump_move_device_tree(void);
234 240
235#endif /* __KERNEL__ */ 241#endif /* __KERNEL__ */