blob: cdfd23992841a78bfd3692a10d3ba0ea77158565 [file] [log] [blame]
Robert Reifc9f5b7e2009-06-04 02:00:02 -07001#ifndef _OF_DEVICE_COMMON_H
2#define _OF_DEVICE_COMMON_H
3
4static inline u64 of_read_addr(const u32 *cell, int size)
5{
6 u64 r = 0;
7 while (size--)
8 r = (r << 32) | *(cell++);
9 return r;
10}
11
12void of_bus_default_count_cells(struct device_node *dev, int *addrc,
13 int *sizec);
14int of_out_of_range(const u32 *addr, const u32 *base,
15 const u32 *size, int na, int ns);
16int of_bus_default_map(u32 *addr, const u32 *range, int na, int ns, int pna);
17unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags);
18
19int of_bus_sbus_match(struct device_node *np);
20void of_bus_sbus_count_cells(struct device_node *child, int *addrc, int *sizec);
21
22/* Max address size we deal with */
23#define OF_MAX_ADDR_CELLS 4
24
25struct of_bus {
26 const char *name;
27 const char *addr_prop_name;
28 int (*match)(struct device_node *parent);
29 void (*count_cells)(struct device_node *child,
30 int *addrc, int *sizec);
31 int (*map)(u32 *addr, const u32 *range,
32 int na, int ns, int pna);
33 unsigned long (*get_flags)(const u32 *addr, unsigned long);
34};
35
36#endif /* _OF_DEVICE_COMMON_H */