1 #ifndef _OF_DEVICE_COMMON_H
2 #define _OF_DEVICE_COMMON_H
3 
4 static 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 
12 void of_bus_default_count_cells(struct device_node *dev, int *addrc,
13 				int *sizec);
14 int of_out_of_range(const u32 *addr, const u32 *base,
15 		    const u32 *size, int na, int ns);
16 int of_bus_default_map(u32 *addr, const u32 *range, int na, int ns, int pna);
17 unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags);
18 
19 int of_bus_sbus_match(struct device_node *np);
20 void 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 
25 struct 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 */
37