0001
0002 #undef DEBUG
0003
0004 #include <linux/kernel.h>
0005 #include <linux/string.h>
0006 #include <linux/ioport.h>
0007 #include <linux/etherdevice.h>
0008 #include <linux/of_address.h>
0009 #include <asm/prom.h>
0010
0011 void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
0012 unsigned long *busno, unsigned long *phys,
0013 unsigned long *size)
0014 {
0015 u32 cells;
0016 const __be32 *prop;
0017
0018
0019 *busno = of_read_number(dma_window, 1);
0020 dma_window++;
0021
0022 prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
0023 if (!prop)
0024 prop = of_get_property(dn, "#address-cells", NULL);
0025
0026 cells = prop ? of_read_number(prop, 1) : of_n_addr_cells(dn);
0027 *phys = of_read_number(dma_window, cells);
0028
0029 dma_window += cells;
0030
0031 prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
0032 cells = prop ? of_read_number(prop, 1) : of_n_size_cells(dn);
0033 *size = of_read_number(dma_window, cells);
0034 }