]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/powerpc/kernel/prom_parse.c
Merge branch 'for-2.6.39' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[mirror_ubuntu-bionic-kernel.git] / arch / powerpc / kernel / prom_parse.c
CommitLineData
d1405b86
BH
1#undef DEBUG
2
3#include <linux/kernel.h>
4#include <linux/string.h>
d1405b86 5#include <linux/module.h>
d2dd482b 6#include <linux/ioport.h>
29cfe6f4 7#include <linux/etherdevice.h>
1f5bef30 8#include <linux/of_address.h>
d1405b86 9#include <asm/prom.h>
83efafb3 10
a7f67bdf 11void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
d4ad66fa
JK
12 unsigned long *busno, unsigned long *phys, unsigned long *size)
13{
a7f67bdf
JK
14 const u32 *dma_window;
15 u32 cells;
16 const unsigned char *prop;
d4ad66fa 17
a7f67bdf 18 dma_window = dma_window_prop;
d4ad66fa
JK
19
20 /* busno is always one cell */
21 *busno = *(dma_window++);
22
e2eb6392 23 prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
03ac829b 24 if (!prop)
e2eb6392 25 prop = of_get_property(dn, "#address-cells", NULL);
03ac829b 26
a8bda5dd 27 cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);
cc9fd71c 28 *phys = of_read_number(dma_window, cells);
d4ad66fa
JK
29
30 dma_window += cells;
31
e2eb6392 32 prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
9213feea 33 cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
cc9fd71c
BH
34 *size = of_read_number(dma_window, cells);
35}