103
103
-FTDUMP_OBJS = $(FTDUMP_SRCS:%.c=%.o)
104
104
+FDTDUMP_OBJS = $(FDTDUMP_SRCS:%.c=%.o)
105
diff --git a/ftdump.c b/fdtdump.c
109
index cc55fe2..207a46d 100644
105
Index: device-tree-compiler-1.3.0/ftdump.c
106
===================================================================
107
--- device-tree-compiler-1.3.0.orig/ftdump.c 2012-01-30 15:03:30.059993370 +0100
108
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
114
111
- * ftdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
121
-#include <libfdt_env.h>
125
-#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
126
-#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
127
-#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
129
-static void print_data(const char *data, int len)
132
- const char *p = data;
134
- /* no data, don't print */
138
- if (util_is_printable_string(data, len)) {
139
- printf(" = \"%s\"", (const char *)data);
140
- } else if ((len % 4) == 0) {
142
- for (i = 0; i < len; i += 4)
143
- printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
144
- i < (len - 4) ? " " : "");
148
- for (i = 0; i < len; i++)
149
- printf("%02x%s", *p++, i < len - 1 ? " " : "");
154
-static void dump_blob(void *blob)
156
- struct fdt_header *bph = blob;
157
- uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
158
- uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
159
- uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
160
- struct fdt_reserve_entry *p_rsvmap =
161
- (struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
162
- const char *p_struct = (const char *)blob + off_dt;
163
- const char *p_strings = (const char *)blob + off_str;
164
- uint32_t version = fdt32_to_cpu(bph->version);
165
- uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
167
- const char *p, *s, *t;
168
- int depth, sz, shift;
170
- uint64_t addr, size;
175
- printf("/dts-v1/;\n");
176
- printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
177
- printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
178
- printf("// off_dt_struct:\t0x%x\n", off_dt);
179
- printf("// off_dt_strings:\t0x%x\n", off_str);
180
- printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
181
- printf("// version:\t\t%d\n", version);
182
- printf("// last_comp_version:\t%d\n",
183
- fdt32_to_cpu(bph->last_comp_version));
185
- printf("// boot_cpuid_phys:\t0x%x\n",
186
- fdt32_to_cpu(bph->boot_cpuid_phys));
189
- printf("// size_dt_strings:\t0x%x\n",
190
- fdt32_to_cpu(bph->size_dt_strings));
192
- printf("// size_dt_struct:\t0x%x\n",
193
- fdt32_to_cpu(bph->size_dt_struct));
196
- for (i = 0; ; i++) {
197
- addr = fdt64_to_cpu(p_rsvmap[i].address);
198
- size = fdt64_to_cpu(p_rsvmap[i].size);
199
- if (addr == 0 && size == 0)
202
- printf("/memreserve/ %llx %llx;\n",
203
- (unsigned long long)addr, (unsigned long long)size);
207
- while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
209
- /* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
211
- if (tag == FDT_BEGIN_NODE) {
213
- p = PALIGN(p + strlen(s) + 1, 4);
218
- printf("%*s%s {\n", depth * shift, "", s);
224
- if (tag == FDT_END_NODE) {
227
- printf("%*s};\n", depth * shift, "");
231
- if (tag == FDT_NOP) {
232
- printf("%*s// [NOP]\n", depth * shift, "");
236
- if (tag != FDT_PROP) {
237
- fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
240
- sz = fdt32_to_cpu(GET_CELL(p));
241
- s = p_strings + fdt32_to_cpu(GET_CELL(p));
242
- if (version < 16 && sz >= 8)
246
- p = PALIGN(p + sz, 4);
248
- printf("%*s%s", depth * shift, "", s);
255
-int main(int argc, char *argv[])
260
- fprintf(stderr, "supply input filename\n");
264
- buf = utilfdt_read(argv[1]);
272
Index: device-tree-compiler-1.3.0/fdtdump.c
273
===================================================================
274
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
275
+++ device-tree-compiler-1.3.0/fdtdump.c 2012-01-30 15:04:46.255989457 +0100
115
278
+ * fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
288
+#include <libfdt_env.h>
292
+#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
293
+#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
294
+#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
296
+static void print_data(const char *data, int len)
299
+ const char *p = data;
301
+ /* no data, don't print */
305
+ if (util_is_printable_string(data, len)) {
306
+ printf(" = \"%s\"", (const char *)data);
307
+ } else if ((len % 4) == 0) {
309
+ for (i = 0; i < len; i += 4)
310
+ printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
311
+ i < (len - 4) ? " " : "");
315
+ for (i = 0; i < len; i++)
316
+ printf("%02x%s", *p++, i < len - 1 ? " " : "");
321
+static void dump_blob(void *blob)
323
+ struct fdt_header *bph = blob;
324
+ uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
325
+ uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
326
+ uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
327
+ struct fdt_reserve_entry *p_rsvmap =
328
+ (struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
329
+ const char *p_struct = (const char *)blob + off_dt;
330
+ const char *p_strings = (const char *)blob + off_str;
331
+ uint32_t version = fdt32_to_cpu(bph->version);
332
+ uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
334
+ const char *p, *s, *t;
335
+ int depth, sz, shift;
337
+ uint64_t addr, size;
342
+ printf("/dts-v1/;\n");
343
+ printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
344
+ printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
345
+ printf("// off_dt_struct:\t0x%x\n", off_dt);
346
+ printf("// off_dt_strings:\t0x%x\n", off_str);
347
+ printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
348
+ printf("// version:\t\t%d\n", version);
349
+ printf("// last_comp_version:\t%d\n",
350
+ fdt32_to_cpu(bph->last_comp_version));
352
+ printf("// boot_cpuid_phys:\t0x%x\n",
353
+ fdt32_to_cpu(bph->boot_cpuid_phys));
356
+ printf("// size_dt_strings:\t0x%x\n",
357
+ fdt32_to_cpu(bph->size_dt_strings));
359
+ printf("// size_dt_struct:\t0x%x\n",
360
+ fdt32_to_cpu(bph->size_dt_struct));
363
+ for (i = 0; ; i++) {
364
+ addr = fdt64_to_cpu(p_rsvmap[i].address);
365
+ size = fdt64_to_cpu(p_rsvmap[i].size);
366
+ if (addr == 0 && size == 0)
369
+ printf("/memreserve/ %llx %llx;\n",
370
+ (unsigned long long)addr, (unsigned long long)size);
374
+ while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
376
+ /* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
378
+ if (tag == FDT_BEGIN_NODE) {
380
+ p = PALIGN(p + strlen(s) + 1, 4);
385
+ printf("%*s%s {\n", depth * shift, "", s);
391
+ if (tag == FDT_END_NODE) {
394
+ printf("%*s};\n", depth * shift, "");
398
+ if (tag == FDT_NOP) {
399
+ printf("%*s// [NOP]\n", depth * shift, "");
403
+ if (tag != FDT_PROP) {
404
+ fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
407
+ sz = fdt32_to_cpu(GET_CELL(p));
408
+ s = p_strings + fdt32_to_cpu(GET_CELL(p));
409
+ if (version < 16 && sz >= 8)
413
+ p = PALIGN(p + sz, 4);
415
+ printf("%*s%s", depth * shift, "", s);
422
+int main(int argc, char *argv[])
427
+ fprintf(stderr, "supply input filename\n");
431
+ buf = utilfdt_read(argv[1]);