Path: blob/master/arch/microblaze/kernel/prom_parse.c
10817 views
#undef DEBUG12#include <linux/kernel.h>3#include <linux/string.h>4#include <linux/module.h>5#include <linux/ioport.h>6#include <linux/etherdevice.h>7#include <linux/of_address.h>8#include <asm/prom.h>910void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,11unsigned long *busno, unsigned long *phys, unsigned long *size)12{13const u32 *dma_window;14u32 cells;15const unsigned char *prop;1617dma_window = dma_window_prop;1819/* busno is always one cell */20*busno = *(dma_window++);2122prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);23if (!prop)24prop = of_get_property(dn, "#address-cells", NULL);2526cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);27*phys = of_read_number(dma_window, cells);2829dma_window += cells;3031prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);32cells = prop ? *(u32 *)prop : of_n_size_cells(dn);33*size = of_read_number(dma_window, cells);34}353637