mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-26 11:28:28 +00:00
9fffb55f66
The powerpc kernel always requires an Open Firmware like device tree to supply device information. On systems without OF, this comes from a flattened device tree blob. This blob is usually generated by dtc, a tool which compiles a text description of the device tree into the flattened format used by the kernel. Sometimes, the bootwrapper makes small changes to the pre-compiled device tree blob (e.g. filling in the size of RAM). To do this it uses the libfdt library. Because these are only used on powerpc, the code for both these tools is included under arch/powerpc/boot (these were imported and are periodically updated from the upstream dtc tree). However, the microblaze architecture, currently being prepared for merging to mainline also uses dtc to produce device tree blobs. A few other archs have also mentioned some interest in using dtc. Therefore, this patch moves dtc and libfdt from arch/powerpc into scripts, where it can be used by any architecture. The vast bulk of this patch is a literal move, the rest is adjusting the various Makefiles to use dtc and libfdt correctly from their new locations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24 lines
574 B
C
24 lines
574 B
C
#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 */
|