Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 1 | #ifndef _FDT_H |
| 2 | #define _FDT_H |
| 3 | |
| 4 | #ifndef __ASSEMBLY__ |
| 5 | |
| 6 | struct fdt_header { |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 7 | fdt32_t magic; /* magic word FDT_MAGIC */ |
| 8 | fdt32_t totalsize; /* total size of DT block */ |
| 9 | fdt32_t off_dt_struct; /* offset to structure */ |
| 10 | fdt32_t off_dt_strings; /* offset to strings */ |
| 11 | fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ |
| 12 | fdt32_t version; /* format version */ |
| 13 | fdt32_t last_comp_version; /* last compatible version */ |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 14 | |
Wolfgang Denk | 27dd982 | 2007-11-26 19:18:21 +0100 | [diff] [blame] | 15 | /* version 2 fields below */ |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 16 | fdt32_t boot_cpuid_phys; /* Which physical CPU id we're |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 17 | booting on */ |
| 18 | /* version 3 fields below */ |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 19 | fdt32_t size_dt_strings; /* size of the strings block */ |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 20 | |
| 21 | /* version 17 fields below */ |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 22 | fdt32_t size_dt_struct; /* size of the structure block */ |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | struct fdt_reserve_entry { |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 26 | fdt64_t address; |
| 27 | fdt64_t size; |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | struct fdt_node_header { |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 31 | fdt32_t tag; |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 32 | char name[0]; |
| 33 | }; |
| 34 | |
| 35 | struct fdt_property { |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 36 | fdt32_t tag; |
| 37 | fdt32_t len; |
| 38 | fdt32_t nameoff; |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 39 | char data[0]; |
| 40 | }; |
| 41 | |
| 42 | #endif /* !__ASSEMBLY */ |
| 43 | |
Wolfgang Denk | 27dd982 | 2007-11-26 19:18:21 +0100 | [diff] [blame] | 44 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 45 | #define FDT_TAGSIZE sizeof(fdt32_t) |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 46 | |
Wolfgang Denk | 27dd982 | 2007-11-26 19:18:21 +0100 | [diff] [blame] | 47 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ |
| 48 | #define FDT_END_NODE 0x2 /* End node */ |
| 49 | #define FDT_PROP 0x3 /* Property: name off, |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 50 | size, content */ |
| 51 | #define FDT_NOP 0x4 /* nop */ |
| 52 | #define FDT_END 0x9 |
| 53 | |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 54 | #define FDT_V1_SIZE (7*sizeof(fdt32_t)) |
| 55 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) |
| 56 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 57 | #define FDT_V16_SIZE FDT_V3_SIZE |
Kim Phillips | db9cfa7 | 2013-01-16 13:59:43 +0000 | [diff] [blame^] | 58 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 59 | |
Heiko Schocher | d29abae | 2008-09-11 08:11:23 +0200 | [diff] [blame] | 60 | /* adding a ramdisk needs 0x44 bytes in version 2008.10 */ |
| 61 | #define FDT_RAMDISK_OVERHEAD 0x80 |
Gerald Van Baren | c0577a6 | 2007-03-31 11:59:59 -0400 | [diff] [blame] | 62 | #endif /* _FDT_H */ |