fdt.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
  2. #ifndef FDT_H
  3. #define FDT_H
  4. /*
  5. * libfdt - Flat Device Tree manipulation
  6. * Copyright (C) 2006 David Gibson, IBM Corporation.
  7. * Copyright 2012 Kim Phillips, Freescale Semiconductor.
  8. */
  9. #ifndef __ASSEMBLY__
  10. struct fdt_header {
  11. fdt32_t magic; /* magic word FDT_MAGIC */
  12. fdt32_t totalsize; /* total size of DT block */
  13. fdt32_t off_dt_struct; /* offset to structure */
  14. fdt32_t off_dt_strings; /* offset to strings */
  15. fdt32_t off_mem_rsvmap; /* offset to memory reserve map */
  16. fdt32_t version; /* format version */
  17. fdt32_t last_comp_version; /* last compatible version */
  18. /* version 2 fields below */
  19. fdt32_t boot_cpuid_phys; /* Which physical CPU id we're
  20. booting on */
  21. /* version 3 fields below */
  22. fdt32_t size_dt_strings; /* size of the strings block */
  23. /* version 17 fields below */
  24. fdt32_t size_dt_struct; /* size of the structure block */
  25. };
  26. struct fdt_reserve_entry {
  27. fdt64_t address;
  28. fdt64_t size;
  29. };
  30. struct fdt_node_header {
  31. fdt32_t tag;
  32. char name[0];
  33. };
  34. struct fdt_property {
  35. fdt32_t tag;
  36. fdt32_t len;
  37. fdt32_t nameoff;
  38. char data[0];
  39. };
  40. #endif /* !__ASSEMBLY */
  41. #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
  42. #define FDT_TAGSIZE sizeof(fdt32_t)
  43. #define FDT_BEGIN_NODE 0x1 /* Start node: full name */
  44. #define FDT_END_NODE 0x2 /* End node */
  45. #define FDT_PROP 0x3 /* Property: name off,
  46. size, content */
  47. #define FDT_NOP 0x4 /* nop */
  48. #define FDT_END 0x9
  49. #define FDT_V1_SIZE (7*sizeof(fdt32_t))
  50. #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t))
  51. #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t))
  52. #define FDT_V16_SIZE FDT_V3_SIZE
  53. #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t))
  54. #endif /* FDT_H */