diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-03-22 17:02:21 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-13 03:55:14 +1000 |
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 592dc6c20bd..cc191e8e147 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, { return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; } +#define setprop_val(devp, name, val) \ + do { \ + typeof(val) x = (val); \ + setprop((devp), (name), &x, sizeof(x)); \ + } while (0) static inline int setprop_str(void *devp, const char *name, const char *buf) { @@ -141,6 +146,14 @@ static inline void *find_node_by_devtype(const void *prev, return find_node_by_prop_value_str(prev, "device_type", type); } +void dt_fixup_memory(u64 start, u64 size); +void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq); +void dt_fixup_clock(const char *path, u32 freq); +void __dt_fixup_mac_addresses(u32 startindex, ...); +#define dt_fixup_mac_addresses(...) \ + __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL) + + static inline void *malloc(u32 size) { return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; |