diff options
Diffstat (limited to 'arch/powerpc/kernel/prom_parse.c')
-rw-r--r-- | arch/powerpc/kernel/prom_parse.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 3934c227549..45df420383c 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -548,3 +548,28 @@ 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 | } |
550 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); | 550 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); |
551 | |||
552 | void 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 | if (!prop) | ||
565 | prop = get_property(dn, "#address-cells", NULL); | ||
566 | |||
567 | cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn); | ||
568 | *phys = of_read_addr(dma_window, cells); | ||
569 | |||
570 | dma_window += cells; | ||
571 | |||
572 | prop = get_property(dn, "ibm,#dma-size-cells", NULL); | ||
573 | cells = prop ? *(u32 *)prop : prom_n_size_cells(dn); | ||
574 | *size = of_read_addr(dma_window, cells); | ||
575 | } | ||