David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 1 | #ifndef _FLAT_DT_H_ |
| 2 | #define _FLAT_DT_H_ |
| 3 | |
| 4 | |
Jerry Van Baren | cd1da87 | 2007-03-18 16:49:24 -0400 | [diff] [blame] | 5 | #define OF_DEFAULT_VERSION 17 |
| 6 | |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 7 | #define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total size */ |
| 8 | |
| 9 | #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name */ |
| 10 | #define OF_DT_END_NODE 0x2 /* End node */ |
| 11 | #define OF_DT_PROP 0x3 /* Property: name off, |
David Gibson | b2543fc | 2005-08-29 14:58:27 +1000 | [diff] [blame] | 12 | size, content */ |
| 13 | #define OF_DT_NOP 0x4 /* nop */ |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 14 | #define OF_DT_END 0x9 |
| 15 | |
| 16 | struct boot_param_header { |
| 17 | uint32_t magic; /* magic word OF_DT_HEADER */ |
| 18 | uint32_t totalsize; /* total size of DT block */ |
| 19 | uint32_t off_dt_struct; /* offset to structure */ |
| 20 | uint32_t off_dt_strings; /* offset to strings */ |
| 21 | uint32_t off_mem_rsvmap; /* offset to memory reserve map */ |
| 22 | uint32_t version; /* format version */ |
| 23 | uint32_t last_comp_version; /* last compatible version */ |
| 24 | |
| 25 | /* version 2 fields below */ |
| 26 | uint32_t boot_cpuid_phys; /* Which physical CPU id we're |
| 27 | booting on */ |
| 28 | /* version 3 fields below */ |
| 29 | uint32_t size_dt_strings; /* size of the strings block */ |
David Gibson | 46c88df | 2007-03-14 11:02:40 +1100 | [diff] [blame] | 30 | |
| 31 | /* version 17 fields below */ |
| 32 | uint32_t size_dt_struct; /* size of the DT structure block */ |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | #define BPH_V1_SIZE (7*sizeof(uint32_t)) |
| 36 | #define BPH_V2_SIZE (BPH_V1_SIZE + sizeof(uint32_t)) |
| 37 | #define BPH_V3_SIZE (BPH_V2_SIZE + sizeof(uint32_t)) |
David Gibson | 46c88df | 2007-03-14 11:02:40 +1100 | [diff] [blame] | 38 | #define BPH_V17_SIZE (BPH_V3_SIZE + sizeof(uint32_t)) |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 39 | |
| 40 | struct reserve_entry { |
| 41 | uint64_t address; |
| 42 | uint64_t size; |
| 43 | }; |
| 44 | |
| 45 | struct flat_dt_property { |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 46 | uint32_t len; |
David Gibson | 6ae55f9 | 2007-02-26 11:02:24 +1100 | [diff] [blame] | 47 | uint32_t nameoff; |
David Gibson | ab870ca | 2005-06-23 15:45:13 +1000 | [diff] [blame] | 48 | char data[0]; |
| 49 | }; |
| 50 | |
| 51 | #endif /* _FLAT_DT_H_ */ |