aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/of_device_common.h
diff options
context:
space:
mode:
authorRobert Reif <reif@earthlink.net>2009-06-04 05:00:02 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-16 07:56:49 -0400
commitc9f5b7e77c30da25104a3f7f26ac46c07d7b5cb6 (patch)
treee209e70377b4fbaf95168366430884b3b2474d2e /arch/sparc/kernel/of_device_common.h
parentd69864158e24f323e818403c6b89ad4871aea6f6 (diff)
sparc: move of_device common code to of_device_common
This patch moves code common to of_device_32.c and of_device_64.c into of_device_common.h and of_device_common.c. The only functional difference is in sparc32 where of_bus_default_map is used in place of of_bus_sbus_map because they are equivelent. There is still room for further code consolidation with some minor refactoring. Boot tested on sparc32 and compile tested on sparc64. Signed-off-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/of_device_common.h')
-rw-r--r--arch/sparc/kernel/of_device_common.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/sparc/kernel/of_device_common.h b/arch/sparc/kernel/of_device_common.h
new file mode 100644
index 000000000000..cdfd23992841
--- /dev/null
+++ b/arch/sparc/kernel/of_device_common.h
@@ -0,0 +1,36 @@
1#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 */