fdt.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _FDT_H
  2. #define _FDT_H
  3. #ifndef __ASSEMBLY__
  4. struct fdt_header {
  5. uint32_t magic; /* magic word FDT_MAGIC */
  6. uint32_t totalsize; /* total size of DT block */
  7. uint32_t off_dt_struct; /* offset to structure */
  8. uint32_t off_dt_strings; /* offset to strings */
  9. uint32_t off_mem_rsvmap; /* offset to memory reserve map */
  10. uint32_t version; /* format version */
  11. uint32_t last_comp_version; /* last compatible version */
  12. /* version 2 fields below */
  13. uint32_t boot_cpuid_phys; /* Which physical CPU id we're
  14. booting on */
  15. /* version 3 fields below */
  16. uint32_t size_dt_strings; /* size of the strings block */
  17. /* version 17 fields below */
  18. uint32_t size_dt_struct; /* size of the structure block */
  19. };
  20. struct fdt_reserve_entry {
  21. uint64_t address;
  22. uint64_t size;
  23. };
  24. struct fdt_node_header {
  25. uint32_t tag;
  26. char name[0];
  27. };
  28. struct fdt_property {
  29. uint32_t tag;
  30. uint32_t len;
  31. uint32_t nameoff;
  32. char data[0];
  33. };
  34. #endif /* !__ASSEMBLY */
  35. #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
  36. #define FDT_TAGSIZE sizeof(uint32_t)
  37. #define FDT_BEGIN_NODE 0x1 /* Start node: full name */
  38. #define FDT_END_NODE 0x2 /* End node */
  39. #define FDT_PROP 0x3 /* Property: name off,
  40. size, content */
  41. #define FDT_NOP 0x4 /* nop */
  42. #define FDT_END 0x9
  43. #define FDT_V1_SIZE (7*sizeof(uint32_t))
  44. #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t))
  45. #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t))
  46. #define FDT_V16_SIZE FDT_V3_SIZE
  47. #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t))
  48. /* adding a ramdisk needs 0x44 bytes in version 2008.10 */
  49. #define FDT_RAMDISK_OVERHEAD 0x80
  50. #endif /* _FDT_H */