Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~keithp/linux
[linux-btrfs-devel.git] / arch / microblaze / kernel / prom_parse.c
blob47187cc2cf008c38e14c09667a7fff7b436d5dee
1 #undef DEBUG
3 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <linux/module.h>
6 #include <linux/ioport.h>
7 #include <linux/etherdevice.h>
8 #include <linux/of_address.h>
9 #include <asm/prom.h>
11 void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
12 unsigned long *busno, unsigned long *phys, unsigned long *size)
14 const u32 *dma_window;
15 u32 cells;
16 const unsigned char *prop;
18 dma_window = dma_window_prop;
20 /* busno is always one cell */
21 *busno = *(dma_window++);
23 prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
24 if (!prop)
25 prop = of_get_property(dn, "#address-cells", NULL);
27 cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);
28 *phys = of_read_number(dma_window, cells);
30 dma_window += cells;
32 prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
33 cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
34 *size = of_read_number(dma_window, cells);