From 6fb4efc68f5c0e095153510dcfa8b54a42e914ba Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Mon, 16 Oct 2006 13:50:05 -0700 Subject: [POWERPC] Add flatdevtree source Add the latest version of the flatdevtree code and corresponding glue. A phandle table now tracks values returned by ft_find_device(). The value returned by ft_find_device() is a phandle which is really an index into the phandle table. The phandle table contains the address of the corresponding node. When the flat dt is edited/moved, the node pointers in the phandle table are updated accordingly so no phandles kept by the caller become stale. Signed-off-by: Mark A. Greer Signed-off-by: Paul Mackerras --- arch/powerpc/boot/flatdevtree_env.h | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 arch/powerpc/boot/flatdevtree_env.h (limited to 'arch/powerpc/boot/flatdevtree_env.h') diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h new file mode 100644 index 00000000000..83bc1c71883 --- /dev/null +++ b/arch/powerpc/boot/flatdevtree_env.h @@ -0,0 +1,47 @@ +/* + * This file adds the header file glue so that the shared files + * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper. + * + * strncmp & strchr copied from + * Copyright (C) 1991, 1992 Linus Torvalds + * + * Maintained by: Mark A. Greer + */ +#ifndef _PPC_BOOT_FLATDEVTREE_ENV_H_ +#define _PPC_BOOT_FLATDEVTREE_ENV_H_ + +#include +#include +#include "types.h" +#include "string.h" +#include "stdio.h" +#include "ops.h" + +#define be16_to_cpu(x) (x) +#define cpu_to_be16(x) (x) +#define be32_to_cpu(x) (x) +#define cpu_to_be32(x) (x) +#define be64_to_cpu(x) (x) +#define cpu_to_be64(x) (x) + +static inline int strncmp(const char *cs, const char *ct, size_t count) +{ + signed char __res = 0; + + while (count) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + count--; + } + return __res; +} + +static inline char *strchr(const char *s, int c) +{ + for (; *s != (char)c; ++s) + if (*s == '\0') + return NULL; + return (char *)s; +} + +#endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */ -- cgit v1.2.3