fdt.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * libfdt - Flat Device Tree manipulation
  3. * Copyright (C) 2006 David Gibson, IBM Corporation.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public License
  7. * as published by the Free Software Foundation; either version 2.1 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef _FDT_H
  20. #define _FDT_H
  21. #ifndef __ASSEMBLY__
  22. struct fdt_header {
  23. uint32_t magic; /* magic word FDT_MAGIC */
  24. uint32_t totalsize; /* total size of DT block */
  25. uint32_t off_dt_struct; /* offset to structure */
  26. uint32_t off_dt_strings; /* offset to strings */
  27. uint32_t off_mem_rsvmap; /* offset to memory reserve map */
  28. uint32_t version; /* format version */
  29. uint32_t last_comp_version; /* last compatible version */
  30. /* version 2 fields below */
  31. uint32_t boot_cpuid_phys; /* Which physical CPU id we're
  32. booting on */
  33. /* version 3 fields below */
  34. uint32_t size_dt_strings; /* size of the strings block */
  35. /* version 17 fields below */
  36. uint32_t size_dt_struct; /* size of the structure block */
  37. };
  38. struct fdt_reserve_entry {
  39. uint64_t address;
  40. uint64_t size;
  41. };
  42. struct fdt_node_header {
  43. uint32_t tag;
  44. char name[0];
  45. };
  46. struct fdt_property {
  47. uint32_t tag;
  48. uint32_t len;
  49. uint32_t nameoff;
  50. char data[0];
  51. };
  52. #endif /* !__ASSEMBLY */
  53. #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
  54. #define FDT_TAGSIZE sizeof(uint32_t)
  55. #define FDT_BEGIN_NODE 0x1 /* Start node: full name */
  56. #define FDT_END_NODE 0x2 /* End node */
  57. #define FDT_PROP 0x3 /* Property: name off,
  58. size, content */
  59. #define FDT_NOP 0x4 /* nop */
  60. #define FDT_END 0x9
  61. #define FDT_V1_SIZE (7*sizeof(uint32_t))
  62. #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t))
  63. #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t))
  64. #define FDT_V16_SIZE FDT_V3_SIZE
  65. #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t))
  66. #endif /* _FDT_H */