diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-03-22 02:02:21 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-12 13:55:14 -0400 |
commit | 27fbaa9702e548e74dffd21855769f6cedad42bd (patch) | |
tree | 2af4decec01306e34031e2a62a3932991b899fbc /arch/powerpc/boot/ops.h | |
parent | 3467bfd340f9ad48f3732415533a2e9c18240b62 (diff) |
[POWERPC] Add device tree utility functions to zImage
This patch adds a library of useful device tree manipulation functions
to the zImage library, for use by platform code. These functions are
based on the hooks already in dt_ops, so they're not dependent on a
particular device tree implementation. This patch also slightly
streamlines the code in main.c using these new functions.
This is a consolidation of my work in this area with Scott Wood's
patches to a very similar end.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/ops.h')
-rw-r--r-- | arch/powerpc/boot/ops.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h index 592dc6c20bdb..cc191e8e147f 100644 --- a/arch/powerpc/boot/ops.h +++ b/arch/powerpc/boot/ops.h | |||
@@ -96,6 +96,11 @@ static inline int setprop(void *devp, const char *name, | |||
96 | { | 96 | { |
97 | return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; | 97 | return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; |
98 | } | 98 | } |
99 | #define setprop_val(devp, name, val) \ | ||
100 | do { \ | ||
101 | typeof(val) x = (val); \ | ||
102 | setprop((devp), (name), &x, sizeof(x)); \ | ||
103 | } while (0) | ||
99 | 104 | ||
100 | static inline int setprop_str(void *devp, const char *name, const char *buf) | 105 | static inline int setprop_str(void *devp, const char *name, const char *buf) |
101 | { | 106 | { |
@@ -141,6 +146,14 @@ static inline void *find_node_by_devtype(const void *prev, | |||
141 | return find_node_by_prop_value_str(prev, "device_type", type); | 146 | return find_node_by_prop_value_str(prev, "device_type", type); |
142 | } | 147 | } |
143 | 148 | ||
149 | void dt_fixup_memory(u64 start, u64 size); | ||
150 | void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq); | ||
151 | void dt_fixup_clock(const char *path, u32 freq); | ||
152 | void __dt_fixup_mac_addresses(u32 startindex, ...); | ||
153 | #define dt_fixup_mac_addresses(...) \ | ||
154 | __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL) | ||
155 | |||
156 | |||
144 | static inline void *malloc(u32 size) | 157 | static inline void *malloc(u32 size) |
145 | { | 158 | { |
146 | return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; | 159 | return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; |