Skip to contentSkip to conversation

libfdt: Import libfdt source (1 of 2)

PATCH New Jerry Van Baren 1 participant 1 message Mar 31, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 libfdt: Import libfdt source (1 of 2)

This adds the applicable libfdt source files (unmodified) and a README to explain where the source came from.

---
 include/fdt.h            |   60 ++++++++++++++++++++
 include/libfdt.h         |  135 ++++++++++++++++++++++++++++++++++++++++++++++
 include/libfdt_env.h     |   22 ++++++++
 libfdt/Makefile          |   88 ++++++++++++++++++++++++++++++
 libfdt/README            |   23 ++++++++
 libfdt/fdt.c             |  124 ++++++++++++++++++++++++++++++++++++++++++
 libfdt/fdt_strerror.c    |   64 ++++++++++++++++++++++
 libfdt/libfdt_internal.h |   41 ++++++++++++++
 8 files changed, 557 insertions(+), 0 deletions(-)
include/fdt.h new file +60 -0
new file mode 100644
index 0000000..e00559a
@@ -0,0 +1,60 @@
+#ifndef _FDT_H
+#define _FDT_H
+
+#ifndef __ASSEMBLY__
+
+struct fdt_header {
+	uint32_t magic;                  /* magic word FDT_MAGIC */
+	uint32_t totalsize;              /* total size of DT block */
+	uint32_t off_dt_struct;          /* offset to structure */
+	uint32_t off_dt_strings;         /* offset to strings */
+	uint32_t off_mem_rsvmap;         /* offset to memory reserve map */
+	uint32_t version;                /* format version */
+	uint32_t last_comp_version;      /* last compatible version */
+
+        /* version 2 fields below */
+	uint32_t boot_cpuid_phys;        /* Which physical CPU id we're
+					    booting on */
+	/* version 3 fields below */
+        uint32_t size_dt_strings;        /* size of the strings block */
+
+	/* version 17 fields below */
+	uint32_t size_dt_struct;         /* size of the structure block */
+};
+
+struct fdt_reserve_entry {
+	uint64_t address;
+	uint64_t size;
+};
+
+struct fdt_node_header {
+	uint32_t tag;
+	char name[0];
+};
+
+struct fdt_property {
+	uint32_t tag;
+	uint32_t len;
+	uint32_t nameoff;
+	char data[0];
+};
+
+#endif /* !__ASSEMBLY */
+
+#define FDT_MAGIC	0xd00dfeed      /* 4: version, 4: total size */
+#define FDT_TAGSIZE	sizeof(uint32_t)
+
+#define FDT_BEGIN_NODE	0x1             /* Start node: full name */
+#define FDT_END_NODE	0x2             /* End node */
+#define FDT_PROP	0x3             /* Property: name off,
+					   size, content */
+#define FDT_NOP		0x4		/* nop */
+#define FDT_END		0x9
+
+#define FDT_V1_SIZE	(7*sizeof(uint32_t))
+#define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(uint32_t))
+#define FDT_V3_SIZE	(FDT_V2_SIZE + sizeof(uint32_t))
+#define FDT_V16_SIZE	FDT_V3_SIZE
+#define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
+
+#endif /* _FDT_H */
include/libfdt.h new file +135 -0

135 lines not on this page · raw message

include/libfdt_env.h new file +22 -0
new file mode 100644
index 0000000..59f2536
@@ -0,0 +1,22 @@
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <endian.h>
+#include <byteswap.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define fdt32_to_cpu(x)		(x)
+#define cpu_to_fdt32(x)		(x)
+#define fdt64_to_cpu(x)		(x)
+#define cpu_to_fdt64(x)		(x)
+#else
+#define fdt32_to_cpu(x)		(bswap_32((x)))
+#define cpu_to_fdt32(x)		(bswap_32((x)))
+#define fdt64_to_cpu(x)		(bswap_64((x)))
+#define cpu_to_fdt64(x)		(bswap_64((x)))
+#endif
+
+#endif /* _LIBFDT_ENV_H */
libfdt/Makefile new file +88 -0

88 lines not on this page · raw message

libfdt/README new file +23 -0
new file mode 100644
index 0000000..f4cca34
@@ -0,0 +1,23 @@
+The libfdt functionality was written by David Gibson.  The original
+source came from the git repository:
+
+URL: 		git://ozlabs.org/home/dgibson/git/libfdt.git
+
+author		David Gibson <dgibson@sneetch.(none)>
+		Fri, 23 Mar 2007 04:16:54 +0000 (15:16 +1100)
+committer	David Gibson <dgibson@sneetch.(none)>
+	 	Fri, 23 Mar 2007 04:16:54 +0000 (15:16 +1100)
+commit		857f54e79f74429af20c2b5ecc00ee98af6a3b8b
+tree		2f648f0f88225a51ded452968d28b4402df8ade0
+parent		07a12a08005f3b5cd9337900a6551e450c07b515
+
+To adapt for u-boot usage, only the applicable files were copied and
+imported into the u-boot git repository.
+Omitted:
+* GPL - u-boot comes with a copy of the GPL license
+* test subdirectory - not directly useful for u-boot
+
+After importing, other customizations were performed.  See the git log
+for details.
+
+Jerry Van Baren
libfdt/fdt.c new file +124 -0

124 lines not on this page · raw message

libfdt/fdt_strerror.c new file +64 -0

64 lines not on this page · raw message

libfdt/libfdt_internal.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.4.4.4