diff options
author | Simon Horman <horms@verge.net.au> | 2012-09-07 10:11:20 +0100 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2012-09-12 09:32:34 +0900 |
commit | 8ad82718b3eb659057064e46f20eab524b2e54f5 (patch) | |
tree | 0ec70255fd8fefe77a008b8ab5913c0e882761ef /kexec/libfdt/libfdt_env.h | |
parent | eaa2b2dd56a5c455038ea131e52cecf360df343e (diff) |
libfdt: Move from kexec/arch/ppc/libfdt/ to kexec/libfdt/
This is in preparation for using the code on ARM as well as PPC.
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/libfdt/libfdt_env.h')
-rw-r--r-- | kexec/libfdt/libfdt_env.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kexec/libfdt/libfdt_env.h b/kexec/libfdt/libfdt_env.h new file mode 100644 index 0000000..449bf60 --- /dev/null +++ b/kexec/libfdt/libfdt_env.h @@ -0,0 +1,23 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include <stddef.h> +#include <stdint.h> +#include <string.h> + +#define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) +static inline uint32_t fdt32_to_cpu(uint32_t x) +{ + return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3); +} +#define cpu_to_fdt32(x) fdt32_to_cpu(x) + +static inline uint64_t fdt64_to_cpu(uint64_t x) +{ + return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32) + | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7); +} +#define cpu_to_fdt64(x) fdt64_to_cpu(x) +#undef _B + +#endif /* _LIBFDT_ENV_H */ |