fdt.h 1.7 KB

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